source: BLFS/Makefile@ 240d928

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

Fix blfs tools for condxml

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