source: BLFS/Makefile@ 8825e69

ablfs-more trunk
Last change on this file since 8825e69 was b8e5cad, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Pass tracking file to gen_pkg_book

This is needed for managing -pass1 packages, since their version
can only be found in the tracking file (thanks to previous commit).

  • Property mode set to 100644
File size: 7.3 KB
RevLine 
[f4ed135]1# From the Build Scripts Written By: Jim Gifford <lfs@jg555.com>
[e415656]2# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org>
[f4ed135]3# Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
[e576789]4# Pierre Labastie <pierre.labastie at neuf.fr>
[f4ed135]5
[e576789]6ifdef V
7 Q =
8else
9 Q = @
10endif
11
[84440e6]12# Makefile should reside in a directory where there are two subdirectories
13# initially:
14TOPDIR = $(shell pwd)
15# the stylesheets
16XSLDIR = $(TOPDIR)/xsl
17# the menu program sources
18MENU = $(TOPDIR)/menu
19
20# Those directories and files will be created and populated by make:
21# directory of the book sources:
[506120ee]22LFS_XML = $(TOPDIR)/lfs-xml
[84440e6]23BLFS_XML = $(TOPDIR)/blfs-xml
24# contains the REV used in the preceding call:
25REVFILE = $(TOPDIR)/revision
26# the list of packages:
27PACK_LIST = $(TOPDIR)/packages.xml
28# the generated menu input:
[e576789]29CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
[84440e6]30# menu output:
31CONFIG_OUT = $(TOPDIR)/configuration
32# the linear book:
33BOOK_XML = $(TOPDIR)/book.xml
34
[506120ee]35LFSTMP = $(LFS_XML)/tmp
[84440e6]36RENDERTMP = $(BLFS_XML)/tmp
[506120ee]37LFS_FULL = $(LFSTMP)/lfs-full.xml
[84440e6]38BLFS_FULL = $(RENDERTMP)/blfs-full.xml
39
40# The right-hand side is updated by jhalfs:
41# Where the tracking file resides:
42TRACKING_DIR = tracking-dir
43
44# Will be created by make, if not existent
45TRACKFILE = $(TRACKING_DIR)/instpkg.xml
[e576789]46
[84440e6]47# Initial content of the tracking file
[e576789]48define INITIAL_TRACK
49<?xml version="1.0" encoding="ISO-8859-1"?>\n\
50\n\
51<!DOCTYPE sublist SYSTEM "$(TOPDIR)/packdesc.dtd">\n\
52<sublist>\n\
53 <name>Installed</name>\n\
54</sublist>
55endef
56
[4ed4a32]57# Git locations and branches
[fbbe081]58LFS-GIT = git://git.linuxfromscratch.org/lfs.git
[4ed4a32]59LFS-BRANCH = trunk
[fbbe081]60GIT = git://git.linuxfromscratch.org/blfs.git
[4ed4a32]61BLFS-BRANCH = trunk
[e576789]62
63ALLXML := $(filter-out $(RENDERTMP)/%, \
[84440e6]64 $(shell if [ -d $(BLFS_XML) ]; then \
65 find $(BLFS_XML) -name \*.xml; \
66 fi))
[506120ee]67ALLXMLLFS:= $(filter-out $(LFSTMP)/%, \
68 $(shell if [ -d $(LFS_XML) ]; then \
69 find $(LFS_XML) -name \*.xml; \
70 fi))
[e576789]71ALLXSL := $(filter-out $(RENDERTMP)/%, \
[84440e6]72 $(shell if [ -d $(BLFS_XML) ]; then \
73 find $(BLFS_XML) -name \*.xsl; \
74 fi))
[506120ee]75ALLXSLLFS := $(filter-out $(LFSTMP)/%, \
76 $(shell if [ -d $(LFS_XML) ]; then \
77 find $(LFS_XML) -name \*.xsl; \
78 fi))
[84440e6]79
80# Try to set the REV variable according to previous runs, except when
81# set on the command line:
82REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi)
83ifneq ($(origin REV),command line)
84 ifdef REV1
85 REV = $(REV1)
86 else
87 REV = not defined
88 endif
89endif
90
91ifneq ($(REV),sysv)
92 ifneq ($(REV),systemd)
93 $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
94 endif
95endif
[e576789]96
97$(BOOK_XML): $(CONFIG_OUT)
[b8e5cad]98 $(Q)$(TOPDIR)/gen_pkg_book.sh $(TRACKFILE) $(TOPDIR) $(BLFS_FULL) $(LFS_FULL)
[f4ed135]99
[f596dde]100$(CONFIG_OUT): $(CONFIG_CONFIG_IN)
101 $(Q)CONFIG_="" KCONFIG_CONFIG=configuration \
[a4af6811]102 python3 $(MENU)/menuconfig.py $(CONFIG_CONFIG_IN)
[f4ed135]103
[e576789]104$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
105 $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
[f4ed135]106
[506120ee]107$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(LFS_FULL)
[e576789]108 $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
[506120ee]109 --stringparam lfs-full $(LFS_FULL) \
[e576789]110 -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
111 $(Q)xmllint --postvalid --format -o $@ $@.tmp
112 $(Q)rm $@.tmp
[f4ed135]113
[e576789]114# Beware of the echo '$(INITIAL_TRACK)' command below:
115# if shell is bash or sh linked to bash, needs echo -e
116# if shell is dash or sh linked to dash: echo is enough
117# Don't ask me why
118# So use /bin/echo (needs -e)
119$(TRACKFILE): $(TRACKING_DIR)
120 $(Q)if ! [ -f $@ ]; then \
121 echo Initializing $(TRACKFILE) && \
[e415656]122 /bin/echo -e '$(INITIAL_TRACK)' > $@; \
[e576789]123 fi
124 $(Q)for track in $(TRACKING_DIR)/*-*; do \
[e415656]125 if [ -f $$track ]; then \
[e576789]126 pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
127 version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
128 xsltproc --stringparam packages $(PACK_LIST) \
129 --stringparam package $$pack \
130 --stringparam version $$version \
131 -o track.tmp $(XSLDIR)/bump.xsl $@ && \
132 sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
133 xmllint --format --postvalid track.tmp > $@; \
[e415656]134 fi; \
135 rm -f $$track; \
[e576789]136 done; \
137 rm -f track.tmp
138
139$(TRACKING_DIR):
140 @echo Creating $(TRACKING_DIR)
141 $(Q)mkdir -p $@
142
143$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
144 $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
145
[84440e6]146ifneq ($(REV),$(REV1))
147$(BLFS_FULL): FORCE
[506120ee]148$(LFS_FULL): FORCE
[84440e6]149endif
[f756851]150$(LFS_FULL): $(LFS_XML) $(LFS_XML)/general.ent $(ALLXMLLFS) $(ALLXSLLFS)
151 $(Q)cd $(LFS_XML) && if [ -x git-version.sh ] ; then \
152 echo "Processing LFS version..."; \
153 ./git-version.sh $(REV); \
154 fi
[506120ee]155 @echo "Processing LFS bootscripts..."
156 $(Q)cd $(LFS_XML) && bash process-scripts.sh
157 $(Q)[ -d $(LFSTMP) ] || mkdir -p $(LFSTMP)
158 @echo "Adjusting LFS for revision $(REV)..."
159 $(Q)xsltproc --nonet --xinclude \
160 --stringparam profile.revision $(REV) \
161 --output $(LFSTMP)/lfs-prof.xml \
162 $(LFS_XML)/stylesheets/lfs-xsl/profile.xsl \
163 $(LFS_XML)/index.xml
164 @echo "Validating the LFS book..."
165 $(Q)xmllint --nonet --noent --postvalid \
166 -o $@ $(LFSTMP)/lfs-prof.xml
167 $(Q)rm -f $(LFS_XML)/appendices/*.script
168 $(Q)cd $(LFS_XML) && ./aux-file-data.sh $@
169 $(Q)echo $(REV) > $(REVFILE)
170
[f756851]171$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
172 $(Q)cd $(BLFS_XML) && if [ -x git-version.sh ] ; then \
173 echo "Processing BLFS version..."; \
174 ./git-version.sh $(REV); \
175 fi
[e576789]176 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
[506120ee]177 @echo "Adjusting BLFS for revision $(REV)..."
[4f3c433]178 $(Q)xsltproc --nonet --xinclude \
179 --stringparam profile.revision $(REV) \
180 --output $(RENDERTMP)/blfs-prof.xml \
181 $(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
182 $(BLFS_XML)/index.xml
[506120ee]183 @echo "Validating the BLFS book..."
[4f3c433]184 $(Q)xmllint --nonet --noent --postvalid \
185 -o $@ $(RENDERTMP)/blfs-prof.xml
[84440e6]186 $(Q)echo $(REV) > $(REVFILE)
[e576789]187
188all: update $(BOOK_XML)
189
[4ed4a32]190# If in detached head state, "git pull" returns an error, so switch back to
191# trunk before updating, and switch back to the branch/tag afterwards
[506120ee]192update: $(BLFS_XML) $(LFS_XML)
[e576789]193 @echo Updating the book sources
[4ed4a32]194 $(Q)cd $(LFS_XML) && \
195 if [ $(LFS-BRANCH) != trunk ]; then git switch -; fi && \
196 git pull && \
197 git checkout $(LFS-BRANCH)
198 $(Q)cd $(BLFS_XML) && \
199 if [ $(BLFS-BRANCH) != trunk ]; then git switch -; fi && \
200 git pull && \
201 git checkout $(BLFS-BRANCH)
[e576789]202
[506120ee]203$(LFS_XML):
204 @echo Getting the LFS book sources...
[fbbe081]205 $(Q)git clone $(LFS-GIT) $@
[4ed4a32]206 if [ $(LFS-BRANCH) != trunk ]; then \
207 cd $@ && \
208 git checkout $(LFS-BRANCH); \
209 fi
[506120ee]210
[e576789]211$(BLFS_XML):
[506120ee]212 @echo Getting the BLFS book sources...
[fbbe081]213 $(Q)git clone $(GIT) $@
[894eec3]214 $(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
[4ed4a32]215 cd $@ && \
216 git checkout $(BLFS-BRANCH); \
217 fi
[f4ed135]218
219# Clean up
220
221clean:
[e576789]222 rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
223 rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
[f4ed135]224
[84440e6]225FORCE:
[34c47be]226.PHONY: clean all update $(CONFIG_OUT) version FORCE
Note: See TracBrowser for help on using the repository browser.