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