diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-10-24 01:04:22 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-10-24 01:43:50 +0100 |
commit | 5c10d34a99f5c4c1eac28aca58d5d7e414fd91f2 (patch) | |
tree | 14400356327c6b30bacc991d059cb4e90d74b5bd /Makefile | |
parent | dc204aadf2b4afa84fd002597041fc9e5b981d83 (diff) |
Build system substitutions, for absurdities
* Introduce absurddir, which is where the absurdities will go
* Substitute the absurddir into the dgit script during make all
* Install the substituted scripts rather than the originals in make install
* Provide a default in dgit, based on $0
* Clean the substitutions up in make clean
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -30,6 +30,7 @@ man1dir=$(mandir)/man1 man7dir=$(mandir)/man7 infraexamplesdir=$(prefix)/share/doc/dgit-infrastructure/examples txtdocdir=$(prefix)/share/doc/dgit +absurddir=$(prefix)/share/dgit/absurd PROGRAMS=dgit MAN1PAGES=dgit.1 @@ -46,10 +47,16 @@ INFRA_PERLMODULES= \ Debian/Dgit/Infra.pm \ Debian/Dgit/Policy/Debian.pm -all: $(MAN7PAGES) +all: $(MAN7PAGES) $(addprefix substituted/,$(PROGRAMS)) -install: installdirs $(MAN7PAGES) - $(INSTALL_PROGRAM) $(PROGRAMS) $(DESTDIR)$(bindir) +substituted/%: % + mkdir -p substituted + perl -pe 's{\bundef\b}{'\''$(absurddir)'\''} if m/###substituted###/' \ + <$< >$@ + +install: installdirs all + $(INSTALL_PROGRAM) $(addprefix substituted/,$(PROGRAMS)) \ + $(DESTDIR)$(bindir) $(INSTALL_DATA) $(MAN1PAGES) $(DESTDIR)$(man1dir) $(INSTALL_DATA) $(MAN7PAGES) $(DESTDIR)$(man7dir) $(INSTALL_DATA) $(TXTDOCS) $(DESTDIR)$(txtdocdir) @@ -60,7 +67,7 @@ install: installdirs $(MAN7PAGES) installdirs: $(INSTALL_DIR) $(DESTDIR)$(bindir) \ $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir) \ - $(DESTDIR)$(txtdocdir) \ + $(DESTDIR)$(txtdocdir) $(DESTDIR)$(absurddir) \ $(addprefix $(DESTDIR)$(perldir)/, $(dir $(PERLMODULES))) install-infra: installdirs-infra @@ -79,7 +86,7 @@ installdirs-infra: check installcheck: clean distclean mostlyclean maintainer-clean: - rm -rf tests/tmp + rm -rf tests/tmp substituted set -e; for m in $(MAN7PAGES); do \ test -e $$m.pod && rm -f $$m; \ done |