source: BLFS/Makefile@ f596dde

ablfs-more legacy trunk
Last change on this file since f596dde was f596dde, checked in by Pierre Labastie <pierre@…>, 6 years ago

Get rid of the GPLv2 license:

  • Replace the menu system with the Kconfiglib, which has an ISC license
  • Remove farce and any reference to it
  • Rewrite the copyright notice, add the LICENSE files
  • Adapt Config.in and a few other programs to the new menu system
  • 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)
104 $(Q)CONFIG_="" KCONFIG_CONFIG=configuration \
105 $(MENU)/menuconfig.py $(CONFIG_CONFIG_IN)
106
107$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
108 $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
109
110$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(LFS_FULL)
111 $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
112 --stringparam lfs-full $(LFS_FULL) \
113 -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
114 $(Q)xmllint --postvalid --format -o $@ $@.tmp
115 $(Q)rm $@.tmp
116
117# Beware of the echo '$(INITIAL_TRACK)' command below:
118# if shell is bash or sh linked to bash, needs echo -e
119# if shell is dash or sh linked to dash: echo is enough
120# Don't ask me why
121# So use /bin/echo (needs -e)
122$(TRACKFILE): $(TRACKING_DIR)
123 $(Q)if ! [ -f $@ ]; then \
124 echo Initializing $(TRACKFILE) && \
125 /bin/echo -e '$(INITIAL_TRACK)' > $@; \
126 fi
127 $(Q)for track in $(TRACKING_DIR)/*-*; do \
128 if [ -f $$track ]; then \
129 pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
130 version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
131 xsltproc --stringparam packages $(PACK_LIST) \
132 --stringparam package $$pack \
133 --stringparam version $$version \
134 -o track.tmp $(XSLDIR)/bump.xsl $@ && \
135 sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
136 xmllint --format --postvalid track.tmp > $@; \
137 fi; \
138 rm -f $$track; \
139 done; \
140 rm -f track.tmp
141
142$(TRACKING_DIR):
143 @echo Creating $(TRACKING_DIR)
144 $(Q)mkdir -p $@
145
146$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
147 $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
148
149ifneq ($(REV),$(REV1))
150$(BLFS_FULL): FORCE
151$(LFS_FULL): FORCE
152endif
153$(LFS_FULL): $(LFS_XML) $(LFS_XML)/general.ent $(ALLXMLLFS) $(ALLXSLLFS)
154 @echo "Processing LFS bootscripts..."
155 $(Q)cd $(LFS_XML) && bash process-scripts.sh
156 $(Q)[ -d $(LFSTMP) ] || mkdir -p $(LFSTMP)
157 @echo "Adjusting LFS for revision $(REV)..."
158 $(Q)xsltproc --nonet --xinclude \
159 --stringparam profile.revision $(REV) \
160 --output $(LFSTMP)/lfs-prof.xml \
161 $(LFS_XML)/stylesheets/lfs-xsl/profile.xsl \
162 $(LFS_XML)/index.xml
163 @echo "Validating the LFS book..."
164 $(Q)xmllint --nonet --noent --postvalid \
165 -o $@ $(LFSTMP)/lfs-prof.xml
166 $(Q)rm -f $(LFS_XML)/appendices/*.script
167 $(Q)cd $(LFS_XML) && ./aux-file-data.sh $@
168 $(Q)echo $(REV) > $(REVFILE)
169
170$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
171 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
172 @echo "Adjusting BLFS for revision $(REV)..."
173 $(Q)xsltproc --nonet --xinclude \
174 --stringparam profile.revision $(REV) \
175 --output $(RENDERTMP)/blfs-prof.xml \
176 $(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
177 $(BLFS_XML)/index.xml
178 @echo "Validating the BLFS book..."
179 $(Q)xmllint --nonet --noent --postvalid \
180 -o $@ $(RENDERTMP)/blfs-prof.xml
181 $(Q)echo $(REV) > $(REVFILE)
182
183all: update $(BOOK_XML)
184
185update: $(BLFS_XML) $(LFS_XML)
186 @echo Updating the book sources
187 $(Q)cd $(LFS_XML) && svn up
188 $(Q)cd $(BLFS_XML) && svn up
189
190$(LFS_XML):
191 @echo Getting the LFS book sources...
192 $(Q)svn co $(LFS-SVN) $@
193
194$(BLFS_XML):
195 @echo Getting the BLFS book sources...
196 $(Q)svn co $(SVN) $@
197
198# Clean up
199
200clean:
201 rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
202 rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
203
204FORCE:
205.PHONY: clean all update $(CONFIG_OUT) FORCE
Note: See TracBrowser for help on using the repository browser.