[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>
|
---|
[63fc514] | 4 | # Pierre Labastie <pierre.labastie at neuf.fr>
|
---|
[f4ed135] | 5 |
|
---|
[63fc514] | 6 | # $Id: Makefile 36 2012-02-22 13:01:46Z labastie $
|
---|
| 7 |
|
---|
| 8 | ifdef V
|
---|
| 9 | Q =
|
---|
| 10 | else
|
---|
| 11 | Q = @
|
---|
| 12 | endif
|
---|
[f4ed135] | 13 |
|
---|
[5573313] | 14 | # Known behavior
|
---|
[63a051c] | 15 | LANG=C
|
---|
| 16 | LC_ALL=C
|
---|
[5573313] | 17 |
|
---|
| 18 | # The right-hand side is updated by jhalfs
|
---|
[63fc514] | 19 | TRACKING_DIR = tracking-dir
|
---|
[f4ed135] | 20 | TOPDIR=$(shell pwd)
|
---|
[63fc514] | 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
|
---|
[52389b5] | 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\
|
---|
[63fc514] | 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)
|
---|
| 51 |
|
---|
| 52 | $(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf
|
---|
| 53 | $(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
|
---|
[f4ed135] | 54 |
|
---|
[63fc514] | 55 | $(MENU)/mconf:
|
---|
| 56 | $(Q)$(MAKE) -C $(MENU) ncurses conf mconf
|
---|
[f4ed135] | 57 |
|
---|
[63fc514] | 58 | $(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
|
---|
| 59 | $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
|
---|
[f4ed135] | 60 |
|
---|
[63fc514] | 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 |
|
---|
[52389b5] | 67 | # Beware of the echo '$(INITIAL_TRACK)' command below:
|
---|
[5573313] | 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
|
---|
[52389b5] | 70 | # Don't ask me why
|
---|
[5573313] | 71 | # So use /bin/echo (needs -e)
|
---|
[63fc514] | 72 | $(TRACKFILE): $(TRACKING_DIR)
|
---|
| 73 | $(Q)if ! [ -f $@ ]; then \
|
---|
| 74 | echo Initializing $(TRACKFILE) && \
|
---|
[5573313] | 75 | /bin/echo -e echo '$(INITIAL_TRACK)' > $@ && \
|
---|
[34986b8] | 76 | $(MAKE) $(PACK_LIST); \
|
---|
| 77 | fi
|
---|
| 78 | @for track in $(TRACKING_DIR)/*-*; do \
|
---|
| 79 | if [ -f $$track ]; then \
|
---|
[63fc514] | 80 | pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
|
---|
[34986b8] | 81 | version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
|
---|
[63fc514] | 82 | xsltproc --stringparam packages $(PACK_LIST) \
|
---|
| 83 | --stringparam package $$pack \
|
---|
[34986b8] | 84 | --stringparam version $$version \
|
---|
[63fc514] | 85 | -o track.tmp $(XSLDIR)/bump.xsl $@ && \
|
---|
| 86 | sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
|
---|
| 87 | xmllint --format --postvalid track.tmp > $@; \
|
---|
[52389b5] | 88 | fi; \
|
---|
[63fc514] | 89 | done; \
|
---|
[34986b8] | 90 | rm -f track.tmp
|
---|
[f4ed135] | 91 |
|
---|
[63fc514] | 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:
|
---|
[63fc514] | 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 |
|
---|
[63fc514] | 122 | .PHONY: clean all update $(CONFIG_OUT)
|
---|