From 65351e8c69659455096d1e37c4b78d1298fb7021 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Sat, 12 Mar 2022 18:04:10 +0100 Subject: add `dist` make target --- Makefile.in | 30 +++++++++++++++++++++++++++--- write_makefile.sh | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6400ba5..48335a9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -28,12 +28,15 @@ metafiles = build.sh configure Makefile.in compute_scripts.awk README.txt \ # The default target: placed up here default: $(default_target) +# haketilo-$(version).tar is not actually a phony target but it is too hard to +# track all the files that might require remaking it, so we instead re-run it +# every time. .PHONY: mozilla install-mozilla chromium install-chromium \ all all-unpacked default unpacked \ install install-html install-dvi install-pdf install-ps uninstall \ install-strip clean distclean mostlyclean maintainer-clean TAGS info \ dvi html pdf ps dist check installcheck installdirs \ - test-prepare test test-environment + test-prepare test test-environment haketilo-$(version).tar # core files icons/haketilo16.png: icons/haketilo.svg @@ -96,6 +99,7 @@ clean mostlyclean: rm -f mozilla-build.zip chromium-build.zip exports_init.js rm -rf pytest.ini certs injected_scripts geckodriver.log rm -rf certs/ test__pycache__/ .pytest_cache/ + rm -f *.tar *.tar.gz distclean: clean rm -f Makefile config.status record.conf @@ -103,7 +107,28 @@ distclean: clean maintainer-clean: distclean @echo 'This command is intended for maintainers to use; it' @echo 'deletes files that may need special tools to rebuild.' - rm -f "$(srcdir)"/icons/*.png + rm -f "$(srcdir)"/icons/*.png "$(srcdir)"/FILES.txt + +# To make the next rule happy in case we're building from tarball. +$(srcdir)/.git: + +$(srcdir)/FILES.txt: $(srcdir)/.git + if [ -e "$(srcdir)/.git" ]; then \ + git -C "$(srcdir)" ls-files --cached --recurse-submodules | \ + grep -v gitmodules > $@; \ + printf 'FILES.txt\n' >> $@; \ + fi + +haketilo-$(version).tar: FILES.txt + HERE="$$(pwd)"; \ + cd "$(srcdir)"; \ + tar -caf "$$HERE/$@" --transform='s_^_haketilo-$(version)/_' \ + $$(cat FILES.txt) + +haketilo-$(version).tar.gz: haketilo-$(version).tar + gzip < haketilo-$(version).tar > haketilo-$(version).tar.gz + +dist: haketilo-$(version).tar.gz # Files for constructing the makefile Makefile: config.status Makefile.in record.conf @@ -113,7 +138,6 @@ config.status: write_makefile.sh cp "$(srcdir)"/write_makefile.sh config.status # Unused GNU-specified targets -dist: install-html: install-dvi: install-pdf: diff --git a/write_makefile.sh b/write_makefile.sh index c9b107b..ab23cf2 100755 --- a/write_makefile.sh +++ b/write_makefile.sh @@ -29,7 +29,7 @@ SRCDIR="${SRCDIR#'srcdir = '}" DEFAULT_TARGET="$(grep '^default_target = ' record.conf)" DEFAULT_TARGET="${DEFAULT_TARGET#'default_target = '}" -eval VERSION=$(cat "$SRCDIR/version") +VERSION=$(cat "$SRCDIR/version" | sed 's/^"\(.*\)"$/\1/; s/-beta/b/') sed '/^# Configuration gets included here by write_makefile\.sh$/r record.conf s|<>|'"$SRCDIR"'| -- cgit v1.2.3