source: BLFS/Makefile@ b9c5dc9

ablfs
Last change on this file since b9c5dc9 was 52389b5, checked in by Pierre Labastie <pierre@…>, 13 years ago

Updated BLFS/Makefile so that initial generation of TRACKFILE is more robust

  • Property mode set to 100644
File size: 3.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: Makefile 36 2012-02-22 13:01:46Z labastie $
7
8ifdef V
9 Q =
10else
11 Q = @
12endif
13
14LANG=C
15LC_ALL=C
16TRACKING_DIR = tracking-dir
17TOPDIR=$(shell pwd)
18BLFS_XML = $(TOPDIR)/blfs-xml
19XSLDIR = $(TOPDIR)/xsl
20
21RENDERTMP = $(BLFS_XML)/tmp
22BLFS_FULL = $(RENDERTMP)/blfs-full.xml
23PACK_LIST = $(TOPDIR)/packages.xml
24MENU = $(TOPDIR)/menu
25CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
26CONFIG_OUT = $(TOPDIR)/configuration
27BOOK_XML = $(TOPDIR)/book.xml
28TRACKFILE = $(TRACKING_DIR)/instpkg.xml
29
30define INITIAL_TRACK
31<?xml version="1.0" encoding="ISO-8859-1"?>\n\
32\n\
33<!DOCTYPE sublist SYSTEM "$(TOPDIR)/packdesc.dtd">\n\
34<sublist>\n\
35 <name>Installed</name>\n\
36</sublist>
37endef
38
39SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
40
41ALLXML := $(filter-out $(RENDERTMP)/%, \
42 $(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml))
43ALLXSL := $(filter-out $(RENDERTMP)/%, \
44 $(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl))
45
46$(BOOK_XML): $(CONFIG_OUT)
47 $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL)
48
49$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf
50 $(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
51
52$(MENU)/mconf:
53 $(Q)$(MAKE) -C $(MENU) ncurses conf mconf
54
55$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
56 $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
57
58$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE)
59 $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
60 -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
61 $(Q)xmllint --postvalid --format -o $@ $@.tmp
62 $(Q)rm $@.tmp
63
64# Beware of the echo '$(INITIAL_TRACK)' command below:
65# if default shell is bash, needs echo -e
66# if default shell is sh : echo is enough
67# Don't ask me why
68$(TRACKFILE): $(TRACKING_DIR)
69 $(Q)if ! [ -f $@ ]; then \
70 echo Initializing $(TRACKFILE) && \
71 echo '$(INITIAL_TRACK)' > $@ && \
72 $(MAKE) $(PACK_LIST) && \
73 for track in $(TRACKING_DIR)/*-*; do \
74 if [ -f $track ]; then \
75 pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
76 xsltproc --stringparam packages $(PACK_LIST) \
77 --stringparam package $$pack \
78 -o track.tmp $(XSLDIR)/bump.xsl $@ && \
79 sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
80 xmllint --format --postvalid track.tmp > $@; \
81 fi; \
82 done; \
83 rm -f track.tmp; \
84 fi
85
86$(TRACKING_DIR):
87 @echo Creating $(TRACKING_DIR)
88 $(Q)mkdir -p $@
89
90$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
91 $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
92
93$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
94 @echo "Validating the book..."
95 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
96 $(Q)xmllint --nonet --noent --xinclude --postvalid \
97 -o $@ $(BLFS_XML)/index.xml
98
99all: update $(BOOK_XML)
100
101update: $(BLFS_XML)
102 @echo Updating the book sources
103 $(Q)cd $(BLFS_XML) && svn up
104
105$(BLFS_XML):
106 @echo Getting the book sources...
107 $(Q)svn co $(SVN) $@
108
109# Clean up
110
111clean:
112 rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
113 rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
114 - $(MAKE) -C $(MENU) clean
115
116.PHONY: clean all update $(CONFIG_OUT)
Note: See TracBrowser for help on using the repository browser.