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