[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 |
|
---|
[84440e6] | 18 | # Makefile should reside in a directory where there are two subdirectories
|
---|
| 19 | # initially:
|
---|
| 20 | TOPDIR = $(shell pwd)
|
---|
| 21 | # the stylesheets
|
---|
| 22 | XSLDIR = $(TOPDIR)/xsl
|
---|
| 23 | # the menu program sources
|
---|
| 24 | MENU = $(TOPDIR)/menu
|
---|
| 25 |
|
---|
| 26 | # Those directories and files will be created and populated by make:
|
---|
| 27 | # directory of the book sources:
|
---|
| 28 | BLFS_XML = $(TOPDIR)/blfs-xml
|
---|
| 29 | # contains the REV used in the preceding call:
|
---|
| 30 | REVFILE = $(TOPDIR)/revision
|
---|
| 31 | # the list of packages:
|
---|
| 32 | PACK_LIST = $(TOPDIR)/packages.xml
|
---|
| 33 | # the generated menu input:
|
---|
[e576789] | 34 | CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
|
---|
[84440e6] | 35 | # menu output:
|
---|
| 36 | CONFIG_OUT = $(TOPDIR)/configuration
|
---|
| 37 | # the linear book:
|
---|
| 38 | BOOK_XML = $(TOPDIR)/book.xml
|
---|
| 39 |
|
---|
| 40 | RENDERTMP = $(BLFS_XML)/tmp
|
---|
| 41 | BLFS_FULL = $(RENDERTMP)/blfs-full.xml
|
---|
| 42 |
|
---|
| 43 | # The right-hand side is updated by jhalfs:
|
---|
| 44 | # Where the tracking file resides:
|
---|
| 45 | TRACKING_DIR = tracking-dir
|
---|
| 46 |
|
---|
| 47 | # Will be created by make, if not existent
|
---|
| 48 | TRACKFILE = $(TRACKING_DIR)/instpkg.xml
|
---|
[e576789] | 49 |
|
---|
[84440e6] | 50 | # Initial content of the tracking file
|
---|
[e576789] | 51 | define 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>
|
---|
| 58 | endef
|
---|
| 59 |
|
---|
| 60 | SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
|
---|
| 61 |
|
---|
| 62 | ALLXML := $(filter-out $(RENDERTMP)/%, \
|
---|
[84440e6] | 63 | $(shell if [ -d $(BLFS_XML) ]; then \
|
---|
| 64 | find $(BLFS_XML) -name \*.xml; \
|
---|
| 65 | fi))
|
---|
[e576789] | 66 | ALLXSL := $(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:
|
---|
| 73 | REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi)
|
---|
| 74 | ifneq ($(origin REV),command line)
|
---|
| 75 | ifdef REV1
|
---|
| 76 | REV = $(REV1)
|
---|
| 77 | else
|
---|
| 78 | REV = not defined
|
---|
| 79 | endif
|
---|
| 80 | endif
|
---|
| 81 |
|
---|
| 82 | ifneq ($(REV),sysv)
|
---|
| 83 | ifneq ($(REV),systemd)
|
---|
| 84 | $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
|
---|
| 85 | endif
|
---|
| 86 | endif
|
---|
[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) && \
|
---|
| 114 | /bin/echo -e '$(INITIAL_TRACK)' > $@ && \
|
---|
| 115 | $(MAKE) $(PACK_LIST); \
|
---|
| 116 | fi
|
---|
| 117 | $(Q)for track in $(TRACKING_DIR)/*-*; do \
|
---|
| 118 | if [ -f $$track ]; then \
|
---|
| 119 | pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
|
---|
| 120 | version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
|
---|
| 121 | xsltproc --stringparam packages $(PACK_LIST) \
|
---|
| 122 | --stringparam package $$pack \
|
---|
| 123 | --stringparam version $$version \
|
---|
| 124 | -o track.tmp $(XSLDIR)/bump.xsl $@ && \
|
---|
| 125 | sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
|
---|
| 126 | xmllint --format --postvalid track.tmp > $@; \
|
---|
| 127 | fi; \
|
---|
| 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] | 138 | ifneq ($(REV),$(REV1))
|
---|
| 139 | $(BLFS_FULL): FORCE
|
---|
| 140 | endif
|
---|
[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 |
|
---|
| 154 | all: update $(BOOK_XML)
|
---|
| 155 |
|
---|
| 156 | update: $(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 |
|
---|
| 166 | clean:
|
---|
[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] | 171 | FORCE:
|
---|
| 172 | .PHONY: clean all update $(CONFIG_OUT) FORCE
|
---|