From: Richard W.M. Jones Date: Sun, 12 Jan 2020 22:56:39 +0000 (+0000) Subject: build: Implement make dist rule. X-Git-Tag: v'0.2'~10 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=140f27408935f7b8b8a8bc2d26e9b355af4b9385;p=goals.git build: Implement make dist rule. --- diff --git a/.gitignore b/.gitignore index 02815a7..de544e8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ *.log *.o +/*.tar.gz /local* /man/*.? diff --git a/Goalfile.in b/Goalfile.in index 6601c58..4a613c4 100644 --- a/Goalfile.in +++ b/Goalfile.in @@ -172,3 +172,78 @@ goal install = { install src/goals %DESTDIR/"$bindir" -m 0755 install %stdlibfiles %DESTDIR/"$datadir"/goals -m 644 } + +#---------------------------------------------------------------------- +# Distribution. + +let sources = [ + "src/ast.ml", + "src/ast.mli", + "src/cmdline.ml", + "src/cmdline.mli", + "src/config.ml.in", + "src/config.mli", + "src/deps.ml", + "src/deps.mli", + "src/eval.ml", + "src/eval.mli", + "src/jobs.ml", + "src/jobs.mli", + "src/lexer.mli", + "src/lexer.mll", + "src/main.ml", + "src/parse.ml", + "src/parse.mli", + "src/parser.mly", + "src/run.ml", + "src/run.mli", + "src/utils-c.c", + "src/utils.ml", + "src/utils.mli", +] + +let distfiles = [ + ".gitignore", + "COPYING", + "Goalfile.in", + "Makefile.in", + "README", + "TODO", + "autogen.sh", + "config.h.in", + "configure", + "configure.ac", + wildcard ("docs/*.pod"), + "install-sh", + "m4/ocaml.m4", + "run.in", + sources, + "stamp-h.in", + wildcard ("stdlib/*.gl"), + wildcard ("stdlib/*.sh"), + wildcard ("tests/*.data"), + wildcard ("tests/*.data[0-9]"), + wildcard ("tests/*.expected"), + wildcard ("tests/*.gl"), + wildcard ("tests/*.sh"), + wildcard ("tests/10-function-wildcard.d/*"), +] + +let tarfile = "@PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz" + +goal dist = { + d="@PACKAGE_NAME@-@PACKAGE_VERSION@" + o=%tarfile + rm -rf "$d" + rm -f "$o" "$o-t" + + mkdir "$d" + for f in %distfiles; do + subdir="$(dirname "$f")" + mkdir -p "$d/$subdir" + cp -a "$f" "$d/$subdir" + done + tar zcf "$o-t" "$d" + mv "$o-t" "$o" + rm -rf "$d" +} diff --git a/Makefile.in b/Makefile.in index 7fbf0de..6ae85e8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -18,7 +18,7 @@ # Pass through normal targets to Goalfile.in -all clean depend install check maintainer-clean: src/goals +all clean depend install check maintainer-clean dist: src/goals @./run src/goals $@ # If src/goals doesn't exist then brute-force build it. Once we have