source: BLFS/Makefile@ 0e2c6bc

trunk
Last change on this file since 0e2c6bc 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
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
[875366f]58LFS-GIT = https://git.linuxfromscratch.org/lfs.git
[4ed4a32]59LFS-BRANCH = trunk
[875366f]60GIT = https://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; \
[b39eb29]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 \
[b39eb29]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
[1242857]194ifneq (,$(LFS-BRANCH))
[4ed4a32]195 $(Q)cd $(LFS_XML) && \
[1242857]196 git checkout trunk && \
[4ed4a32]197 git pull && \
[1242857]198 if [ $(LFS-BRANCH) != trunk ]; then git checkout $(LFS-BRANCH); fi
199endif
200ifneq (,$(BLFS-BRANCH))
[4ed4a32]201 $(Q)cd $(BLFS_XML) && \
[1242857]202 git checkout trunk && \
[4ed4a32]203 git pull && \
[1242857]204 if [ $(BLFS-BRANCH) != trunk ]; then git checkout $(BLFS-BRANCH); fi
205endif
[e576789]206
[506120ee]207$(LFS_XML):
208 @echo Getting the LFS book sources...
[fbbe081]209 $(Q)git clone $(LFS-GIT) $@
[1242857]210ifneq (,$(LFS-BRANCH))
[4ed4a32]211 if [ $(LFS-BRANCH) != trunk ]; then \
212 cd $@ && \
213 git checkout $(LFS-BRANCH); \
214 fi
[1242857]215endif
[506120ee]216
[e576789]217$(BLFS_XML):
[506120ee]218 @echo Getting the BLFS book sources...
[fbbe081]219 $(Q)git clone $(GIT) $@
[1242857]220ifneq (,$(BLFS-BRANCH))
[894eec3]221 $(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
[4ed4a32]222 cd $@ && \
223 git checkout $(BLFS-BRANCH); \
224 fi
[1242857]225endif
[f4ed135]226# Clean up
227
228clean:
[e576789]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
[f4ed135]231
[84440e6]232FORCE:
[b39eb29]233.PHONY: clean all update $(CONFIG_OUT) version FORCE
Note: See TracBrowser for help on using the repository browser.