source: BLFS/Makefile@ e6efe4c9

ablfs-more trunk
Last change on this file since e6efe4c9 was b39eb29, checked in by Pierre Labastie <pierre.labastie@…>, 22 months ago

Revert changes to BLFS/Makefile

Changes to book's Makefile have been reverted too...

  • Property mode set to 100644
File size: 7.4 KB
Line 
1# From the Build Scripts Written By: Jim Gifford <lfs@jg555.com>
2# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org>
3# Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
4# Pierre Labastie <pierre.labastie at neuf.fr>
5
6ifdef V
7 Q =
8else
9 Q = @
10endif
11
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:
22LFS_XML = $(TOPDIR)/lfs-xml
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:
29CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
30# menu output:
31CONFIG_OUT = $(TOPDIR)/configuration
32# the linear book:
33BOOK_XML = $(TOPDIR)/book.xml
34
35LFSTMP = $(LFS_XML)/tmp
36RENDERTMP = $(BLFS_XML)/tmp
37LFS_FULL = $(LFSTMP)/lfs-full.xml
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
46
47# Initial content of the tracking file
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
57# Git locations and branches
58LFS-GIT = https://git.linuxfromscratch.org/lfs.git
59LFS-BRANCH = trunk
60GIT = https://git.linuxfromscratch.org/blfs.git
61BLFS-BRANCH = trunk
62
63ALLXML := $(filter-out $(RENDERTMP)/%, \
64 $(shell if [ -d $(BLFS_XML) ]; then \
65 find $(BLFS_XML) -name \*.xml; \
66 fi))
67ALLXMLLFS:= $(filter-out $(LFSTMP)/%, \
68 $(shell if [ -d $(LFS_XML) ]; then \
69 find $(LFS_XML) -name \*.xml; \
70 fi))
71ALLXSL := $(filter-out $(RENDERTMP)/%, \
72 $(shell if [ -d $(BLFS_XML) ]; then \
73 find $(BLFS_XML) -name \*.xsl; \
74 fi))
75ALLXSLLFS := $(filter-out $(LFSTMP)/%, \
76 $(shell if [ -d $(LFS_XML) ]; then \
77 find $(LFS_XML) -name \*.xsl; \
78 fi))
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
96
97$(BOOK_XML): $(CONFIG_OUT)
98 $(Q)$(TOPDIR)/gen_pkg_book.sh $(TRACKFILE) $(TOPDIR) $(BLFS_FULL) $(LFS_FULL)
99
100$(CONFIG_OUT): $(CONFIG_CONFIG_IN)
101 $(Q)CONFIG_="" KCONFIG_CONFIG=configuration \
102 python3 $(MENU)/menuconfig.py $(CONFIG_CONFIG_IN)
103
104$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
105 $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
106
107$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(LFS_FULL)
108 $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
109 --stringparam lfs-full $(LFS_FULL) \
110 -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
111 $(Q)xmllint --postvalid --format -o $@ $@.tmp
112 $(Q)rm $@.tmp
113
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) && \
122 /bin/echo -e '$(INITIAL_TRACK)' > $@; \
123 fi
124 $(Q)for track in $(TRACKING_DIR)/*-*; do \
125 if [ -f $$track ]; then \
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 > $@; \
134 fi; \
135 rm -f $$track; \
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
146ifneq ($(REV),$(REV1))
147$(BLFS_FULL): FORCE
148$(LFS_FULL): FORCE
149endif
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
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
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
176 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
177 @echo "Adjusting BLFS for revision $(REV)..."
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
183 @echo "Validating the BLFS book..."
184 $(Q)xmllint --nonet --noent --postvalid \
185 -o $@ $(RENDERTMP)/blfs-prof.xml
186 $(Q)echo $(REV) > $(REVFILE)
187
188all: update $(BOOK_XML)
189
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
192update: $(BLFS_XML) $(LFS_XML)
193 @echo Updating the book sources
194ifneq (,$(LFS-BRANCH))
195 $(Q)cd $(LFS_XML) && \
196 git checkout trunk && \
197 git pull && \
198 if [ $(LFS-BRANCH) != trunk ]; then git checkout $(LFS-BRANCH); fi
199endif
200ifneq (,$(BLFS-BRANCH))
201 $(Q)cd $(BLFS_XML) && \
202 git checkout trunk && \
203 git pull && \
204 if [ $(BLFS-BRANCH) != trunk ]; then git checkout $(BLFS-BRANCH); fi
205endif
206
207$(LFS_XML):
208 @echo Getting the LFS book sources...
209 $(Q)git clone $(LFS-GIT) $@
210ifneq (,$(LFS-BRANCH))
211 if [ $(LFS-BRANCH) != trunk ]; then \
212 cd $@ && \
213 git checkout $(LFS-BRANCH); \
214 fi
215endif
216
217$(BLFS_XML):
218 @echo Getting the BLFS book sources...
219 $(Q)git clone $(GIT) $@
220ifneq (,$(BLFS-BRANCH))
221 $(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
222 cd $@ && \
223 git checkout $(BLFS-BRANCH); \
224 fi
225endif
226# Clean up
227
228clean:
229 rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
230 rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
231
232FORCE:
233.PHONY: clean all update $(CONFIG_OUT) version FORCE
Note: See TracBrowser for help on using the repository browser.