summaryrefslogtreecommitdiffstats
path: root/Makefile.in
blob: 4b1fb33ecfd2934f783779edd509e10de583e0d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# To test with valgrind:
# make -i tests NORANDOMIZE="" VALGRIND="valgrind --tool=memcheck --log-file=/some/where.%p" 
SHELL	= /bin/sh
WARN    = -Wmissing-prototypes -Wformat -Wno-comment -fno-common
OPTS	= 'WARN=$(WARN)'
DIRS	= src/util src/global src/dns src/tls src/xsasl src/master src/milter \
	src/postfix src/fsstone src/smtpstone \
	src/sendmail src/error src/pickup src/cleanup src/smtpd src/local \
	src/trivial-rewrite src/qmgr src/oqmgr src/smtp src/bounce \
	src/pipe src/showq src/postalias src/postcat src/postconf src/postdrop \
	src/postkick src/postlock src/postlog src/postmap src/postqueue \
	src/postsuper src/qmqpd src/spawn src/flush src/verify \
	src/virtual src/proxymap src/anvil src/scache src/discard src/tlsmgr \
	src/postmulti src/postscreen src/dnsblog src/tlsproxy \
	src/posttls-finger src/postlogd
MANDIRS	= proto man html
LIBEXEC	= libexec/post-install libexec/postfix-script libexec/postfix-wrapper \
	libexec/postmulti-script libexec/postfix-tls-script
PLUGINS	= meta/dynamicmaps.cf
META	= meta/main.cf.proto meta/master.cf.proto meta/postfix-files \
	meta/makedefs.out $(PLUGINS)
EXPAND	= sed -e "s;\$${LIB_PREFIX};$(LIB_PREFIX);" \
	    -e "s;\$${LIB_SUFFIX};$(LIB_SUFFIX);"
SHLIB_DIR_OVERRIDE = \
	$${shlib_directory:-`$(SHLIB_ENV) bin/postconf -dhx shlib_directory`}

default: update

# While generating the top-level Makefile, we must get the PLUGIN_LD
# setting directly from the latest makedefs.out result.

makefiles Makefiles conf/makedefs.out:
	(echo "# Do not edit -- this file documents how Postfix was built for your machine."; $(SHELL) makedefs) >makedefs.tmp
	set +e; if cmp makedefs.tmp conf/makedefs.out; then rm makedefs.tmp; \
	else mv makedefs.tmp conf/makedefs.out; fi >/dev/null 2>/dev/null
	set -e; for i in $(DIRS); do \
	 (set -e; echo "[$$i]"; cd $$i; rm -f Makefile; \
	 $(MAKE) -f Makefile.in Makefile MAKELEVEL=) || exit 1; \
	done
	@set -- `grep '^PLUGIN_LD' conf/makedefs.out`; \
	rm -f Makefile; (cat conf/makedefs.out; \
	case  "$$3" in \
	""|":") grep -v '^PLUGINS' Makefile.in;; \
	     *) cat Makefile.in;; \
	esac) >Makefile

update printfck tests root_tests:
	set -e; for i in $(DIRS); do \
	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) $(OPTS) $@ MAKELEVEL=) || exit 1; \
	done

update: $(META) $(LIBEXEC)

libexec/post-install: conf/post-install
	rm -f $@ && ln -f $? $@

# Censor out build directory information.

meta/makedefs.out: conf/makedefs.out
	grep -v SHLIB_ENV $? > $@

meta/postfix-files: conf/postfix-files conf/makedefs.out Makefile
	rm -f $@
	(if [ "${SHLIB_DIR}" = "no" -o "${SHLIB_DIR}" = "" ]; then \
	    sed -e '/^\$$shlib_directory/d' \
		-e '/dynamicmaps.cf/d' conf/postfix-files; \
	elif [ "${PLUGIN_LD}" = ":" -o "${PLUGIN_LD}" = "" ]; then \
	    sed -e '/dynamicmaps.cf/d' \
		-e '/^\$$shlib_directory\/\$${LIB_PREFIX}/d' \
		conf/postfix-files | $(EXPAND); \
	else \
	    $(EXPAND) conf/postfix-files | awk -F: ' \
		BEGIN { \
		    count = split("'"$(DEFINED_MAP_TYPES)"'", names, " "); \
		    for (n = 1; n <= count; n++) \
			have["$$shlib_directory/$(LIB_PREFIX)" names[n] \
			    "$(LIB_SUFFIX)"] = 1; } \
		/^[$$]shlib_directory.$(LIB_PREFIX)/ { \
		    if (have[$$1]) print; next } \
		{ print } \
	    '; \
	fi) | case "$(MAKE_FIX)" in \
	 *) cat;; \
	esac > $@

libexec/postfix-script: conf/postfix-script
	rm -f $@ && ln -f $? $@

libexec/postfix-tls-script: conf/postfix-tls-script
	rm -f $@ && ln -f $? $@

libexec/postfix-wrapper: conf/postfix-wrapper
	rm -f $@ && ln -f $? $@

meta/main.cf.proto: conf/main.cf
	rm -f $@ && ln -f $? $@

meta/master.cf.proto: conf/master.cf
	rm -f $@ && ln -f $? $@

libexec/postmulti-script: conf/postmulti-script
	rm -f $@ && ln -f $? $@

meta/dynamicmaps.cf: conf/dynamicmaps.cf Makefile
	rm -f $@ && $(EXPAND) conf/dynamicmaps.cf | $(AWK) ' \
		BEGIN { split("'"$(DEFINED_MAP_TYPES)"'", map_types); \
			for (n in map_types) has_type[map_types[n]] = n } \
		/^#/ { print } \
		/^[a-z]/ { if (has_type[$$1]) print } \
	' >$@

manpages:
	set -e; for i in $(MANDIRS); do \
	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) -f Makefile.in $(OPTS) MAKELEVEL=) || exit 1; \
	done </dev/null

# Some checks require a bin/postconf executable.
pre-release-checks: typo-check missing-proxy-read-maps-check \
	postlink-check postfix-files-check check-spell-history \
	check-double-history check-table-proto check-see-postconf-d-output \
	check-snapshot-nonprod

postfix-files-check:
	mantools/check-postfix-files | diff /dev/null -

postlink-check:
	$(SHLIB_ENV) mantools/check-postlink | diff /dev/null -

missing-proxy-read-maps-check:
	$(SHLIB_ENV) mantools/missing-proxy-read-maps | diff /dev/null -

typo-check: spell-cc spell-install-proto-text spell-proto-html \
	double-cc double-install-proto-text double-proto-html

spell-cc:
	mantools/check-spell-cc | diff /dev/null -

spell-install-proto-text:
	mantools/check-spell-install-proto-text | diff /dev/null -

spell-proto-html:
	mantools/check-spell-proto-html | diff /dev/null -

double-cc:
	mantools/check-double-cc | diff /dev/null -

double-install-proto-text:
	mantools/check-double-install-proto-text | diff /dev/null -

double-proto-html:
	mantools/check-double-proto-html | diff /dev/null -

check-spell-history:
	mantools/check-spell-history | diff /dev/null -

check-double-history:
	mantools/check-double-history | diff /dev/null -

check-table-proto:
	mantools/check-table-proto | diff /dev/null -

check-see-postconf-d-output:
	mantools/check-see-postconf-d-output | diff /dev/null -

check-snapshot-nonprod:
	mantools/check-snapshot-nonprod

# The build-time shlib_directory setting must take precedence over
# the installed main.cf settings, otherwise we can't update an
# installed system from dynamicmaps=yes<->dynamicmaps=no or from
# shared=yes<->shared=no.

install: update
	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
		postfix-install $(POSTFIX_INSTALL_OPTS)

package: update
	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
		postfix-install -package $(POSTFIX_INSTALL_OPTS)

upgrade: update
	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
		postfix-install -non-interactive $(POSTFIX_INSTALL_OPTS)
	

non-interactive-package: update
	SHLIB_ENV_VAR= SHLIB_ENV_VAL= \
	$(SHLIB_ENV) shlib_directory=$(SHLIB_DIR_OVERRIDE) $(SHELL) \
		postfix-install -non-interactive -package $(POSTFIX_INSTALL_OPTS)

depend clean:
	set -e; for i in $(DIRS); do \
	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) $@) || exit 1; \
	done

depend_update:
	set -e; for i in $(DIRS); do \
	 (set -e; echo "[$$i]"; cd $$i; $(MAKE) depend && $(MAKE) $(OPTS) update) \
	    || exit 1; \
	done

tidy:	clean
	rm -f Makefile */Makefile src/*/Makefile
	cp -p Makefile.init Makefile
	rm -f README_FILES/RELEASE_NOTES
	ln -s ../RELEASE_NOTES README_FILES
	rm -f bin/[!CRS]* lib/[!CRS]* include/[!CRS]* libexec/[!CRS]* \
	    src/*/libpostfix-*.so src/*/libpostfix-*.dylib \
	    src/*/postfix-*.so src/*/postfix-*.dylib \
	    junk */junk */*/junk \
	    *core */*core */*/*core \
	    .nfs* */.nfs* */*/.nfs* \
	    .pure */.pure */*/.pure \
	    *.out */*.out */*/*.out \
	    *.tmp */*.tmp */*/*.tmp \
	    *.a */*.a */*/*.a \
	    *~ */*~ */*/*~ \
	    *- */*- */*/*- \
	    *.orig */*.orig */*/*.orig \
	    *.bak */*.bak */*/*.bak \
	    make.err */make.err */*/make.err \
	    *.gmon */*.gmon */*/*.gmon \
	    conf/main.cf.default conf/bounce.cf.default meta/*
	find . -type s -print | xargs rm -f
	find . -type d -print | xargs chmod 755
	find . -type f -print | xargs chmod a+r