source: BLFS/Makefile@ 2cef19f

ablfs-more legacy trunk
Last change on this file since 2cef19f 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
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
6# $Id$
7
8ifdef V
9 Q =
10else
11 Q = @
12endif
13
14# Known behavior
15LANG=C
16LC_ALL=C
17
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:
28LFS_XML = $(TOPDIR)/lfs-xml
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:
35CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
36# menu output:
37CONFIG_OUT = $(TOPDIR)/configuration
38# the linear book:
39BOOK_XML = $(TOPDIR)/book.xml
40
41LFSTMP = $(LFS_XML)/tmp
42RENDERTMP = $(BLFS_XML)/tmp
43LFS_FULL = $(LFSTMP)/lfs-full.xml
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
52
53# Initial content of the tracking file
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
63LFS-SVN = svn://svn.linuxfromscratch.org/LFS/trunk/BOOK
64SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
65
66ALLXML := $(filter-out $(RENDERTMP)/%, \
67 $(shell if [ -d $(BLFS_XML) ]; then \
68 find $(BLFS_XML) -name \*.xml; \
69 fi))
70ALLXMLLFS:= $(filter-out $(LFSTMP)/%, \
71 $(shell if [ -d $(LFS_XML) ]; then \
72 find $(LFS_XML) -name \*.xml; \
73 fi))
74ALLXSL := $(filter-out $(RENDERTMP)/%, \
75 $(shell if [ -d $(BLFS_XML) ]; then \
76 find $(BLFS_XML) -name \*.xsl; \
77 fi))
78ALLXSLLFS := $(filter-out $(LFSTMP)/%, \
79 $(shell if [ -d $(LFS_XML) ]; then \
80 find $(LFS_XML) -name \*.xsl; \
81 fi))
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
99
100$(BOOK_XML): $(CONFIG_OUT)
101 $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL) $(LFS_FULL)
102
103$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf
104 $(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
105
106$(MENU)/mconf:
107 $(Q)$(MAKE) -C $(MENU) ncurses conf mconf
108
109$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
110 $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
111
112$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(LFS_FULL)
113 $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
114 --stringparam lfs-full $(LFS_FULL) \
115 -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
116 $(Q)xmllint --postvalid --format -o $@ $@.tmp
117 $(Q)rm $@.tmp
118
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) && \
127 /bin/echo -e '$(INITIAL_TRACK)' > $@; \
128 fi
129 $(Q)for track in $(TRACKING_DIR)/*-*; do \
130 if [ -f $$track ]; then \
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 > $@; \
139 fi; \
140 rm -f $$track; \
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
151ifneq ($(REV),$(REV1))
152$(BLFS_FULL): FORCE
153$(LFS_FULL): FORCE
154endif
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
172$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
173 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
174 @echo "Adjusting BLFS for revision $(REV)..."
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
180 @echo "Validating the BLFS book..."
181 $(Q)xmllint --nonet --noent --postvalid \
182 -o $@ $(RENDERTMP)/blfs-prof.xml
183 $(Q)echo $(REV) > $(REVFILE)
184
185all: update $(BOOK_XML)
186
187update: $(BLFS_XML) $(LFS_XML)
188 @echo Updating the book sources
189 $(Q)cd $(LFS_XML) && svn up
190 $(Q)cd $(BLFS_XML) && svn up
191
192$(LFS_XML):
193 @echo Getting the LFS book sources...
194 $(Q)svn co $(LFS-SVN) $@
195
196$(BLFS_XML):
197 @echo Getting the BLFS book sources...
198 $(Q)svn co $(SVN) $@
199
200# Clean up
201
202clean:
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
206
207FORCE:
208.PHONY: clean all update $(CONFIG_OUT) FORCE
Note: See TracBrowser for help on using the repository browser.