aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-05-02 08:17:58 -0300
committerEuAndreh <eu@euandre.org>2025-05-02 08:17:58 -0300
commita61f94e961b7dbdb0cc363abc3e8d4312b5ca61e (patch)
tree7ea1017e11e9df9592e01dda667bd0d9b03abd5d
parentAdd mkdeps.sh and deps.mk (diff)
downloadgistatic-a61f94e961b7dbdb0cc363abc3e8d4312b5ca61e.tar.gz
gistatic-a61f94e961b7dbdb0cc363abc3e8d4312b5ca61e.tar.xz
Makefile: Clean-up old stuff
-rw-r--r--Makefile159
1 files changed, 59 insertions, 100 deletions
diff --git a/Makefile b/Makefile
index becf326..2af9251 100644
--- a/Makefile
+++ b/Makefile
@@ -1,129 +1,88 @@
.POSIX:
-PREFIX = /usr
-MANPREFIX = $(PREFIX)/share/man
DATE = 1970-01-01
VERSION = 0.1.0
NAME = gistatic
-MAILING_LIST = public-inbox
-TRANSLATIONS = pt fr eo
-CONTRIBLANGS =
+NAME_UC = $(NAME)
+LANGUAGES = en
+## Installation prefix. Defaults to "/usr".
+PREFIX = /usr
+BINDIR = $(PREFIX)/bin
+LIBDIR = $(PREFIX)/lib
+INCLUDEDIR = $(PREFIX)/include
+SRCDIR = $(PREFIX)/src/$(NAME)
+SHAREDIR = $(PREFIX)/share
+LOCALEDIR = $(SHAREDIR)/locale
+MANDIR = $(SHAREDIR)/man
+EXEC = ./
+## Where to store the installation. Empty by default.
+DESTDIR =
+LDLIBS =
+
.SUFFIXES:
-.SUFFIXES: .in
-.in:
- @sed \
- -e 's:@VERSION@:$(VERSION):g' \
- -e 's:@DATE@:$(DATE):g' \
- -e 's:@NAME@:$(NAME):g' \
- < $< > $@
- @if [ -x $< ]; then chmod +x $@; fi
-manpages.en.in = \
- doc/gistatic.en.1.in
-manpages.in = $(manpages.en.in) \
- doc/gistatic.pt.1.in \
- doc/gistatic.fr.1.in \
- doc/gistatic.eo.1.in
-manpages = $(manpages.in:.in=)
+all:
+include deps.mk
+
+sources = \
+ $(sources.sh) \
+derived-assets = \
-all: src/gistatic $(manpages)
+side-assets = \
-tests/resources/repositories/repo-1/.git \
-tests/resources/repositories/repo-2/.git:
- ln -s .gitdir $@
+## Default target. Builds all artifacts required for testing
+## and installation.
+all: $(derived-assets)
-shellcheck:
- @shellcheck src/gistatic.in
-emit-index: src/gistatic
- @rm -rf tmp/index/
- @./src/gistatic -i -o tmp/index/ ~/dev/published/git-permalink/ ../capim/ ../libedn/ ../listatic/ ../lisp-cli/
- @ln -rfs tmp/git-permalink tmp/index/git-permalink
-emit-repo: src/gistatic
- @rm -rf tmp/git-permalink/
- @time ./src/gistatic -o tmp/git-permalink/ -u FIXME-url-1 ~/dev/published/git-permalink/
+check-unit:
-run: shellcheck emit-index emit-repo
-
+check-integration:
-check: all \
- tests/resources/repositories/repo-1/.git \
- tests/resources/repositories/repo-2/.git
- sh tests/build-sample.sh
- sh tests/integration.sh
+## Run all tests. Each test suite is isolated, so that a parallel
+## build can run tests at the same time. The required artifacts
+## are created if missing.
+check: check-unit check-integration
+
+
+
+## Remove *all* derived artifacts produced during the build.
+## A dedicated test asserts that this is always true.
clean:
- rm -rf \
- public/ $(manpages) README.*.md CHANGELOG.*.md messages.mo \
- vgcore.* tmp/ src/config.h $(all-objects) $(t-objects) \
- libgistatic.a gistatic gistatic-tests src/gistatic \
- tests/resources/repositories/repo-1/.git \
- tests/resources/repositories/repo-2/.git
+ rm -rf $(derived-assets) $(side-assets)
+
+## Installs into $(DESTDIR)$(PREFIX). Its dependency target
+## ensures that all installable artifacts are crafted beforehand.
install: all
mkdir -p \
- '$(DESTDIR)$(PREFIX)/bin' \
- '$(DESTDIR)$(PREFIX)/lib' \
- '$(DESTDIR)$(PREFIX)/include'
- cp gistatic '$(DESTDIR)$(PREFIX)/bin'
- cp libgistatic.a '$(DESTDIR)$(PREFIX)/lib'
- cp src/gistatic.h '$(DESTDIR)$(PREFIX)/include'
- sh doc/manpages.sh -ip '$(DESTDIR)$(MANPREFIX)' $(manpages)
+ '$(DESTDIR)$(BINDIR)' \
+ '$(DESTDIR)$(SRCDIR)' \
+
+ cp $(sources.sh) '$(DESTDIR)$(BINDIR)'
+ cp $(sources) '$(DESTDIR)$(SRCDIR)'
+
+## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror
+## of the "install" target, and removes *all* that was installed.
+## A dedicated test asserts that this is always true.
uninstall:
- rm -f \
- '$(DESTDIR)$(PREFIX)/bin/gistatic' \
- '$(DESTDIR)$(PREFIX)/lib/libgistatic.a' \
- '$(DESTDIR)$(PREFIX)/include/gistatic.h'
- sh doc/manpages.sh -up '$(DESTDIR)$(MANPREFIX)' $(manpages)
-
-
-#
-# Personal workflow targets
-#
-
-dev-check: check public
- sh tests/dev-integration.sh
- sh aux/assert-shellcheck.sh
- sh aux/workflow/assert-todos.sh
- sh aux/workflow/assert-changelog.sh -n '$(NAME)' $(EXTRA_VERSION)
- sh aux/workflow/assert-readme.sh -n '$(NAME)' -m '$(MAILING_LIST)' \
- $(EXTRA_VERSION)
- sh aux/workflow/assert-manpages.sh -n '$(NAME)' -m '$(MAILING_LIST)' \
- -l '$(TRANSLATIONS) en' $(manpages.en.in)
- sh aux/workflow/repocheck.sh -x1 -l1 -f7
-
-dist:
- sh aux/workflow/dist.sh -d '$(DATE)' -V '$(VERSION)' \
- -n '$(NAME)' -m '$(MAILING_LIST)'
-
-README.en.md: README.md
- ln -fs $? $@
-
-CHANGELOG.en.md: CHANGELOG.md
- ln -fs $? $@
-
-l10n-gen: README.en.md CHANGELOG.en.md $(manpages.en.in)
- sh aux/workflow/l10n.sh -l '$(TRANSLATIONS)' -L '$(CONTRIBLANGS)' $?
-
-public/makefile.svg: Makefile
- mkdir -p '$(@D)'
- makefile2graph check | dot -Tsvg > $@
-
-public: l10n-gen TODOs.md $(manpages) public/makefile.svg
- sh aux/workflow/public.sh -l '$(TRANSLATIONS) $(CONTRIBLANGS) en' \
- -n '$(NAME)' -m '$(MAILING_LIST)' -o public
- sh doc/manpages.sh -Ho public $(manpages)
-
-spellcheck: public
- sh aux/workflow/assert-spelling.sh -l '$(TRANSLATIONS) en' \
- $$(find public -type f -name '*.html')
+ rm -rf \
+ '$(DESTDIR)$(SRCDIR)' \
+
+ for f in $(sources.sh); do \
+ rm -f '$(DESTDIR)$(BINDIR)'/"$${f#src/}"; \
+ done
+
+
+ALWAYS: