diff options
Diffstat (limited to 'GNUmakefile')
-rw-r--r-- | GNUmakefile | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..27707ac --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,95 @@ +# usage: +# +# 1. make PREFIX=prefix [MAILMANSRC=mdir] install +# Installs everything. +# +# 2. make PREFIX=prefix [MAILMANSRC=mdir] install-cgi +# Builds (if necessary) and installs the listarchive cgi. +# MAILMANSRC must be set for building the program. +# Installation directory is $(PREFIX)/cgi-bin. Set CGIDIR +# to override. +# +# 3. make PREFIX=prefix install-Mailman +# Installs scripts in the Mailman subdirectory. +# Installation directory is $(PREFIX)/Mailman. Set MAILMANDIR +# to override. +# +# 4. make PREFIX=prefix install-templates +# Installs templates to $(PREFIX)/templates. Set TEMPLATESDIR +# to override. +# +# 5. make PREFIX=prefix install-bin +# Installs binary scripts to $(PREFIX)/bin. Set BINDIR to +# override. +# +# 6. make PREFIX=prefix install-man +# Installs manpages to $(PREFIX)/man. Set MANDIR to override. +# +# 7. make PREFIX=prefix install-htdocs +# Installs static HTML files to $(PREFIX)/htdocs. Set HTDOCSDIR +# to override. +# +# 8. make MAILMANSRC=mdir listarchive +# Builds the listarchive cgi. +# +# 9. make clean +# Remove created files. +# +# 10. make help +# Shows this help list. +# +# usage ends + +help: + @sed -n \ + -e '/# usage ends/,$$d' \ + -e 's/^# //' \ + -e ta \ + -e 's/^#$$//' \ + -e ta \ + -e d \ + -e :a \ + -e '/^usage:/,$$p' $(firstword $(MAKEFILE_LIST)) + +listarchive: + @if [ -z "$(MAILMANSRC)" ]; then \ + echo >&2 "Please set MAILMANSRC to point to the mailman-2.x tree"; \ + false; \ + else \ + make -C $(MAILMANSRC)/src CGI_PROGS=`pwd`/listarchive `pwd`/listarchive; \ + fi + +define geninstall +install-$(1):; + install -d $$(DESTDIR)$$($(shell echo $(1) | tr '[:lower:]' '[:upper:]')DIR) + tar -C $(1) -cf - . | tar -C $$(DESTDIR)$$($(shell echo $(1) | tr '[:lower:]' '[:upper:]')DIR) -xpf - +endef + +ifndef PREFIX + $(if $(subst help,,$(MAKECMDGOALS)),$(error Please supply PREFIX)) +endif + +MAILMANDIR = $(PREFIX)/Mailman +BINDIR = $(PREFIX)/bin +HTDOCSDIR = $(PREFIX)/htdocs +TEMPLATESDIR = $(PREFIX)/templates +MANDIR = $(PREFIX)/man +CGIDIR = $(PREFIX)/cgi-bin + +TARGETS=\ + Mailman\ + templates\ + bin\ + man\ + htdocs + +$(foreach tgt,$(TARGETS),$(eval $(call geninstall,$(tgt)))) + +install-cgi: listarchive + install -d $(DESTDIR)$(CGIDIR) + install -o root -g mailman -m 2755 listarchive $(DESTDIR)$(CGIDIR) + +install: install-cgi $(foreach tgt,$(TARGETS), install-$(tgt)) + +clean: + rm listarchive |