source: BLFS/Makefile@ dfab075

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

Move to git: Change url and var names in BLFS/Makefile

Note that only trunk is accessible in the Makefile. Other branches
wil be made accessible later.

  • 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# 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:
24LFS_XML = $(TOPDIR)/lfs-xml
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:
31CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
32# menu output:
33CONFIG_OUT = $(TOPDIR)/configuration
34# the linear book:
35BOOK_XML = $(TOPDIR)/book.xml
36
37LFSTMP = $(LFS_XML)/tmp
38RENDERTMP = $(BLFS_XML)/tmp
39LFS_FULL = $(LFSTMP)/lfs-full.xml
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
48
49# Initial content of the tracking file
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
59LFS-GIT = git://git.linuxfromscratch.org/lfs.git
60GIT = git://git.linuxfromscratch.org/blfs.git
61
62ALLXML := $(filter-out $(RENDERTMP)/%, \
63 $(shell if [ -d $(BLFS_XML) ]; then \
64 find $(BLFS_XML) -name \*.xml; \
65 fi))
66ALLXMLLFS:= $(filter-out $(LFSTMP)/%, \
67 $(shell if [ -d $(LFS_XML) ]; then \
68 find $(LFS_XML) -name \*.xml; \
69 fi))
70ALLXSL := $(filter-out $(RENDERTMP)/%, \
71 $(shell if [ -d $(BLFS_XML) ]; then \
72 find $(BLFS_XML) -name \*.xsl; \
73 fi))
74ALLXSLLFS := $(filter-out $(LFSTMP)/%, \
75 $(shell if [ -d $(LFS_XML) ]; then \
76 find $(LFS_XML) -name \*.xsl; \
77 fi))
78
79# Try to set the REV variable according to previous runs, except when
80# set on the command line:
81REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi)
82ifneq ($(origin REV),command line)
83 ifdef REV1
84 REV = $(REV1)
85 else
86 REV = not defined
87 endif
88endif
89
90ifneq ($(REV),sysv)
91 ifneq ($(REV),systemd)
92 $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
93 endif
94endif
95
96$(BOOK_XML): $(CONFIG_OUT)
97 $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL) $(LFS_FULL)
98
99$(CONFIG_OUT): $(CONFIG_CONFIG_IN)
100 $(Q)CONFIG_="" KCONFIG_CONFIG=configuration \
101 python3 $(MENU)/menuconfig.py $(CONFIG_CONFIG_IN)
102
103$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
104 $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
105
106$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(LFS_FULL)
107 $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
108 --stringparam lfs-full $(LFS_FULL) \
109 -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
110 $(Q)xmllint --postvalid --format -o $@ $@.tmp
111 $(Q)rm $@.tmp
112
113# Beware of the echo '$(INITIAL_TRACK)' command below:
114# if shell is bash or sh linked to bash, needs echo -e
115# if shell is dash or sh linked to dash: echo is enough
116# Don't ask me why
117# So use /bin/echo (needs -e)
118$(TRACKFILE): $(TRACKING_DIR)
119 $(Q)if ! [ -f $@ ]; then \
120 echo Initializing $(TRACKFILE) && \
121 /bin/echo -e '$(INITIAL_TRACK)' > $@; \
122 fi
123 $(Q)for track in $(TRACKING_DIR)/*-*; do \
124 if [ -f $$track ]; then \
125 pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
126 version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
127 xsltproc --stringparam packages $(PACK_LIST) \
128 --stringparam package $$pack \
129 --stringparam version $$version \
130 -o track.tmp $(XSLDIR)/bump.xsl $@ && \
131 sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
132 xmllint --format --postvalid track.tmp > $@; \
133 fi; \
134 rm -f $$track; \
135 done; \
136 rm -f track.tmp
137
138$(TRACKING_DIR):
139 @echo Creating $(TRACKING_DIR)
140 $(Q)mkdir -p $@
141
142$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
143 $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
144
145ifneq ($(REV),$(REV1))
146$(BLFS_FULL): FORCE
147$(LFS_FULL): FORCE
148endif
149$(LFS_FULL): $(LFS_XML) $(LFS_XML)/general.ent $(ALLXMLLFS) $(ALLXSLLFS)
150 @echo "Processing LFS bootscripts..."
151 $(Q)cd $(LFS_XML) && bash process-scripts.sh
152 $(Q)[ -d $(LFSTMP) ] || mkdir -p $(LFSTMP)
153 @echo "Adjusting LFS for revision $(REV)..."
154 $(Q)xsltproc --nonet --xinclude \
155 --stringparam profile.revision $(REV) \
156 --output $(LFSTMP)/lfs-prof.xml \
157 $(LFS_XML)/stylesheets/lfs-xsl/profile.xsl \
158 $(LFS_XML)/index.xml
159 @echo "Validating the LFS book..."
160 $(Q)xmllint --nonet --noent --postvalid \
161 -o $@ $(LFSTMP)/lfs-prof.xml
162 $(Q)rm -f $(LFS_XML)/appendices/*.script
163 $(Q)cd $(LFS_XML) && ./aux-file-data.sh $@
164 $(Q)echo $(REV) > $(REVFILE)
165
166$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
167 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
168 @echo "Adjusting BLFS for revision $(REV)..."
169 $(Q)xsltproc --nonet --xinclude \
170 --stringparam profile.revision $(REV) \
171 --output $(RENDERTMP)/blfs-prof.xml \
172 $(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
173 $(BLFS_XML)/index.xml
174 @echo "Validating the BLFS book..."
175 $(Q)xmllint --nonet --noent --postvalid \
176 -o $@ $(RENDERTMP)/blfs-prof.xml
177 $(Q)echo $(REV) > $(REVFILE)
178
179all: update $(BOOK_XML)
180
181update: $(BLFS_XML) $(LFS_XML)
182 @echo Updating the book sources
183 $(Q)cd $(LFS_XML) && git pull
184 $(Q)cd $(BLFS_XML) && git pull
185
186$(LFS_XML):
187 @echo Getting the LFS book sources...
188 $(Q)git clone $(LFS-GIT) $@
189
190$(BLFS_XML):
191 @echo Getting the BLFS book sources...
192 $(Q)git clone $(GIT) $@
193
194# Clean up
195
196clean:
197 rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
198 rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
199
200FORCE:
201.PHONY: clean all update $(CONFIG_OUT) FORCE
Note: See TracBrowser for help on using the repository browser.