source: BLFS/Makefile@ fd4a798

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

Remove $Id$ comments, they are useless with git

  • Property mode set to 100644
File size: 7.2 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 = git://git.linuxfromscratch.org/lfs.git
59LFS-BRANCH = trunk
60GIT = git://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 $(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) lfs-version
151 @echo "Processing LFS bootscripts..."
152 $(Q)cd $(LFS_XML) && bash process-scripts.sh
153 $(Q)[ -d $(LFSTMP) ] || mkdir -p $(LFSTMP)
154 @echo "Adjusting LFS for revision $(REV)..."
155 $(Q)xsltproc --nonet --xinclude \
156 --stringparam profile.revision $(REV) \
157 --output $(LFSTMP)/lfs-prof.xml \
158 $(LFS_XML)/stylesheets/lfs-xsl/profile.xsl \
159 $(LFS_XML)/index.xml
160 @echo "Validating the LFS book..."
161 $(Q)xmllint --nonet --noent --postvalid \
162 -o $@ $(LFSTMP)/lfs-prof.xml
163 $(Q)rm -f $(LFS_XML)/appendices/*.script
164 $(Q)cd $(LFS_XML) && ./aux-file-data.sh $@
165 $(Q)echo $(REV) > $(REVFILE)
166
167$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL) version
168 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
169 @echo "Adjusting BLFS for revision $(REV)..."
170 $(Q)xsltproc --nonet --xinclude \
171 --stringparam profile.revision $(REV) \
172 --output $(RENDERTMP)/blfs-prof.xml \
173 $(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
174 $(BLFS_XML)/index.xml
175 @echo "Validating the BLFS book..."
176 $(Q)xmllint --nonet --noent --postvalid \
177 -o $@ $(RENDERTMP)/blfs-prof.xml
178 $(Q)echo $(REV) > $(REVFILE)
179
180all: update $(BOOK_XML)
181
182# If in detached head state, "git pull" returns an error, so switch back to
183# trunk before updating, and switch back to the branch/tag afterwards
184update: $(BLFS_XML) $(LFS_XML)
185 @echo Updating the book sources
186 $(Q)cd $(LFS_XML) && \
187 if [ $(LFS-BRANCH) != trunk ]; then git switch -; fi && \
188 git pull && \
189 git checkout $(LFS-BRANCH)
190 $(Q)cd $(BLFS_XML) && \
191 if [ $(BLFS-BRANCH) != trunk ]; then git switch -; fi && \
192 git pull && \
193 git checkout $(BLFS-BRANCH)
194
195$(LFS_XML):
196 @echo Getting the LFS book sources...
197 $(Q)git clone $(LFS-GIT) $@
198 if [ $(LFS-BRANCH) != trunk ]; then \
199 cd $@ && \
200 git checkout $(LFS-BRANCH); \
201 fi
202
203$(BLFS_XML):
204 @echo Getting the BLFS book sources...
205 $(Q)git clone $(GIT) $@
206 $(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
207 cd $@ && \
208 git checkout $(BLFS-BRANCH); \
209 fi
210
211# Generate BLFS version from git:
212version:
213 $(Q)cd $(BLFS_XML) && if [ -x git-version.sh ] ; then \
214 ./git-version.sh $(REV); \
215 fi
216
217lfs-version:
218 $(Q)cd $(LFS_XML) && if [ -x git-version.sh ] ; then \
219 ./git-version.sh $(REV); \
220 fi
221
222# Clean up
223
224clean:
225 rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
226 rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
227
228FORCE:
229.PHONY: clean all update $(CONFIG_OUT) version FORCE
Note: See TracBrowser for help on using the repository browser.