diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -4,6 +4,7 @@ prefix ?= /usr/local exec_prefix ?= $(prefix) bindir ?= $(exec_prefix)/bin libdir ?= $(exec_prefix)/lib +sitelib ?= $(libdir)/site_perl datarootdir ?= $(prefix)/share mandir ?= $(datarootdir)/man man1dir ?= $(mandir)/man1 @@ -11,15 +12,22 @@ man1dir ?= $(mandir)/man1 CSS ?= /usr/share/javascript/bootstrap4/css/bootstrap.css HTML_TEMPLATE ?= $(srcdir)/doc/template.html +PROGRAMS = $(addprefix $(builddir)/,interimap pullimap) HTML_FILES = $(patsubst $(srcdir)/doc/%.md,$(builddir)/doc/%.html,$(wildcard $(srcdir)/doc/*.md)) MANUAL_FILES = $(patsubst $(srcdir)/doc/%.md,$(builddir)/doc/%,$(wildcard $(srcdir)/doc/*.[1-9].md)) SERVICE_FILES = $(patsubst $(srcdir)/%.service,$(builddir)/%.service,$(wildcard $(srcdir)/*.service)) -all: manual $(SERVICE_FILES) +all: manual $(PROGRAMS) $(SERVICE_FILES) manual: $(MANUAL_FILES) html: $(HTML_FILES) +$(PROGRAMS): $(builddir)/%: $(srcdir)/% + @mkdir -vp $(dir $@) + perl -Te "print \"\$$_\\0\" foreach @INC;" | grep -Fxzq -e "$(sitelib)" && prefix="#" || prefix=""; \ + sed -r "0,/^(use\\s+\lib\\s+)([\"'])[^\"']*\\2\\s*;/ s||$$prefix\\1\"$(sitelib)\";|" <"$<" >"$@" + chmod --reference="$<" -- "$@" + # upper case the headers and remove the links $(MANUAL_FILES): $(builddir)/doc/%: $(srcdir)/doc/%.md @mkdir -vp $(dir $@) @@ -31,7 +39,7 @@ $(SERVICE_FILES): $(builddir)/%.service: $(srcdir)/%.service test: $(srcdir)/tests/certs/generate - $(srcdir)/tests/run-all + INTERIMAP_I=$(srcdir)/lib INTERIMAP_PATH=$(builddir) $(srcdir)/tests/run-all release: @if ! git -C $(srcdir) diff --quiet HEAD -- Changelog interimap pullimap lib/Net/IMAP/InterIMAP.pm; then \ @@ -70,9 +78,9 @@ INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) INSTALL_DATA ?= $(INSTALL) -m0644 -install: all - $(INSTALL_PROGRAM) -vDt $(DESTDIR)$(bindir) $(srcdir)/interimap $(srcdir)/pullimap - $(INSTALL_DATA) -vDT $(srcdir)/lib/Net/IMAP/InterIMAP.pm $(DESTDIR)$(datarootdir)/perl5/Net/IMAP/InterIMAP.pm +install: $(PROGRAMS) $(SERVICE_FILES) + $(INSTALL_PROGRAM) -vDt $(DESTDIR)$(bindir) $(builddir)/interimap $(builddir)/pullimap + $(INSTALL_DATA) -vDT $(srcdir)/lib/Net/IMAP/InterIMAP.pm $(DESTDIR)$(sitelib)/Net/IMAP/InterIMAP.pm -$(INSTALL_DATA) -vDt $(DESTDIR)$(man1dir) $(builddir)/doc/interimap.1 $(builddir)/doc/pullimap.1 $(INSTALL_DATA) -vDt $(DESTDIR)$(datarootdir)/doc/pullimap $(srcdir)/pullimap.sample $(INSTALL_DATA) -vDt $(DESTDIR)$(datarootdir)/doc/interimap $(srcdir)/interimap.sample \ @@ -82,11 +90,11 @@ install: all uninstall: rm -vf -- $(DESTDIR)$(bindir)/interimap $(DESTDIR)$(man1dir)/interimap.1 $(DESTDIR)$(libdir)/systemd/user/interimap*.service rm -vf -- $(DESTDIR)$(bindir)/pullimap $(DESTDIR)$(man1dir)/pullimap.1 $(DESTDIR)$(libdir)/systemd/user/pullimap*.service - rm -vf -- $(DESTDIR)$(datarootdir)/perl5/Net/IMAP/InterIMAP.pm + rm -vf -- $(DESTDIR)$(sitelib)/Net/IMAP/InterIMAP.pm rm -rvf -- $(DESTDIR)$(datarootdir)/doc/interimap $(DESTDIR)$(datarootdir)/doc/pullimap clean: - rm -vf -- $(MANUAL_FILES) $(HTML_FILES) $(SERVICE_FILES) + rm -vf -- $(PROGRAMS) $(MANUAL_FILES) $(HTML_FILES) $(SERVICE_FILES) -rmdir -vp --ignore-fail-on-non-empty -- $(builddir)/doc .PHONY: all manual html doc test release install uninstall clean |