2006-08-24 22:38:22 +02:00
|
|
|
# From the Build Scripts Written By: Jim Gifford <lfs@jg555.com>
|
2017-08-09 15:25:26 +02:00
|
|
|
# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org>
|
2006-08-24 22:38:22 +02:00
|
|
|
# Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
|
2013-10-29 16:42:03 +01:00
|
|
|
# Pierre Labastie <pierre.labastie at neuf.fr>
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2013-10-29 17:26:57 +01:00
|
|
|
# $Id$
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
ifdef V
|
|
|
|
Q =
|
|
|
|
else
|
|
|
|
Q = @
|
|
|
|
endif
|
|
|
|
|
2017-03-02 17:38:25 +01:00
|
|
|
# Makefile should reside in a directory where there are two subdirectories
|
|
|
|
# initially:
|
|
|
|
TOPDIR = $(shell pwd)
|
|
|
|
# the stylesheets
|
|
|
|
XSLDIR = $(TOPDIR)/xsl
|
|
|
|
# the menu program sources
|
|
|
|
MENU = $(TOPDIR)/menu
|
|
|
|
|
|
|
|
# Those directories and files will be created and populated by make:
|
|
|
|
# directory of the book sources:
|
2017-08-09 15:55:55 +02:00
|
|
|
LFS_XML = $(TOPDIR)/lfs-xml
|
2017-03-02 17:38:25 +01:00
|
|
|
BLFS_XML = $(TOPDIR)/blfs-xml
|
|
|
|
# contains the REV used in the preceding call:
|
|
|
|
REVFILE = $(TOPDIR)/revision
|
|
|
|
# the list of packages:
|
|
|
|
PACK_LIST = $(TOPDIR)/packages.xml
|
|
|
|
# the generated menu input:
|
2013-10-29 16:42:03 +01:00
|
|
|
CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
|
2017-03-02 17:38:25 +01:00
|
|
|
# menu output:
|
|
|
|
CONFIG_OUT = $(TOPDIR)/configuration
|
|
|
|
# the linear book:
|
|
|
|
BOOK_XML = $(TOPDIR)/book.xml
|
|
|
|
|
2017-08-09 15:55:55 +02:00
|
|
|
LFSTMP = $(LFS_XML)/tmp
|
2017-03-02 17:38:25 +01:00
|
|
|
RENDERTMP = $(BLFS_XML)/tmp
|
2017-08-09 15:55:55 +02:00
|
|
|
LFS_FULL = $(LFSTMP)/lfs-full.xml
|
2017-03-02 17:38:25 +01:00
|
|
|
BLFS_FULL = $(RENDERTMP)/blfs-full.xml
|
|
|
|
|
|
|
|
# The right-hand side is updated by jhalfs:
|
|
|
|
# Where the tracking file resides:
|
|
|
|
TRACKING_DIR = tracking-dir
|
|
|
|
|
|
|
|
# Will be created by make, if not existent
|
|
|
|
TRACKFILE = $(TRACKING_DIR)/instpkg.xml
|
2013-10-29 16:42:03 +01:00
|
|
|
|
2017-03-02 17:38:25 +01:00
|
|
|
# Initial content of the tracking file
|
2013-10-29 16:42:03 +01:00
|
|
|
define INITIAL_TRACK
|
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>\n\
|
|
|
|
\n\
|
|
|
|
<!DOCTYPE sublist SYSTEM "$(TOPDIR)/packdesc.dtd">\n\
|
|
|
|
<sublist>\n\
|
|
|
|
<name>Installed</name>\n\
|
|
|
|
</sublist>
|
|
|
|
endef
|
|
|
|
|
2021-05-01 09:22:06 +02:00
|
|
|
# Git locations and branches
|
2021-04-28 17:08:30 +02:00
|
|
|
LFS-GIT = git://git.linuxfromscratch.org/lfs.git
|
2021-05-01 09:22:06 +02:00
|
|
|
LFS-BRANCH = trunk
|
2021-04-28 17:08:30 +02:00
|
|
|
GIT = git://git.linuxfromscratch.org/blfs.git
|
2021-05-01 09:22:06 +02:00
|
|
|
BLFS-BRANCH = trunk
|
2013-10-29 16:42:03 +01:00
|
|
|
|
|
|
|
ALLXML := $(filter-out $(RENDERTMP)/%, \
|
2017-03-02 17:38:25 +01:00
|
|
|
$(shell if [ -d $(BLFS_XML) ]; then \
|
|
|
|
find $(BLFS_XML) -name \*.xml; \
|
|
|
|
fi))
|
2017-08-09 15:55:55 +02:00
|
|
|
ALLXMLLFS:= $(filter-out $(LFSTMP)/%, \
|
|
|
|
$(shell if [ -d $(LFS_XML) ]; then \
|
|
|
|
find $(LFS_XML) -name \*.xml; \
|
|
|
|
fi))
|
2013-10-29 16:42:03 +01:00
|
|
|
ALLXSL := $(filter-out $(RENDERTMP)/%, \
|
2017-03-02 17:38:25 +01:00
|
|
|
$(shell if [ -d $(BLFS_XML) ]; then \
|
|
|
|
find $(BLFS_XML) -name \*.xsl; \
|
|
|
|
fi))
|
2017-08-09 15:55:55 +02:00
|
|
|
ALLXSLLFS := $(filter-out $(LFSTMP)/%, \
|
|
|
|
$(shell if [ -d $(LFS_XML) ]; then \
|
|
|
|
find $(LFS_XML) -name \*.xsl; \
|
|
|
|
fi))
|
2017-03-02 17:38:25 +01:00
|
|
|
|
|
|
|
# Try to set the REV variable according to previous runs, except when
|
|
|
|
# set on the command line:
|
|
|
|
REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi)
|
|
|
|
ifneq ($(origin REV),command line)
|
|
|
|
ifdef REV1
|
|
|
|
REV = $(REV1)
|
|
|
|
else
|
|
|
|
REV = not defined
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(REV),sysv)
|
|
|
|
ifneq ($(REV),systemd)
|
|
|
|
$(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
|
|
|
|
endif
|
|
|
|
endif
|
2013-10-29 16:42:03 +01:00
|
|
|
|
|
|
|
$(BOOK_XML): $(CONFIG_OUT)
|
2017-08-09 16:18:03 +02:00
|
|
|
$(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL) $(LFS_FULL)
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2019-04-24 18:16:20 +02:00
|
|
|
$(CONFIG_OUT): $(CONFIG_CONFIG_IN)
|
|
|
|
$(Q)CONFIG_="" KCONFIG_CONFIG=configuration \
|
2019-06-15 22:16:35 +02:00
|
|
|
python3 $(MENU)/menuconfig.py $(CONFIG_CONFIG_IN)
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
|
|
|
|
$(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2017-08-09 15:55:55 +02:00
|
|
|
$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) $(LFS_FULL)
|
2013-10-29 16:42:03 +01:00
|
|
|
$(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
|
2017-08-09 15:55:55 +02:00
|
|
|
--stringparam lfs-full $(LFS_FULL) \
|
2013-10-29 16:42:03 +01:00
|
|
|
-o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
|
|
|
|
$(Q)xmllint --postvalid --format -o $@ $@.tmp
|
|
|
|
$(Q)rm $@.tmp
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
# Beware of the echo '$(INITIAL_TRACK)' command below:
|
|
|
|
# if shell is bash or sh linked to bash, needs echo -e
|
|
|
|
# if shell is dash or sh linked to dash: echo is enough
|
|
|
|
# Don't ask me why
|
|
|
|
# So use /bin/echo (needs -e)
|
|
|
|
$(TRACKFILE): $(TRACKING_DIR)
|
|
|
|
$(Q)if ! [ -f $@ ]; then \
|
|
|
|
echo Initializing $(TRACKFILE) && \
|
2017-08-09 15:25:26 +02:00
|
|
|
/bin/echo -e '$(INITIAL_TRACK)' > $@; \
|
2013-10-29 16:42:03 +01:00
|
|
|
fi
|
|
|
|
$(Q)for track in $(TRACKING_DIR)/*-*; do \
|
2017-08-09 15:25:26 +02:00
|
|
|
if [ -f $$track ]; then \
|
2013-10-29 16:42:03 +01:00
|
|
|
pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
|
|
|
|
version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
|
|
|
|
xsltproc --stringparam packages $(PACK_LIST) \
|
|
|
|
--stringparam package $$pack \
|
|
|
|
--stringparam version $$version \
|
|
|
|
-o track.tmp $(XSLDIR)/bump.xsl $@ && \
|
|
|
|
sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
|
|
|
|
xmllint --format --postvalid track.tmp > $@; \
|
2017-08-09 15:25:26 +02:00
|
|
|
fi; \
|
|
|
|
rm -f $$track; \
|
2013-10-29 16:42:03 +01:00
|
|
|
done; \
|
|
|
|
rm -f track.tmp
|
|
|
|
|
|
|
|
$(TRACKING_DIR):
|
|
|
|
@echo Creating $(TRACKING_DIR)
|
|
|
|
$(Q)mkdir -p $@
|
|
|
|
|
|
|
|
$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
|
|
|
|
$(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
|
|
|
|
|
2017-03-02 17:38:25 +01:00
|
|
|
ifneq ($(REV),$(REV1))
|
|
|
|
$(BLFS_FULL): FORCE
|
2017-08-09 15:55:55 +02:00
|
|
|
$(LFS_FULL): FORCE
|
2017-03-02 17:38:25 +01:00
|
|
|
endif
|
2021-05-01 13:51:19 +02:00
|
|
|
$(LFS_FULL): $(LFS_XML) $(LFS_XML)/general.ent $(ALLXMLLFS) $(ALLXSLLFS) lfs-version
|
2017-08-09 15:55:55 +02:00
|
|
|
@echo "Processing LFS bootscripts..."
|
|
|
|
$(Q)cd $(LFS_XML) && bash process-scripts.sh
|
|
|
|
$(Q)[ -d $(LFSTMP) ] || mkdir -p $(LFSTMP)
|
|
|
|
@echo "Adjusting LFS for revision $(REV)..."
|
|
|
|
$(Q)xsltproc --nonet --xinclude \
|
|
|
|
--stringparam profile.revision $(REV) \
|
|
|
|
--output $(LFSTMP)/lfs-prof.xml \
|
|
|
|
$(LFS_XML)/stylesheets/lfs-xsl/profile.xsl \
|
|
|
|
$(LFS_XML)/index.xml
|
|
|
|
@echo "Validating the LFS book..."
|
|
|
|
$(Q)xmllint --nonet --noent --postvalid \
|
|
|
|
-o $@ $(LFSTMP)/lfs-prof.xml
|
|
|
|
$(Q)rm -f $(LFS_XML)/appendices/*.script
|
|
|
|
$(Q)cd $(LFS_XML) && ./aux-file-data.sh $@
|
|
|
|
$(Q)echo $(REV) > $(REVFILE)
|
|
|
|
|
2021-05-01 13:51:19 +02:00
|
|
|
$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL) version
|
2013-10-29 16:42:03 +01:00
|
|
|
$(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
|
2017-08-09 15:55:55 +02:00
|
|
|
@echo "Adjusting BLFS for revision $(REV)..."
|
2016-06-13 18:51:45 +02:00
|
|
|
$(Q)xsltproc --nonet --xinclude \
|
|
|
|
--stringparam profile.revision $(REV) \
|
|
|
|
--output $(RENDERTMP)/blfs-prof.xml \
|
|
|
|
$(BLFS_XML)/stylesheets/lfs-xsl/profile.xsl \
|
|
|
|
$(BLFS_XML)/index.xml
|
2017-08-09 15:55:55 +02:00
|
|
|
@echo "Validating the BLFS book..."
|
2016-06-13 18:51:45 +02:00
|
|
|
$(Q)xmllint --nonet --noent --postvalid \
|
|
|
|
-o $@ $(RENDERTMP)/blfs-prof.xml
|
2017-03-02 17:38:25 +01:00
|
|
|
$(Q)echo $(REV) > $(REVFILE)
|
2013-10-29 16:42:03 +01:00
|
|
|
|
|
|
|
all: update $(BOOK_XML)
|
|
|
|
|
2021-05-01 09:22:06 +02:00
|
|
|
# If in detached head state, "git pull" returns an error, so switch back to
|
|
|
|
# trunk before updating, and switch back to the branch/tag afterwards
|
2017-08-09 15:55:55 +02:00
|
|
|
update: $(BLFS_XML) $(LFS_XML)
|
2013-10-29 16:42:03 +01:00
|
|
|
@echo Updating the book sources
|
2021-05-01 09:22:06 +02:00
|
|
|
$(Q)cd $(LFS_XML) && \
|
|
|
|
if [ $(LFS-BRANCH) != trunk ]; then git switch -; fi && \
|
|
|
|
git pull && \
|
|
|
|
git checkout $(LFS-BRANCH)
|
|
|
|
$(Q)cd $(BLFS_XML) && \
|
|
|
|
if [ $(BLFS-BRANCH) != trunk ]; then git switch -; fi && \
|
|
|
|
git pull && \
|
|
|
|
git checkout $(BLFS-BRANCH)
|
2013-10-29 16:42:03 +01:00
|
|
|
|
2017-08-09 15:55:55 +02:00
|
|
|
$(LFS_XML):
|
|
|
|
@echo Getting the LFS book sources...
|
2021-04-28 17:08:30 +02:00
|
|
|
$(Q)git clone $(LFS-GIT) $@
|
2021-05-01 09:22:06 +02:00
|
|
|
if [ $(LFS-BRANCH) != trunk ]; then \
|
|
|
|
cd $@ && \
|
|
|
|
git checkout $(LFS-BRANCH); \
|
|
|
|
fi
|
2017-08-09 15:55:55 +02:00
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
$(BLFS_XML):
|
2017-08-09 15:55:55 +02:00
|
|
|
@echo Getting the BLFS book sources...
|
2021-04-28 17:08:30 +02:00
|
|
|
$(Q)git clone $(GIT) $@
|
2021-05-01 17:29:31 +02:00
|
|
|
$(Q)if [ $(BLFS-BRANCH) != trunk ]; then \
|
2021-05-01 09:22:06 +02:00
|
|
|
cd $@ && \
|
|
|
|
git checkout $(BLFS-BRANCH); \
|
|
|
|
fi
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2021-05-01 13:51:19 +02:00
|
|
|
# Generate BLFS version from git:
|
|
|
|
version:
|
2021-05-01 17:28:28 +02:00
|
|
|
$(Q)cd $(BLFS_XML) && if [ -x git-version.sh ] ; then \
|
|
|
|
./git-version.sh; \
|
|
|
|
fi
|
2021-05-01 13:51:19 +02:00
|
|
|
|
|
|
|
lfs-version:
|
2021-05-01 17:28:28 +02:00
|
|
|
$(Q)cd $(LFS_XML) && if [ -x git-version.sh ] ; then \
|
|
|
|
./git-version.sh; \
|
|
|
|
fi
|
2021-05-01 13:51:19 +02:00
|
|
|
|
2006-08-24 22:38:22 +02:00
|
|
|
# Clean up
|
|
|
|
|
|
|
|
clean:
|
2013-10-29 16:42:03 +01:00
|
|
|
rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
|
|
|
|
rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
|
2006-08-24 22:38:22 +02:00
|
|
|
|
2017-03-02 17:38:25 +01:00
|
|
|
FORCE:
|
2021-05-01 13:51:19 +02:00
|
|
|
.PHONY: clean all update $(CONFIG_OUT) version FORCE
|