aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-07-04 18:29:00 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2019-07-04 18:29:53 +0300
commit41e14829aa6ff0a777cfa832244a57e6602451a6 (patch)
tree68ac6eab21535addae52ddd0efe6c8a6541c7e7c
parent38e33514347a440994d63acea38dbd3768181819 (diff)
downloadmailman-41e14829aa6ff0a777cfa832244a57e6602451a6.tar.gz
mailman-41e14829aa6ff0a777cfa832244a57e6602451a6.tar.bz2
Revamp GNUmakefile
-rw-r--r--.gitignore1
-rw-r--r--GNUmakefile124
2 files changed, 85 insertions, 40 deletions
diff --git a/.gitignore b/.gitignore
index 5c342e1..c647e54 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
1*~ 1*~
2\#* 2\#*
3.emacs* 3.emacs*
4.config
4listarchive 5listarchive
5*.tar 6*.tar
6*.tar.gz 7*.tar.gz
diff --git a/GNUmakefile b/GNUmakefile
index 27707ac..73e92b1 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,45 +1,59 @@
1# usage: 1# usage:
2# 2#
3# 1. make PREFIX=prefix [MAILMANSRC=mdir] install 3# 1. make config PREFIX=dir [MAILMANSRC=dir] [NAME=VAL]...
4# Configure the system. PREFIX is installation prefix. MAILMANSRC is
5# the name of the Mailman source tree directory (must be writable).
6# Other meaningful variables are:
7#
8# MAILMANDIR - Top installation directory for mailman script.
9# Default: $(PREFIX)/Mailman
10# BINDIR - Installation directory for executable scripts.
11# Default: $(PREFIX)/bin
12# HTDOCSDIR - Installation directory for static HTML pages.
13# Default: $(PREFIX)/htdocs
14# TEMPLATESDIR - Top installation directory for templates.
15# Default: $(PREFIX)/templates
16# MANDIR - Top installation directory for manual pages.
17# Default: $(PREFIX)/man
18# CGIDIR - Installation directory for listarchive CGI
19# Default: $(PREFIX)/cgi-bin
20#
21# If all these variables are supplied, PREFIX can be omitted.
22#
23# 2. make install
4# Installs everything. 24# Installs everything.
5# 25# Following targets can be used instead of install:
6# 2. make PREFIX=prefix [MAILMANSRC=mdir] install-cgi 26#
7# Builds (if necessary) and installs the listarchive cgi. 27# install-cgi - Builds (if necessary) and installs the listarchive
8# MAILMANSRC must be set for building the program. 28# cgi.
9# Installation directory is $(PREFIX)/cgi-bin. Set CGIDIR 29# install-Mailman - Installs scripts in the Mailman subdirectory.
10# to override. 30# install-templates - Installs templates.
11# 31# install-bin - Installs scripts,
12# 3. make PREFIX=prefix install-Mailman 32# install-man - Installs manpages.
13# Installs scripts in the Mailman subdirectory. 33# install-htdocs - Installs static HTML files.
14# Installation directory is $(PREFIX)/Mailman. Set MAILMANDIR
15# to override.
16#
17# 4. make PREFIX=prefix install-templates
18# Installs templates to $(PREFIX)/templates. Set TEMPLATESDIR
19# to override.
20#
21# 5. make PREFIX=prefix install-bin
22# Installs binary scripts to $(PREFIX)/bin. Set BINDIR to
23# override.
24#
25# 6. make PREFIX=prefix install-man
26# Installs manpages to $(PREFIX)/man. Set MANDIR to override.
27#
28# 7. make PREFIX=prefix install-htdocs
29# Installs static HTML files to $(PREFIX)/htdocs. Set HTDOCSDIR
30# to override.
31# 34#
32# 8. make MAILMANSRC=mdir listarchive 35# 3. make listarchive
33# Builds the listarchive cgi. 36# Builds the listarchive cgi in $(MAILMANSRC)/src.
34# 37#
35# 9. make clean 38# 4. make clean
36# Remove created files. 39# Remove created files.
37# 40#
38# 10. make help 41# 5. make distclean
42# Remove all created files and configuration cache.
43#
44# 6. make help
39# Shows this help list. 45# Shows this help list.
40# 46#
41# usage ends 47# usage ends
42 48
49ifneq (,$(wildcard .config))
50 include .config
51else ifeq (,$(MAKECMDGOALS))
52 # Nothing
53else ifeq (,$(findstring $(MAKECMDGOALS),help config))
54 $(error Please run make config first)
55endif
56
43help: 57help:
44 @sed -n \ 58 @sed -n \
45 -e '/# usage ends/,$$d' \ 59 -e '/# usage ends/,$$d' \
@@ -51,12 +65,43 @@ help:
51 -e :a \ 65 -e :a \
52 -e '/^usage:/,$$p' $(firstword $(MAKEFILE_LIST)) 66 -e '/^usage:/,$$p' $(firstword $(MAKEFILE_LIST))
53 67
68DEFSRC = $(firstword $(wildcard /usr/src/mailman-[0-9][0-9.]*))
69
70config:
71 @(for var in PREFIX MAILMANDIR BINDIR HTDOCSDIR \
72 TEMPLATESDIR MANDIR CGIDIR; \
73 do \
74 eval x=\$${$$var}; \
75 if [ -n "$$x" ]; then \
76 echo "$$var=$$x"; \
77 fi; \
78 done; \
79 if [ -n "$$MAILMANSRC" ]; then \
80 echo "MAILMANSRC=$$MAILMANSRC"; \
81 elif [ -n "$(DEFSRC)" ]; then \
82 echo >&2 "assuming MAILMANSRC=$(DEFSRC)"; \
83 echo "MAILMANSRC=$(DEFSRC)"; \
84 else \
85 echo >&2 "Please set MAILMANSRC to point to the mailman-2.x tree"; \
86 exit 1; \
87 fi) > .config.tmp
88 @if ! grep -q ^PREFIX .config.tmp && \
89 test "$$(sed -r -n -e 's/^(MAILMANDIR|BINDIR|HTDOCSDIR|TEMPLATESDIR|MANDIR|CGIDIR)=.*/x/p' .config.tmp | tr -d '\n')" != xxxxxx; then \
90 echo >&2 "PREFIX must be supplied"; \
91 rm .config.tmp; \
92 exit 1; \
93 fi
94 @mv .config.tmp .config
95
54listarchive: 96listarchive:
55 @if [ -z "$(MAILMANSRC)" ]; then \ 97 @if [ -z "$(MAILMANSRC)" ]; then \
56 echo >&2 "Please set MAILMANSRC to point to the mailman-2.x tree"; \ 98 echo >&2 "Please set MAILMANSRC to point to the mailman-2.x tree"; \
57 false; \ 99 exit 1; \
100 elif ! test -w $(MAILMANSRC)/src; then \
101 echo >&2 "$(MAILMANSRC)/src must be writable"; \
102 exit 1; \
58 else \ 103 else \
59 make -C $(MAILMANSRC)/src CGI_PROGS=`pwd`/listarchive `pwd`/listarchive; \ 104 make -C $(MAILMANSRC)/src CGI_PROGS=listarchive listarchive; \
60 fi 105 fi
61 106
62define geninstall 107define geninstall
@@ -65,10 +110,6 @@ install-$(1):;
65 tar -C $(1) -cf - . | tar -C $$(DESTDIR)$$($(shell echo $(1) | tr '[:lower:]' '[:upper:]')DIR) -xpf - 110 tar -C $(1) -cf - . | tar -C $$(DESTDIR)$$($(shell echo $(1) | tr '[:lower:]' '[:upper:]')DIR) -xpf -
66endef 111endef
67 112
68ifndef PREFIX
69 $(if $(subst help,,$(MAKECMDGOALS)),$(error Please supply PREFIX))
70endif
71
72MAILMANDIR = $(PREFIX)/Mailman 113MAILMANDIR = $(PREFIX)/Mailman
73BINDIR = $(PREFIX)/bin 114BINDIR = $(PREFIX)/bin
74HTDOCSDIR = $(PREFIX)/htdocs 115HTDOCSDIR = $(PREFIX)/htdocs
@@ -87,9 +128,12 @@ $(foreach tgt,$(TARGETS),$(eval $(call geninstall,$(tgt))))
87 128
88install-cgi: listarchive 129install-cgi: listarchive
89 install -d $(DESTDIR)$(CGIDIR) 130 install -d $(DESTDIR)$(CGIDIR)
90 install -o root -g mailman -m 2755 listarchive $(DESTDIR)$(CGIDIR) 131 install -o root -g mailman -m 2755 $(MAILMANSRC)/src/listarchive $(DESTDIR)$(CGIDIR)
91 132
92install: install-cgi $(foreach tgt,$(TARGETS), install-$(tgt)) 133install: install-cgi $(foreach tgt,$(TARGETS), install-$(tgt))
93 134
94clean: 135clean:
95 rm listarchive 136 @rm -f $(MAILMANSRC)/src/listarchive
137
138distclean: clean
139 @rm -f .config

Return to:

Send suggestions and report system problems to the System administrator.