website: Makefile.am: wrap Guix commands instead of targets.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien Bourmault <neox@gnu.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2024-11-23 17:04:04 +01:00 committed by Adrien 'neox' Bourmault
parent e50f311c45
commit b9eb8071f8
Signed by: neox
GPG Key ID: 57BC26A3687116F6
1 changed files with 56 additions and 54 deletions

View File

@ -28,7 +28,7 @@ index.html: index.html.tmpl
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@" sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
if WANT_GUIX if WANT_GUIX
history/git-history.jpg: history/git-history.dot DOT_CMD = \
guix time-machine \ guix time-machine \
--commit=$(GUIX_REVISION) \ --commit=$(GUIX_REVISION) \
-- \ -- \
@ -37,12 +37,14 @@ history/git-history.jpg: history/git-history.dot
--container \ --container \
graphviz \ graphviz \
-- \ -- \
dot -T jpg history/git-history.dot > "$@" dot
else else
history/git-history.jpg: history/git-history.dot DOT_CMD = dot
dot -T jpg history/git-history.dot > "$@"
endif endif
history/git-history.jpg: history/git-history.dot
$(DOT_CMD) -T jpg history/git-history.dot > "$@"
# We need force the regeneration of the page because if only the git # We need force the regeneration of the page because if only the git
# commit changes, there is no way to know about it. In addition the # commit changes, there is no way to know about it. In addition the
# full website is regenerated each time the build target is run, so # full website is regenerated each time the build target is run, so
@ -72,7 +74,7 @@ site.cfg: site.cfg.tmpl
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@" sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
if WANT_GUIX if WANT_GUIX
build: site.cfg pages/footer.include BUILD_SH_CMD = \
guix time-machine \ guix time-machine \
--commit=c15a1cd88f80a90437f4b0159f22dfc84b9e6851 \ --commit=c15a1cd88f80a90437f4b0159f22dfc84b9e6851 \
-- shell \ -- shell \
@ -89,18 +91,16 @@ build: site.cfg pages/footer.include
pandoc \ pandoc \
sed \ sed \
-- \ -- \
./build.sh $(BUILD_OPTIONS) ./build.sh
else else
build: site.cfg pages/footer.include BUILD_SH_CMD = ./build.sh
./build.sh $(BUILD_OPTIONS)
endif endif
if WANT_GUIX build: site.cfg pages/footer.include
check: build website.tar.gz index.html history/git-history.jpg $(BUILD_SH_CMD) $(BUILD_OPTIONS)
rm -rf site/
mkdir -p site/$(WEBSITE_PREFIX)
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
if WANT_GUIX
CHECK_SH_CMD = \
guix shell \ guix shell \
--container \ --container \
--network \ --network \
@ -113,18 +113,19 @@ check: build website.tar.gz index.html history/git-history.jpg
sed \ sed \
tar \ tar \
-- \ -- \
./check.sh --website-prefix $(WEBSITE_PREFIX) \ ./check.sh
--directory site && \
./check.sh --website-prefix $(WEBSITE_PREFIX) \
--tarball website.tar.gz
else else
CHECK_SH_CMD = ./check.sh
endif
check: build website.tar.gz index.html history/git-history.jpg check: build website.tar.gz index.html history/git-history.jpg
rm -rf site/ rm -rf site/
mkdir -p site/$(WEBSITE_PREFIX) mkdir -p site/$(WEBSITE_PREFIX)
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX) tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
./check.sh --website-prefix $(WEBSITE_PREFIX) --directory site $(CHECK_SH_CMD) --website-prefix $(WEBSITE_PREFIX) \
./check.sh --website-prefix $(WEBSITE_PREFIX) --tarball website.tar.gz --directory site
endif $(CHECK_SH_CMD) --website-prefix $(WEBSITE_PREFIX) \
--tarball website.tar.gz
help: help:
@printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \ @printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \
@ -137,7 +138,7 @@ help:
"website.tar.gz # Create a tarball of the website" "website.tar.gz # Create a tarball of the website"
if WANT_GUIX if WANT_GUIX
serve: website.tar.gz SERVE_SH_CMD = \
guix shell \ guix shell \
--container \ --container \
--network \ --network \
@ -149,20 +150,21 @@ serve: website.tar.gz
sed \ sed \
tar \ tar \
-- \ -- \
./serve.sh --website-prefix $(WEBSITE_PREFIX) \ ./serve.sh
website.tar.gz $(LIGHTTPD_PORT)
else
if WANT_LIGHTTPD
serve: website.tar.gz
./serve.sh --website-prefix $(WEBSITE_PREFIX) \
website.tar.gz $(LIGHTTPD_PORT)
else else
SERVE_SH_CMD = ./serve.sh
endif
if ! WANT_LIGHTTPD
serve: serve:
@printf "%s %s\n" \ @printf "%s %s\n" \
"The $@ target is disabled." \ "The $@ target is disabled." \
"To enable it, run './configure --enable-lighttpd'." "To enable it, run './configure --enable-lighttpd'."
@false @false
endif else
serve: website.tar.gz
$(SERVE_SH_CMD) --website-prefix $(WEBSITE_PREFIX) \
website.tar.gz $(LIGHTTPD_PORT)
endif endif
RSYNC_OPTIONS := -av --progress --delete RSYNC_OPTIONS := -av --progress --delete