diff --git a/.gitignore b/.gitignore index fd5dbd464..617b82ea8 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ build-aux/ltsugar.m4 build-aux/ltversion.m4 build-aux/lt~obsolete.m4 build-aux/missing -build-aux/list-dist-files.sh +build-aux/list-distfiles.sh tests/regressions.pl # Other autojunk diff --git a/Makefile.am b/Makefile.am index 78ae8bbac..93cba93b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,14 +34,16 @@ export DISABLEDSRCS ?= $(filter $(_DISABLEDSRCS),$(_TESTSRCS)) TESTSRCS ?= $(filter-out $(DISABLEDSRCS),$(_TESTSRCS)) TESTPREVIEWS ?= $(addsuffix .pdf,$(basename $(filter-out $(_DISABLEDSRCS),$(_TESTPREVIEWS)))) -# Since we can't use $(wildcard ...) in automake file lists, we generate a file -# with a script that builds our dynamic file lists instead. This is tricky, -# because if we just include the file automake will flatten this include. By -# using $(wildcard ...) to include it (the very function we couldn't use because -# of the race condition it creates) we actually keep it from being flattened and -# hence evaluated when we want it to be. Since the file always exists (see -# BUILT_SOURCES) this doesn't induce a race. -include $(wildcard Makefile-distfiles) +# Since we can't use $(wildcard ...) while defining file lists automake, we +# generate a file with a script that builds our dynamic file lists ahead of +# time and stores them in a variable. Using an include here is tricky, because +# if we just include the file directly automake will flatten it. By using +# $(wildcard ...) to include it (the very function we couldn't use where we +# wanted to in the first place) we keep the include from being flattened and +# hence evaluated where we want it to be. Otherwise the flattening gets the +# variables set in all the wrong order. Since the file will be generated by +# a make (see BUILT_SOURCES) before make dist the source will exist in time. +include $(wildcard $(top_srcdir)/Makefile-distfiles) FIGURES = documentation/fig-input-to-output.pdf MANUAL := documentation/sile.pdf @@ -69,7 +71,7 @@ dist_doc_DATA = README.md CHANGELOG.md dist_pdf_DATA = $(_MANUAL) dist_license_DATA = LICENSE.md EXTRA_DIST = spec tests documentation sile-dev-1.rockspec fontconfig.conf -EXTRA_DIST += build-aux/action-updater.js build-aux/cargo-updater.js build-aux/config.ld build-aux/decore-automake.sh build-aux/git-version-gen build-aux/list-dist-files.sh +EXTRA_DIST += build-aux/action-updater.js build-aux/cargo-updater.js build-aux/config.ld build-aux/decore-automake.sh build-aux/git-version-gen EXTRA_DIST += Dockerfile build-aux/docker-bootstrap.sh build-aux/docker-fontconfig.conf hooks/build EXTRA_DIST += default.nix flake.nix flake.lock shell.nix build-aux/pkg.nix EXTRA_DIST += package.json # imported by both Nix and Docker @@ -106,7 +108,7 @@ export DOCKER_TAG ?= HEAD include $(top_srcdir)/aminclude.am Makefile-distfiles: $(wildcard .version .tarball-version) | $(LUAMODLOCK) - $(SHELL) build-aux/list-dist-files.sh > $@ + $(SHELL) build-aux/list-distfiles.sh > $@ if EMBEDDED_RESOURCES _EMBEDDED_SOURCES = src/embed.rs src/embed-includes.rs @@ -183,6 +185,8 @@ CLEAN ?= dist: sile-$(VERSION).pdf sile-$(VERSION).md +dist-local: $(BUILT_SOURCES) + sile-$(VERSION).pdf: $(MANUAL) $(INSTALL) $(MANUAL) $@ diff --git a/build-aux/list-dist-files.sh.in b/build-aux/list-distfiles.sh.in similarity index 97% rename from build-aux/list-dist-files.sh.in rename to build-aux/list-distfiles.sh.in index 14a7c7541..91a3758c6 100755 --- a/build-aux/list-dist-files.sh.in +++ b/build-aux/list-distfiles.sh.in @@ -8,7 +8,7 @@ alias sort="${SORT:-@SORT@}" alias xargs="${XARGS:-@XARGS@}" finder () { - test -d "$1" || return 1 + test -d "$1" || return 0 find "$@" -type f | am_list } diff --git a/configure.ac b/configure.ac index 15a8685d4..9dac41974 100644 --- a/configure.ac +++ b/configure.ac @@ -280,7 +280,7 @@ AC_SUBST([ROCKREV], [1]) QUE_SUBST_MAN_DATE -AC_CONFIG_FILES([build-aux/list-dist-files.sh], [chmod +x build-aux/list-dist-files.sh]) +AC_CONFIG_FILES([build-aux/list-distfiles.sh], [chmod +x build-aux/list-distfiles.sh]) AC_CONFIG_FILES([Makefile justenough/Makefile sile-lua.1 core/features.lua core/pathsetup.lua core/version.lua]) AC_CONFIG_FILES([sile-lua:sile.in], [chmod +x sile-lua]) AC_CONFIG_FILES([tests/regressions.pl], [chmod +x tests/regressions.pl])