xref: /netbsd-src/external/ibm-public/postfix/dist/Makefile.in (revision 059c16a85b0b39d60ad6d18f53c09510815afa2b)
1# To test with valgrind:
2# make -i tests NORANDOMIZE="" VALGRIND="valgrind --tool=memcheck --log-file=/some/where.%p"
3SHELL	= /bin/sh
4WARN    = -Wmissing-prototypes -Wformat -Wno-comment -fno-common
5OPTS	= 'WARN=$(WARN)'
6DIRS	= src/util src/global src/dns src/tls src/xsasl src/master src/milter \
7	src/postfix src/fsstone src/smtpstone \
8	src/sendmail src/error src/pickup src/cleanup src/smtpd src/local \
9	src/trivial-rewrite src/qmgr src/oqmgr src/smtp src/bounce \
10	src/pipe src/showq src/postalias src/postcat src/postconf src/postdrop \
11	src/postkick src/postlock src/postlog src/postmap src/postqueue \
12	src/postsuper src/qmqpd src/spawn src/flush src/verify \
13	src/virtual src/proxymap src/anvil src/scache src/discard src/tlsmgr \
14	src/postmulti src/postscreen src/dnsblog src/tlsproxy \
15	src/posttls-finger src/postlogd
16MANDIRS	= proto man html
17LIBEXEC	= libexec/post-install libexec/postfix-script libexec/postfix-wrapper \
18	libexec/postmulti-script libexec/postfix-tls-script
19PLUGINS	= meta/dynamicmaps.cf
20META	= meta/main.cf.proto meta/master.cf.proto meta/postfix-files \
21	meta/makedefs.out $(PLUGINS)
22EXPAND	= sed -e "s;\$${LIB_PREFIX};$(LIB_PREFIX);" \
23	    -e "s;\$${LIB_SUFFIX};$(LIB_SUFFIX);"
24SHLIB_DIR_OVERRIDE = \
25	$${shlib_directory:-`$(SHLIB_ENV) bin/postconf -dhx shlib_directory`}
26
27default: update
28
29# While generating the top-level Makefile, we must get the PLUGIN_LD
30# setting directly from the latest makedefs.out result.
31
32makefiles Makefiles conf/makedefs.out:
33	(echo "# Do not edit -- this file documents how Postfix was built for your machine."; $(SHELL) makedefs) >makedefs.tmp
34	set +e; if cmp makedefs.tmp conf/makedefs.out; then rm makedefs.tmp; \
35	else mv makedefs.tmp conf/makedefs.out; fi >/dev/null 2>/dev/null
36	set -e; for i in $(DIRS); do \
37	 (set -e; echo "[$$i]"; cd $$i; rm -f Makefile; \
38	 $(MAKE) -f Makefile.in Makefile MAKELEVEL=) || exit 1; \
39	done
40	@set -- `grep '^PLUGIN_LD' conf/makedefs.out`; \
41	rm -f Makefile; (cat conf/makedefs.out; \
42	case  "$$3" in \
43	""|":") grep -v '^PLUGINS' Makefile.in;; \
44	     *) cat Makefile.in;; \
45	esac) >Makefile
46
47update printfck tests root_tests:
48	set -e; for i in $(DIRS); do \
49	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) $(OPTS) $@ MAKELEVEL=) || exit 1; \
50	done
51
52update: $(META) $(LIBEXEC)
53
54libexec/post-install: conf/post-install
55	rm -f $@ && ln -f $? $@
56
57# Censor out build directory information.
58
59meta/makedefs.out: conf/makedefs.out
60	grep -v SHLIB_ENV $? > $@
61
62meta/postfix-files: conf/postfix-files conf/makedefs.out Makefile
63	rm -f $@
64	(if [ "${SHLIB_DIR}" = "no" -o "${SHLIB_DIR}" = "" ]; then \
65	    sed -e '/^\$$shlib_directory/d' \
66		-e '/dynamicmaps.cf/d' conf/postfix-files; \
67	elif [ "${PLUGIN_LD}" = ":" -o "${PLUGIN_LD}" = "" ]; then \
68	    sed -e '/dynamicmaps.cf/d' \
69		-e '/^\$$shlib_directory\/\$${LIB_PREFIX}/d' \
70		conf/postfix-files | $(EXPAND); \
71	else \
72	    $(EXPAND) conf/postfix-files | awk -F: ' \
73		BEGIN { \
74		    count = split("'"$(DEFINED_MAP_TYPES)"'", names, " "); \
75		    for (n = 1; n <= count; n++) \
76			have["$$shlib_directory/$(LIB_PREFIX)" names[n] \
77			    "$(LIB_SUFFIX)"] = 1; } \
78		/^[$$]shlib_directory.$(LIB_PREFIX)/ { \
79		    if (have[$$1]) print; next } \
80		{ print } \
81	    '; \
82	fi) | case "$(MAKE_FIX)" in \
83	 *) cat;; \
84	esac > $@
85
86libexec/postfix-script: conf/postfix-script
87	rm -f $@ && ln -f $? $@
88
89libexec/postfix-tls-script: conf/postfix-tls-script
90	rm -f $@ && ln -f $? $@
91
92libexec/postfix-wrapper: conf/postfix-wrapper
93	rm -f $@ && ln -f $? $@
94
95meta/main.cf.proto: conf/main.cf
96	rm -f $@ && ln -f $? $@
97
98meta/master.cf.proto: conf/master.cf
99	rm -f $@ && ln -f $? $@
100
101libexec/postmulti-script: conf/postmulti-script
102	rm -f $@ && ln -f $? $@
103
104meta/dynamicmaps.cf: conf/dynamicmaps.cf Makefile
105	rm -f $@ && $(EXPAND) conf/dynamicmaps.cf | $(AWK) ' \
106		BEGIN { split("'"$(DEFINED_MAP_TYPES)"'", map_types); \
107			for (n in map_types) has_type[map_types[n]] = n } \
108		/^#/ { print } \
109		/^[a-z]/ { if (has_type[$$1]) print } \
110	' >$@
111
112manpages:
113	set -e; for i in $(MANDIRS); do \
114	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) -f Makefile.in $(OPTS) MAKELEVEL=) || exit 1; \
115	done </dev/null
116
117# Some checks require a bin/postconf executable.
118pre-release-checks: typo-check missing-proxy-read-maps-check \
119	postlink-check postfix-files-check check-spell-history \
120	check-double-history check-table-proto
121
122postfix-files-check:
123	mantools/check-postfix-files | diff /dev/null -
124
125postlink-check:
126	$(SHLIB_ENV) mantools/check-postlink | diff /dev/null -
127
128missing-proxy-read-maps-check:
129	$(SHLIB_ENV) mantools/missing-proxy-read-maps | diff /dev/null -
130
131typo-check: spell-cc spell-install-proto-text spell-proto-html \
132	double-cc double-install-proto-text double-proto-html
133
134spell-cc:
135	mantools/check-spell-cc | diff /dev/null -
136
137spell-install-proto-text:
138	mantools/check-spell-install-proto-text | diff /dev/null -
139
140spell-proto-html:
141	mantools/check-spell-proto-html | diff /dev/null -
142
143double-cc:
144	mantools/check-double-cc | diff /dev/null -
145
146double-install-proto-text:
147	mantools/check-double-install-proto-text | diff /dev/null -
148
149double-proto-html:
150	mantools/check-double-proto-html | diff /dev/null -
151
152check-spell-history:
153	mantools/check-spell-history | diff /dev/null -
154
155check-double-history:
156	mantools/check-double-history | diff /dev/null -
157
158check-table-proto:
159	mantools/check-table-proto | diff /dev/null -
160
161# The build-time shlib_directory setting must take precedence over
162# the installed main.cf settings, otherwise we can't update an
163# installed system from dynamicmaps=yes<->dynamicmaps=no or from
164# shared=yes<->shared=no.
165
166install: update
167	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
168	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
169		postfix-install $(POSTFIX_INSTALL_OPTS)
170
171package: update
172	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
173	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
174		postfix-install -package $(POSTFIX_INSTALL_OPTS)
175
176upgrade: update
177	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
178	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
179		postfix-install -non-interactive $(POSTFIX_INSTALL_OPTS)
180
181
182non-interactive-package: update
183	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
184	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
185		postfix-install -non-interactive -package $(POSTFIX_INSTALL_OPTS)
186
187depend clean:
188	set -e; for i in $(DIRS); do \
189	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) $@) || exit 1; \
190	done
191
192depend_update:
193	set -e; for i in $(DIRS); do \
194	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) depend && $(MAKE) $(OPTS) update) \
195	    || exit 1; \
196	done
197
198tidy:	clean
199	rm -f Makefile */Makefile src/*/Makefile
200	cp -p Makefile.init Makefile
201	rm -f README_FILES/RELEASE_NOTES
202	ln -s ../RELEASE_NOTES README_FILES
203	rm -f bin/[!CRS]* lib/[!CRS]* include/[!CRS]* libexec/[!CRS]* \
204	    src/*/libpostfix-*.so src/*/libpostfix-*.dylib \
205	    src/*/postfix-*.so src/*/postfix-*.dylib \
206	    junk */junk */*/junk \
207	    *core */*core */*/*core \
208	    .nfs* */.nfs* */*/.nfs* \
209	    .pure */.pure */*/.pure \
210	    *.out */*.out */*/*.out \
211	    *.tmp */*.tmp */*/*.tmp \
212	    *.a */*.a */*/*.a \
213	    *~ */*~ */*/*~ \
214	    *- */*- */*/*- \
215	    *.orig */*.orig */*/*.orig \
216	    *.bak */*.bak */*/*.bak \
217	    make.err */make.err */*/make.err \
218	    *.gmon */*.gmon */*/*.gmon \
219	    conf/main.cf.default conf/bounce.cf.default meta/*
220	find . -type s -print | xargs rm -f
221	find . -type d -print | xargs chmod 755
222	find . -type f -print | xargs chmod a+r
223