source: BLFS/Makefile@ 5a8939e

ablfs-more legacy trunk
Last change on this file since 5a8939e was 607ef21, checked in by Pierre Labastie <pierre@…>, 7 years ago

Add missing bits to generate scripts for LFS in BLFS tools

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