source: BLFS/Makefile@ 200fbde

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

BLFS/Makefile:

  • Do not call make after inititalizing the tracking file
  • Remove the <package-version> file from tracking dir after using it
  • Fix a typo
  • Property mode set to 100644
File size: 5.0 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:
28BLFS_XML = $(TOPDIR)/blfs-xml
29# contains the REV used in the preceding call:
30REVFILE = $(TOPDIR)/revision
31# the list of packages:
32PACK_LIST = $(TOPDIR)/packages.xml
33# the generated menu input:
[e576789]34CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
[84440e6]35# menu output:
36CONFIG_OUT = $(TOPDIR)/configuration
37# the linear book:
38BOOK_XML = $(TOPDIR)/book.xml
39
40RENDERTMP = $(BLFS_XML)/tmp
41BLFS_FULL = $(RENDERTMP)/blfs-full.xml
42
43# The right-hand side is updated by jhalfs:
44# Where the tracking file resides:
45TRACKING_DIR = tracking-dir
46
47# Will be created by make, if not existent
48TRACKFILE = $(TRACKING_DIR)/instpkg.xml
[e576789]49
[84440e6]50# Initial content of the tracking file
[e576789]51define INITIAL_TRACK
52<?xml version="1.0" encoding="ISO-8859-1"?>\n\
53\n\
54<!DOCTYPE sublist SYSTEM "$(TOPDIR)/packdesc.dtd">\n\
55<sublist>\n\
56 <name>Installed</name>\n\
57</sublist>
58endef
59
60SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
61
62ALLXML := $(filter-out $(RENDERTMP)/%, \
[84440e6]63 $(shell if [ -d $(BLFS_XML) ]; then \
64 find $(BLFS_XML) -name \*.xml; \
65 fi))
[e576789]66ALLXSL := $(filter-out $(RENDERTMP)/%, \
[84440e6]67 $(shell if [ -d $(BLFS_XML) ]; then \
68 find $(BLFS_XML) -name \*.xsl; \
69 fi))
70
71# Try to set the REV variable according to previous runs, except when
72# set on the command line:
73REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi)
74ifneq ($(origin REV),command line)
75 ifdef REV1
76 REV = $(REV1)
77 else
78 REV = not defined
79 endif
80endif
81
82ifneq ($(REV),sysv)
83 ifneq ($(REV),systemd)
84 $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
85 endif
86endif
[e576789]87
88$(BOOK_XML): $(CONFIG_OUT)
89 $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL)
[f4ed135]90
[e576789]91$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf
92 $(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
[f4ed135]93
[e576789]94$(MENU)/mconf:
95 $(Q)$(MAKE) -C $(MENU) ncurses conf mconf
[f4ed135]96
[e576789]97$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
98 $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
[f4ed135]99
[e576789]100$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE)
101 $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
102 -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
103 $(Q)xmllint --postvalid --format -o $@ $@.tmp
104 $(Q)rm $@.tmp
[f4ed135]105
[e576789]106# Beware of the echo '$(INITIAL_TRACK)' command below:
107# if shell is bash or sh linked to bash, needs echo -e
108# if shell is dash or sh linked to dash: echo is enough
109# Don't ask me why
110# So use /bin/echo (needs -e)
111$(TRACKFILE): $(TRACKING_DIR)
112 $(Q)if ! [ -f $@ ]; then \
113 echo Initializing $(TRACKFILE) && \
[e415656]114 /bin/echo -e '$(INITIAL_TRACK)' > $@; \
[e576789]115 fi
116 $(Q)for track in $(TRACKING_DIR)/*-*; do \
[e415656]117 if [ -f $$track ]; then \
[e576789]118 pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
119 version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
120 xsltproc --stringparam packages $(PACK_LIST) \
121 --stringparam package $$pack \
122 --stringparam version $$version \
123 -o track.tmp $(XSLDIR)/bump.xsl $@ && \
124 sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
125 xmllint --format --postvalid track.tmp > $@; \
[e415656]126 fi; \
127 rm -f $$track; \
[e576789]128 done; \
129 rm -f track.tmp
130
131$(TRACKING_DIR):
132 @echo Creating $(TRACKING_DIR)
133 $(Q)mkdir -p $@
134
135$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
136 $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
137
[84440e6]138ifneq ($(REV),$(REV1))
139$(BLFS_FULL): FORCE
140endif
[e576789]141$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
142 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
[4f3c433]143 @echo "Adjusting for revision $(REV)..."
144 $(Q)xsltproc --nonet --xinclude \
145 --stringparam profile.revision $(REV) \
146 --output $(RENDERTMP)/blfs-prof.xml \
147 $(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
148 $(BLFS_XML)/index.xml
149 @echo "Validating the book..."
150 $(Q)xmllint --nonet --noent --postvalid \
151 -o $@ $(RENDERTMP)/blfs-prof.xml
[84440e6]152 $(Q)echo $(REV) > $(REVFILE)
[e576789]153
154all: update $(BOOK_XML)
155
156update: $(BLFS_XML)
157 @echo Updating the book sources
158 $(Q)cd $(BLFS_XML) && svn up
159
160$(BLFS_XML):
161 @echo Getting the book sources...
162 $(Q)svn co $(SVN) $@
[f4ed135]163
164# Clean up
165
166clean:
[e576789]167 rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
168 rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
169 - $(MAKE) -C $(MENU) clean
[f4ed135]170
[84440e6]171FORCE:
172.PHONY: clean all update $(CONFIG_OUT) FORCE
Note: See TracBrowser for help on using the repository browser.