xref: /freebsd/crypto/krb5/src/Makefile.in (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1datadir=@datadir@
2
3mydir=.
4# Don't build sample by default, and definitely don't install them
5# for production use:
6#	plugins/locate/python
7#	plugins/preauth/wpse
8#	plugins/preauth/cksum_body
9SUBDIRS=util include lib \
10	@sam2_plugin@ \
11	plugins/audit \
12	plugins/audit/test \
13	@audit_plugin@ \
14	plugins/kadm5_hook/test \
15	plugins/kadm5_auth/test \
16	plugins/gssapi/negoextest \
17	plugins/hostrealm/test \
18	plugins/localauth/test \
19	plugins/pwqual/test \
20	plugins/authdata/greet_server \
21	plugins/authdata/greet_client \
22	plugins/certauth/test \
23	plugins/kdb/db2 \
24	@ldap_plugin_dir@ \
25	@lmdb_plugin_dir@ \
26	plugins/kdb/test \
27	plugins/kdcpolicy/test \
28	plugins/preauth/otp \
29	plugins/preauth/pkinit \
30	plugins/preauth/spake \
31	plugins/preauth/test \
32	plugins/tls/k5tls \
33	kdc kadmin kprop clients appl tests \
34	config-files build-tools man doc @po@
35WINSUBDIRS=include util lib ccapi windows clients appl plugins\preauth\spake
36BUILDTOP=$(REL).
37
38SRCS =
39HDRS =
40
41# Why aren't these flags showing up in Windows builds?
42##DOS##CPPFLAGS=$(CPPFLAGS) -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT
43
44# Lots of things will start to depend on the thread support, which
45# needs autoconf.h, but building "all" in include requires that util/et
46# have been built first.  Until we can untangle this, let's just check
47# that autoconf.h is up to date before going into any of the subdirectories.
48all-prerecurse generate-files-mac-prerecurse: update-autoconf-h
49update-autoconf-h:
50	(cd include && $(MAKE) autoconf.h osconf.h)
51
52##DOS##!if 0
53# This makefile doesn't use lib.in, but we still need shlib.conf here.
54config.status: $(top_srcdir)/config/shlib.conf
55##DOS##!endif
56
57all-windows: maybe-awk Makefile-windows
58
59world:
60	date
61	make $(MFLAGS) all
62	date
63
64INSTALLMKDIRS = $(KRB5ROOT) $(KRB5MANROOT) $(KRB5OTHERMKDIRS) \
65		$(ADMIN_BINDIR) $(SERVER_BINDIR) $(CLIENT_BINDIR) \
66		$(ADMIN_MANDIR) $(SERVER_MANDIR) $(CLIENT_MANDIR) \
67		$(FILE_MANDIR) $(OVERVIEW_MANDIR) \
68		$(ADMIN_CATDIR) $(SERVER_CATDIR) $(CLIENT_CATDIR) \
69		$(FILE_CATDIR) $(OVERVIEW_CATDIR) \
70		$(KRB5_LIBDIR) $(KRB5_INCDIR) \
71		$(KRB5_DB_MODULE_DIR) $(KRB5_PA_MODULE_DIR) \
72		$(KRB5_AD_MODULE_DIR) \
73		$(KRB5_LIBKRB5_MODULE_DIR) $(KRB5_TLS_MODULE_DIR) \
74		$(localstatedir) $(localstatedir)/krb5kdc \
75		$(runstatedir) $(runstatedir)/krb5kdc \
76		$(KRB5_INCSUBDIRS) $(datadir) $(EXAMPLEDIR) \
77		$(PKGCONFIG_DIR)
78
79install-strip:
80	$(MAKE) install INSTALL_STRIP=-s
81
82install-recurse: install-mkdirs
83
84install-mkdirs:
85	@for i in $(INSTALLMKDIRS); do \
86		$(srcdir)/config/mkinstalldirs $(DESTDIR)$$i; \
87	done
88
89install-headers-mkdirs:
90	$(srcdir)/config/mkinstalldirs $(DESTDIR)$(KRB5_INCDIR)
91	$(srcdir)/config/mkinstalldirs $(DESTDIR)$(KRB5_INCDIR)/gssapi
92	$(srcdir)/config/mkinstalldirs $(DESTDIR)$(KRB5_INCDIR)/gssrpc
93install-headers-prerecurse: install-headers-mkdirs
94
95clean-:: clean-windows
96clean-unix::
97	$(RM) *.o core skiptests
98
99# Microsoft Windows build process...
100#
101
102config-windows: Makefile-windows
103#	@echo Making in include
104#	cd include
105#	$(MAKE) -$(MFLAGS)
106#	cd ..
107
108#
109# We need outpre-dir explicitly in here because we may
110# try to build wconfig on a config-windows.
111#
112##DOS##$(WCONFIG_EXE): outpre-dir wconfig.c
113##DOS##	$(CC) -Fe$@ -Fo$*.obj wconfig.c $(CCLINKOPTION)
114##DOS## $(_VC_MANIFEST_EMBED_EXE)
115
116##DOS##MKFDEP=$(WCONFIG_EXE) config\win-pre.in config\win-post.in
117
118WINMAKEFILES=Makefile \
119	appl\Makefile appl\gss-sample\Makefile \
120	ccapi\Makefile \
121	ccapi\lib\win\Makefile \
122	ccapi\server\win\Makefile \
123	ccapi\test\Makefile \
124	clients\Makefile clients\kdestroy\Makefile \
125	clients\kinit\Makefile clients\klist\Makefile \
126	clients\kpasswd\Makefile clients\kvno\Makefile \
127	clients\kcpytkt\Makefile clients\kdeltkt\Makefile \
128	clients\kswitch\Makefile \
129	include\Makefile \
130	lib\Makefile lib\crypto\Makefile lib\crypto\krb\Makefile \
131	lib\crypto\builtin\Makefile lib\crypto\builtin\aes\Makefile \
132	lib\crypto\builtin\enc_provider\Makefile \
133	lib\crypto\builtin\des\Makefile lib\crypto\builtin\md5\Makefile \
134	lib\crypto\builtin\camellia\Makefile lib\crypto\builtin\md4\Makefile \
135	lib\crypto\builtin\hash_provider\Makefile \
136	lib\crypto\builtin\sha2\Makefile lib\crypto\builtin\sha1\Makefile \
137	lib\crypto\crypto_tests\Makefile \
138	lib\gssapi\Makefile lib\gssapi\generic\Makefile \
139	lib\gssapi\krb5\Makefile lib\gssapi\mechglue\Makefile \
140	lib\gssapi\spnego\Makefile \
141	lib\krb5\Makefile \
142	lib\krb5\asn.1\Makefile lib\krb5\ccache\Makefile \
143	lib\krb5\ccache\ccapi\Makefile \
144	lib\krb5\error_tables\Makefile \
145	lib\krb5\keytab\Makefile \
146	lib\krb5\krb\Makefile \
147	lib\krb5\os\Makefile lib\krb5\posix\Makefile \
148	lib\krb5\rcache\Makefile \
149	lib\krb5\unicode\Makefile \
150	util\Makefile \
151	util\et\Makefile util\profile\Makefile util\profile\testmod\Makefile \
152	util\support\Makefile \
153	util\windows\Makefile \
154	windows\Makefile windows\lib\Makefile windows\ms2mit\Makefile \
155	windows\kfwlogon\Makefile windows\leashdll\Makefile \
156	windows\leash\Makefile windows\leash\htmlhelp\Makefile \
157	plugins\preauth\spake\Makefile
158
159##DOS##Makefile-windows: $(MKFDEP) $(WINMAKEFILES)
160
161##DOS##Makefile: Makefile.in $(MKFDEP)
162##DOS##	$(WCONFIG) config < $@.in > $@
163##DOS##appl\Makefile: appl\Makefile.in $(MKFDEP)
164##DOS##	$(WCONFIG) config < $@.in > $@
165##DOS##appl\gss-sample\Makefile: appl\gss-sample\Makefile.in $(MKFDEP)
166##DOS##	$(WCONFIG) config < $@.in > $@
167##DOS##ccapi\Makefile: ccapi\Makefile.in $(MKFDEP)
168##DOS##	$(WCONFIG) config < $@.in > $@
169##DOS##ccapi\lib\win\Makefile: ccapi\lib\win\Makefile.in $(MKFDEP)
170##DOS##	$(WCONFIG) config < $@.in > $@
171##DOS##ccapi\server\win\Makefile: ccapi\server\win\Makefile.in $(MKFDEP)
172##DOS##	$(WCONFIG) config < $@.in > $@
173##DOS##ccapi\test\Makefile: ccapi\test\Makefile.in $(MKFDEP)
174##DOS##	$(WCONFIG) config < $@.in > $@
175##DOS##clients\Makefile: clients\Makefile.in $(MKFDEP)
176##DOS##	$(WCONFIG) config < $@.in > $@
177##DOS##clients\kdestroy\Makefile: clients\kdestroy\Makefile.in $(MKFDEP)
178##DOS##	$(WCONFIG) config < $@.in > $@
179##DOS##clients\kinit\Makefile: clients\kinit\Makefile.in $(MKFDEP)
180##DOS##	$(WCONFIG) config < $@.in > $@
181##DOS##clients\klist\Makefile: clients\klist\Makefile.in $(MKFDEP)
182##DOS##	$(WCONFIG) config < $@.in > $@
183##DOS##clients\kpasswd\Makefile: clients\kpasswd\Makefile.in $(MKFDEP)
184##DOS##	$(WCONFIG) config < $@.in > $@
185##DOS##clients\kswitch\Makefile: clients\kswitch\Makefile.in $(MKFDEP)
186##DOS##	$(WCONFIG) config < $@.in > $@
187##DOS##clients\kvno\Makefile: clients\kvno\Makefile.in $(MKFDEP)
188##DOS##	$(WCONFIG) config < $@.in > $@
189##DOS##clients\kcpytkt\Makefile: clients\kcpytkt\Makefile.in $(MKFDEP)
190##DOS##	$(WCONFIG) config < $@.in > $@
191##DOS##clients\kdeltkt\Makefile: clients\kdeltkt\Makefile.in $(MKFDEP)
192##DOS##	$(WCONFIG) config < $@.in > $@
193##DOS##include\Makefile: include\Makefile.in $(MKFDEP)
194##DOS##	$(WCONFIG) config < $@.in > $@
195##DOS##lib\Makefile: lib\Makefile.in $(MKFDEP)
196##DOS##	$(WCONFIG) config < $@.in > $@
197##DOS##lib\crypto\Makefile: lib\crypto\Makefile.in $(MKFDEP)
198##DOS##	$(WCONFIG) config < $@.in > $@
199##DOS##lib\crypto\krb\Makefile: lib\crypto\krb\Makefile.in $(MKFDEP)
200##DOS##	$(WCONFIG) config < $@.in > $@
201##DOS##lib\crypto\builtin\aes\Makefile: lib\crypto\builtin\aes\Makefile.in $(MKFDEP)
202##DOS##	$(WCONFIG) config < $@.in > $@
203##DOS##lib\crypto\builtin\enc_provider\Makefile: lib\crypto\builtin\enc_provider\Makefile.in $(MKFDEP)
204##DOS##	$(WCONFIG) config < $@.in > $@
205##DOS##lib\crypto\builtin\des\Makefile: lib\crypto\builtin\des\Makefile.in $(MKFDEP)
206##DOS##	$(WCONFIG) config < $@.in > $@
207##DOS##lib\crypto\builtin\md5\Makefile: lib\crypto\builtin\md5\Makefile.in $(MKFDEP)
208##DOS##	$(WCONFIG) config < $@.in > $@
209##DOS##lib\crypto\builtin\camellia\Makefile: lib\crypto\builtin\camellia\Makefile.in $(MKFDEP)
210##DOS##	$(WCONFIG) config < $@.in > $@
211##DOS##lib\crypto\builtin\md4\Makefile: lib\crypto\builtin\md4\Makefile.in $(MKFDEP)
212##DOS##	$(WCONFIG) config < $@.in > $@
213##DOS##lib\crypto\builtin\hash_provider\Makefile: lib\crypto\builtin\hash_provider\Makefile.in $(MKFDEP)
214##DOS##	$(WCONFIG) config < $@.in > $@
215##DOS##lib\crypto\builtin\sha2\Makefile: lib\crypto\builtin\sha2\Makefile.in $(MKFDEP)
216##DOS##	$(WCONFIG) config < $@.in > $@
217##DOS##lib\crypto\builtin\sha1\Makefile: lib\crypto\builtin\sha1\Makefile.in $(MKFDEP)
218##DOS##	$(WCONFIG) config < $@.in > $@
219##DOS##lib\crypto\builtin\Makefile: lib\crypto\builtin\Makefile.in $(MKFDEP)
220##DOS##	$(WCONFIG) config < $@.in > $@
221##DOS##lib\crypto\crypto_tests\Makefile: lib\crypto\crypto_tests\Makefile.in $(MKFDEP)
222##DOS##	$(WCONFIG) config < $@.in > $@
223##DOS##lib\gssapi\Makefile: lib\gssapi\Makefile.in $(MKFDEP)
224##DOS##	$(WCONFIG) config < $@.in > $@
225##DOS##lib\gssapi\generic\Makefile: lib\gssapi\generic\Makefile.in $(MKFDEP)
226##DOS##	$(WCONFIG) config < $@.in > $@
227##DOS##lib\gssapi\mechglue\Makefile: lib\gssapi\mechglue\Makefile.in $(MKFDEP)
228##DOS##	$(WCONFIG) config < $@.in > $@
229##DOS##lib\gssapi\spnego\Makefile: lib\gssapi\spnego\Makefile.in $(MKFDEP)
230##DOS##	$(WCONFIG) config < $@.in > $@
231##DOS##lib\gssapi\krb5\Makefile: lib\gssapi\krb5\Makefile.in $(MKFDEP)
232##DOS##	$(WCONFIG) config < $@.in > $@
233##DOS##lib\krb5\Makefile: lib\krb5\Makefile.in $(MKFDEP)
234##DOS##	$(WCONFIG) config < $@.in > $@
235##DOS##lib\krb5\asn.1\Makefile: lib\krb5\asn.1\Makefile.in $(MKFDEP)
236##DOS##	$(WCONFIG) config < $@.in > $@
237##DOS##lib\krb5\ccache\Makefile: lib\krb5\ccache\Makefile.in $(MKFDEP)
238##DOS##	$(WCONFIG) config < $@.in > $@
239##DOS##lib\krb5\ccache\ccapi\Makefile: lib\krb5\ccache\ccapi\Makefile.in $(MKFDEP)
240##DOS##	$(WCONFIG) config < $@.in > $@
241##DOS##lib\krb5\error_tables\Makefile: lib\krb5\error_tables\Makefile.in $(MKFDEP)
242##DOS##	$(WCONFIG) config < $@.in > $@
243##DOS##lib\krb5\keytab\Makefile: $$@.in $(MKFDEP)
244##DOS##	$(WCONFIG) config < $@.in > $@
245##DOS##lib\krb5\krb\Makefile: lib\krb5\krb\Makefile.in $(MKFDEP)
246##DOS##	$(WCONFIG) config < $@.in > $@
247##DOS##lib\krb5\os\Makefile: lib\krb5\os\Makefile.in $(MKFDEP)
248##DOS##	$(WCONFIG) config < $@.in > $@
249##DOS##lib\krb5\posix\Makefile: lib\krb5\posix\Makefile.in $(MKFDEP)
250##DOS##	$(WCONFIG) config < $@.in > $@
251##DOS##lib\krb5\rcache\Makefile: lib\krb5\rcache\Makefile.in $(MKFDEP)
252##DOS##	$(WCONFIG) config < $@.in > $@
253##DOS##lib\krb5\unicode\Makefile: lib\krb5\unicode\Makefile.in $(MKFDEP)
254##DOS##	$(WCONFIG) config < $@.in > $@
255##DOS##util\Makefile: util\Makefile.in $(MKFDEP)
256##DOS##	$(WCONFIG) config < $@.in > $@
257##DOS##util\et\Makefile: util\et\Makefile.in $(MKFDEP)
258##DOS##	$(WCONFIG) config < $@.in > $@
259##DOS##util\profile\Makefile: util\profile\Makefile.in $(MKFDEP)
260##DOS##	$(WCONFIG) config < $@.in > $@
261##DOS##util\profile\testmod\Makefile: util\profile\testmod\Makefile.in $(MKFDEP)
262##DOS##	$(WCONFIG) config < $@.in > $@
263##DOS##util\support\Makefile: util\support\Makefile.in $(MKFDEP)
264##DOS##	$(WCONFIG) config < $@.in > $@
265##DOS##util\windows\Makefile: util\windows\Makefile.in $(MKFDEP)
266##DOS##	$(WCONFIG) config < $@.in > $@
267##DOS##windows\Makefile: windows\Makefile.in $(MKFDEP)
268##DOS##	$(WCONFIG) config < $@.in > $@
269##DOS##windows\lib\Makefile: windows\lib\Makefile.in $(MKFDEP)
270##DOS##	$(WCONFIG) config < $@.in > $@
271##DOS##windows\ms2mit\Makefile: windows\ms2mit\Makefile.in $(MKFDEP)
272##DOS##	$(WCONFIG) config < $@.in > $@
273##DOS##windows\kfwlogon\Makefile: windows\kfwlogon\Makefile.in $(MKFDEP)
274##DOS##	$(WCONFIG) config < $@.in > $@
275##DOS##windows\leashdll\Makefile: windows\leashdll\Makefile.in $(MKFDEP)
276##DOS##	$(WCONFIG) config < $@.in > $@
277##DOS##windows\leash\Makefile: windows\leash\Makefile.in $(MKFDEP)
278##DOS##	$(WCONFIG) config < $@.in > $@
279##DOS##windows\leash\htmlhelp\Makefile: windows\leash\htmlhelp\Makefile.in $(MKFDEP)
280##DOS##	$(WCONFIG) config < $@.in > $@
281##DOS##plugins\preauth\spake\Makefile: plugins\preauth\spake\Makefile.in $(MKFDEP)
282##DOS##	$(WCONFIG) config < $@.in > $@
283
284clean-windows:: Makefile-windows
285
286#
287# Renames DOS 8.3 filenames back to their proper, longer names.
288#
289ren2long:
290	-sh config/ren2long
291
292#
293# Helper for the windows build
294#
295TOPLEVEL=dummy
296
297#
298# Building error tables requires awk.
299#
300AWK = awk
301AH  = util/et/et_h.awk
302AC  = util/et/et_c.awk
303INC = include/
304ET  = lib/krb5/error_tables/
305GG  = lib/gssapi/generic/
306GK  = lib/gssapi/krb5/
307PR  = util/profile/
308CE  = util/et/
309CCL = ccapi/lib/
310
311ETOUT =	\
312	$(INC)asn1_err.h $(ET)asn1_err.c \
313	$(INC)kdb5_err.h $(ET)kdb5_err.c \
314	$(INC)krb5_err.h $(ET)krb5_err.c \
315	$(INC)k5e1_err.h $(ET)k5e1_err.c \
316	$(INC)kv5m_err.h $(ET)kv5m_err.c \
317	$(INC)krb524_err.h $(ET)krb524_err.c \
318	$(PR)prof_err.h $(PR)prof_err.c \
319	$(GG)gssapi_err_generic.h $(GG)gssapi_err_generic.c \
320	$(GK)gssapi_err_krb5.h $(GK)gssapi_err_krb5.c \
321	$(CCL)ccapi_err.h $(CCL)ccapi_err.c
322
323HOUT =	$(INC)krb5/krb5.h $(GG)gssapi.h $(PR)profile.h
324
325CLEANUP= Makefile $(ETOUT) $(HOUT) \
326	include/profile.h include/osconf.h
327
328
329dos-Makefile:
330	cat config/win-pre.in Makefile.in config/win-post.in | \
331		sed -e "s/^##DOS##//" -e "s/^##DOS//" > Makefile.tmp
332	mv Makefile.tmp Makefile
333
334prep-windows: dos-Makefile awk-windows-mac
335
336
337$(INC)asn1_err.h: $(AH) $(ET)asn1_err.et
338	$(AWK) -f $(AH) outfile=$@ $(ET)asn1_err.et
339$(INC)kdb5_err.h: $(AH) $(ET)kdb5_err.et
340	$(AWK) -f $(AH) outfile=$@ $(ET)kdb5_err.et
341$(INC)krb5_err.h: $(AH) $(ET)krb5_err.et
342	$(AWK) -f $(AH) outfile=$@ $(ET)krb5_err.et
343$(INC)k5e1_err.h: $(AH) $(ET)k5e1_err.et
344	$(AWK) -f $(AH) outfile=$@ $(ET)k5e1_err.et
345$(INC)kv5m_err.h: $(AH) $(ET)kv5m_err.et
346	$(AWK) -f $(AH) outfile=$@ $(ET)kv5m_err.et
347$(INC)krb524_err.h: $(AH) $(ET)krb524_err.et
348	$(AWK) -f $(AH) outfile=$@ $(ET)krb524_err.et
349$(PR)prof_err.h: $(AH) $(PR)prof_err.et
350	$(AWK) -f $(AH) outfile=$@ $(PR)prof_err.et
351$(GG)gssapi_err_generic.h: $(AH) $(GG)gssapi_err_generic.et
352	$(AWK) -f $(AH) outfile=$@ $(GG)gssapi_err_generic.et
353$(GK)gssapi_err_krb5.h: $(AH) $(GK)gssapi_err_krb5.et
354	$(AWK) -f $(AH) outfile=$@ $(GK)gssapi_err_krb5.et
355$(CCL)ccapi_err.h: $(AH) $(CCL)ccapi_err.et
356	$(AWK) -f $(AH) outfile=$@ $(CCL)ccapi_err.et
357$(CE)test1.h: $(AH) $(CE)test1.et
358	$(AWK) -f $(AH) outfile=$@ $(CE)test1.et
359$(CE)test2.h: $(AH) $(CE)test2.et
360	$(AWK) -f $(AH) outfile=$@ $(CE)test2.et
361
362$(ET)asn1_err.c: $(AC) $(ET)asn1_err.et
363	$(AWK) -f $(AC) outfile=$@ $(ET)asn1_err.et
364$(ET)kdb5_err.c: $(AC) $(ET)kdb5_err.et
365	$(AWK) -f $(AC) outfile=$@ $(ET)kdb5_err.et
366$(ET)krb5_err.c: $(AC) $(ET)krb5_err.et
367	$(AWK) -f $(AC) outfile=$@ $(ET)krb5_err.et
368$(ET)k5e1_err.c: $(AC) $(ET)k5e1_err.et
369	$(AWK) -f $(AC) outfile=$@ $(ET)k5e1_err.et
370$(ET)kv5m_err.c: $(AC) $(ET)kv5m_err.et
371	$(AWK) -f $(AC) outfile=$@ $(ET)kv5m_err.et
372$(ET)krb524_err.c: $(AC) $(ET)krb524_err.et
373	$(AWK) -f $(AC) outfile=$@ $(ET)krb524_err.et
374$(PR)prof_err.c: $(AC) $(PR)prof_err.et
375	$(AWK) -f $(AC) outfile=$@ $(PR)prof_err.et
376$(GG)gssapi_err_generic.c: $(AC) $(GG)gssapi_err_generic.et
377	$(AWK) -f $(AC) outfile=$@ $(GG)gssapi_err_generic.et
378$(GK)gssapi_err_krb5.c: $(AC) $(GK)gssapi_err_krb5.et
379	$(AWK) -f $(AC) outfile=$@ $(GK)gssapi_err_krb5.et
380$(CCL)ccapi_err.c: $(AC) $(CCL)ccapi_err.et
381	$(AWK) -f $(AC) outfile=$@ $(CCL)ccapi_err.et
382$(CE)test1.c: $(AC) $(CE)test1.et
383	$(AWK) -f $(AC) outfile=$@ $(CE)test1.et
384$(CE)test2.c: $(AC) $(CE)test2.et
385	$(AWK) -f $(AC) outfile=$@ $(CE)test2.et
386
387KRBHDEP = $(INC)krb5/krb5.hin $(INC)krb5_err.h $(INC)k5e1_err.h \
388	$(INC)kdb5_err.h $(INC)kv5m_err.h $(INC)krb524_err.h $(INC)asn1_err.h
389
390$(INC)krb5/krb5.h: $(KRBHDEP)
391	rm -f $@
392	cat $(KRBHDEP) > $@
393$(PR)profile.h: $(PR)profile.hin $(PR)prof_err.h
394	rm -f $@
395	cat $(PR)profile.hin $(PR)prof_err.h > $@
396$(GG)gssapi.h: $(GG)gssapi.hin
397	rm -f $@
398	cat $(GG)gssapi.hin > $@
399
400awk-windows-mac: $(ETOUT) $(HOUT)
401
402#
403# The maybe-awk target needs to happen after AWK is defined.
404#
405
406##DOS##maybe-awk:
407##DOS##!ifdef WHICH_CMD
408##DOS##!if ![ $(WHICH_CMD) $(AWK) ]
409##DOS##maybe-awk: awk-windows-mac
410##DOS##!endif
411##DOS##!endif
412
413clean-windows-mac:
414	rm -f $(CLEANUP)
415
416distclean-windows:
417	config\rm.bat $(CLEANUP:^/=^\)
418	config\rm.bat $(WINMAKEFILES)
419	config\rm.bat $(KBINDIR)\*.dll $(KBINDIR)\*.exe
420	@if exist $(KBINDIR)\nul rmdir $(KBINDIR)
421
422# Avoid using $(CP) here because the nul+ hack breaks implicit
423# destination filenames.
424install-windows:
425	@if "$(KRB_INSTALL_DIR)"=="" @echo KRB_INSTALL_DIR is not defined!  Please define it.
426	@if "$(KRB_INSTALL_DIR)"=="" @dir /b \nul\nul
427	@if not exist "$(KRB_INSTALL_DIR)\$(NULL)" @echo The directory $(KRB_INSTALL_DIR) does not exist.  Please create it.
428	@if not exist "$(KRB_INSTALL_DIR)\$(NULL)" @dir /b $(KRB_INSTALL_DIR)\nul
429	@if not exist "$(KRB_INSTALL_DIR)\include\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\include"
430	@if not exist "$(KRB_INSTALL_DIR)\include\krb5\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\include\krb5"
431	@if not exist "$(KRB_INSTALL_DIR)\include\gssapi\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\include\gssapi"
432	@if not exist "$(KRB_INSTALL_DIR)\lib\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\lib"
433	@if not exist "$(KRB_INSTALL_DIR)\bin\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\bin"
434	@if not exist "$(KRB_INSTALL_DIR)\bin\plugins\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\bin\plugins"
435	@if not exist "$(KRB_INSTALL_DIR)\bin\plugins\preauth\$(NULL)" @mkdir "$(KRB_INSTALL_DIR)\bin\plugins\preauth"
436	copy include\krb5.h "$(KRB_INSTALL_DIR)\include\."
437	copy include\krb5\krb5.h "$(KRB_INSTALL_DIR)\include\krb5\."
438	copy include\win-mac.h "$(KRB_INSTALL_DIR)\include\."
439	copy include\profile.h "$(KRB_INSTALL_DIR)\include\."
440	copy include\com_err.h "$(KRB_INSTALL_DIR)\include\."
441	copy include\gssapi\gssapi.h "$(KRB_INSTALL_DIR)\include\gssapi\."
442	copy include\gssapi\gssapi_alloc.h "$(KRB_INSTALL_DIR)\include\gssapi\."
443	copy include\gssapi\gssapi_krb5.h "$(KRB_INSTALL_DIR)\include\gssapi\."
444	copy include\gssapi\gssapi_ext.h "$(KRB_INSTALL_DIR)\include\gssapi\."
445	copy lib\$(OUTPRE)*.lib "$(KRB_INSTALL_DIR)\lib\."
446	copy lib\$(OUTPRE)*.dll "$(KRB_INSTALL_DIR)\bin\."
447	$(INSTALLDBGSYMS) lib\$(OUTPRE)*.pdb "$(KRB_INSTALL_DIR)\bin\."
448	copy appl\gss-sample\$(OUTPRE)gss-server.exe "$(KRB_INSTALL_DIR)\bin\."
449	$(INSTALLDBGSYMS) appl\gss-sample\$(OUTPRE)gss-server.pdb "$(KRB_INSTALL_DIR)\bin\."
450	copy appl\gss-sample\$(OUTPRE)gss-client.exe "$(KRB_INSTALL_DIR)\bin\."
451	$(INSTALLDBGSYMS) appl\gss-sample\$(OUTPRE)gss-client.pdb "$(KRB_INSTALL_DIR)\bin\."
452	copy windows\ms2mit\$(OUTPRE)*.exe "$(KRB_INSTALL_DIR)\bin\."
453	$(INSTALLDBGSYMS) windows\ms2mit\$(OUTPRE)*.pdb "$(KRB_INSTALL_DIR)\bin\."
454	copy windows\leashdll\$(OUTPRE)*.lib "$(KRB_INSTALL_DIR)\lib\."
455	copy windows\leashdll\$(OUTPRE)*.dll "$(KRB_INSTALL_DIR)\bin\."
456	$(INSTALLDBGSYMS) windows\leashdll\$(OUTPRE)*.pdb "$(KRB_INSTALL_DIR)\bin\."
457##DOS##!ifndef NO_LEASH
458	copy windows\leash\$(OUTPRE)*.exe "$(KRB_INSTALL_DIR)\bin\."
459	$(INSTALLDBGSYMS) windows\leash\$(OUTPRE)*.pdb "$(KRB_INSTALL_DIR)\bin\."
460	copy windows\leash\$(OUTPRE)*.chm "$(KRB_INSTALL_DIR)\bin\."
461	copy windows\leash\htmlhelp\*.chm "$(KRB_INSTALL_DIR)\bin\."
462##DOS##!endif
463	copy windows\kfwlogon\$(OUTPRE)*.lib "$(KRB_INSTALL_DIR)\lib\."
464	copy windows\kfwlogon\$(OUTPRE)*.exe "$(KRB_INSTALL_DIR)\bin\."
465	copy windows\kfwlogon\$(OUTPRE)*.dll "$(KRB_INSTALL_DIR)\bin\."
466	$(INSTALLDBGSYMS) windows\kfwlogon\$(OUTPRE)*.pdb "$(KRB_INSTALL_DIR)\bin\."
467	copy ccapi\lib\win\srctmp\$(OUTPRE)$(CCLIB).dll "$(KRB_INSTALL_DIR)\bin\."
468	$(INSTALLDBGSYMS) ccapi\lib\win\srctmp\$(OUTPRE)$(CCLIB).pdb "$(KRB_INSTALL_DIR)\bin\."
469	copy ccapi\lib\win\srctmp\$(CCLIB).lib "$(KRB_INSTALL_DIR)\lib\."
470	copy ccapi\server\win\srctmp\$(OUTPRE)ccapiserver.exe "$(KRB_INSTALL_DIR)\bin\."
471	copy clients\kvno\$(OUTPRE)kvno.exe "$(KRB_INSTALL_DIR)\bin\."
472	copy clients\klist\$(OUTPRE)klist.exe "$(KRB_INSTALL_DIR)\bin\."
473	copy clients\kinit\$(OUTPRE)kinit.exe "$(KRB_INSTALL_DIR)\bin\."
474	copy clients\kdestroy\$(OUTPRE)kdestroy.exe "$(KRB_INSTALL_DIR)\bin\."
475	copy clients\kcpytkt\$(OUTPRE)kcpytkt.exe "$(KRB_INSTALL_DIR)\bin\."
476	copy clients\kdeltkt\$(OUTPRE)kdeltkt.exe "$(KRB_INSTALL_DIR)\bin\."
477	copy clients\kpasswd\$(OUTPRE)kpasswd.exe "$(KRB_INSTALL_DIR)\bin\."
478	copy clients\kswitch\$(OUTPRE)kswitch.exe "$(KRB_INSTALL_DIR)\bin\."
479	$(INSTALLDBGSYMS) ccapi\server\win\srctmp\$(OUTPRE)ccapiserver.pdb "$(KRB_INSTALL_DIR)\bin\."
480	$(INSTALLDBGSYMS) clients\kvno\$(OUTPRE)kvno.pdb "$(KRB_INSTALL_DIR)\bin\."
481	$(INSTALLDBGSYMS) clients\klist\$(OUTPRE)klist.pdb "$(KRB_INSTALL_DIR)\bin\."
482	$(INSTALLDBGSYMS) clients\kinit\$(OUTPRE)kinit.pdb "$(KRB_INSTALL_DIR)\bin\."
483	$(INSTALLDBGSYMS) clients\kdestroy\$(OUTPRE)kdestroy.pdb "$(KRB_INSTALL_DIR)\bin\."
484	$(INSTALLDBGSYMS) clients\kcpytkt\$(OUTPRE)kcpytkt.pdb "$(KRB_INSTALL_DIR)\bin\."
485	$(INSTALLDBGSYMS) clients\kdeltkt\$(OUTPRE)kdeltkt.pdb "$(KRB_INSTALL_DIR)\bin\."
486	$(INSTALLDBGSYMS) clients\kpasswd\$(OUTPRE)kpasswd.pdb "$(KRB_INSTALL_DIR)\bin\."
487	$(INSTALLDBGSYMS) clients\kswitch\$(OUTPRE)kswitch.pdb "$(KRB_INSTALL_DIR)\bin\."
488	copy plugins\preauth\spake\$(OUTPRE)$(SPAKELIB).dll "$(KRB_INSTALL_DIR)\bin\plugins\preauth\."
489	$(INSTALLDBGSYMS) plugins\preauth\spake\$(OUTPRE)$(SPAKELIB).pdb "$(KRB_INSTALL_DIR)\bin\plugins\preauth\."
490
491check-prerecurse: runenv.py
492	$(RM) $(SKIPTESTS)
493	touch $(SKIPTESTS)
494
495check-unix: check-lmdb-$(HAVE_LMDB)
496	cat $(SKIPTESTS)
497
498MINPYTHON = @PYTHON_MINVERSION@
499check-pytests-no: check-postrecurse
500	@echo 'Skipped python test scripts: python $(MINPYTHON) required' >> \
501		$(SKIPTESTS)
502
503check-cmocka-no: check-postrecurse
504	@echo 'Skipped cmocka tests: cmocka library or header not found' >> \
505		$(SKIPTESTS)
506
507check-lmdb-yes:
508check-lmdb-no:
509	@echo 'Skipped LMDB tests: LMDB KDB module not built' >> $(SKIPTESTS)
510
511# Create a test realm and spawn a shell in an environment pointing to it.
512# If CROSSNUM is set, create that many fully connected test realms and
513# point the shell at the first one.
514testrealm: runenv.py
515	PYTHONPATH=$(top_srcdir)/util $(PYTHON) $(srcdir)/util/testrealm.py \
516		$(CROSSNUM)
517
518# environment variable settings to propagate to Python-based tests
519
520pyrunenv.vals: Makefile
521	$(RUN_SETUP); \
522	for i in $(RUN_VARS); do \
523		eval echo 'env['\\\'$$i\\\''] = '\\\'\$$$$i\\\'; \
524	done > $@
525	echo "tls_impl = '$(TLS_IMPL)'" >> $@
526	echo "have_sasl = '$(HAVE_SASL)'" >> $@
527	echo "have_spake_openssl = '$(HAVE_SPAKE_OPENSSL)'" >> $@
528	echo "have_lmdb = '$(HAVE_LMDB)'" >> $@
529	echo "sizeof_time_t = $(SIZEOF_TIME_T)" >> $@
530
531runenv.py: pyrunenv.vals
532	echo 'env = {}' > $@
533	cat pyrunenv.vals >> $@
534
535clean-unix::
536	$(RM) runenv.py runenv.pyc pyrunenv.vals
537	$(RM) -r __pycache__
538
539COV_BUILD=	cov-build
540COV_ANALYZE=	cov-analyze
541COV_COMMIT=	cov-commit-defects --product "$(COV_PRODUCT)" --user "$(COV_USER)" --target "$(COV_TARGET)" --description "$(COV_DESC)"
542COV_MAKE_LIB=	cov-make-library
543
544COV_PRODUCT=	krb5
545COV_USER=	admin
546COV_DATADIR=
547COV_TARGET=	$(host)
548COV_DESC=
549
550# Set to, e.g., "--all" or "--security".
551COV_ANALYSES=
552# Temporary directory, might as well put it in the build tree.
553COV_TEMPDIR=	cov-temp
554# Sources modeling some functions or macros confusing Prevent.
555COV_MODELS=\
556	$(top_srcdir)/util/coverity-models/threads.c
557
558# Depend on Makefiles to ensure that (in maintainer mode) the configure
559# scripts won't get rerun under cov-build.
560coverity prevent cov: Makefiles
561	$(COV_BUILD) --dir $(COV_TEMPDIR) $(MAKE) all
562	$(COV_ANALYZE) $(COV_ANALYSES) --dir $(COV_TEMPDIR)
563	if test "$(COV_DATADIR)" != ""; then \
564		$(COV_COMMIT) --dir $(COV_TEMPDIR) --datadir $(COV_DATADIR); \
565	else \
566		echo "** Coverity Prevent analysis results not commit to Defect Manager"; \
567	fi
568
569FIND = find
570XARGS = xargs
571EMACS = emacs
572
573INDENTDIRS = \
574	appl \
575	clients \
576	include \
577	kadmin \
578	kdc \
579	lib/apputils \
580	lib/crypto \
581	lib/gssapi \
582	lib/kadm5 \
583	lib/kdb \
584	lib/krb5 \
585	plugins \
586	prototype \
587	kprop \
588	tests \
589	util
590
591BSDFILES = \
592	kadmin/server/ipropd_svc.c \
593	kadmin/server/kadm_rpc_svc.c \
594	lib/apputils/daemon.c \
595	lib/kadm5/admin_xdr.h \
596	lib/kadm5/clnt/client_rpc.c \
597	lib/kadm5/kadm_rpc.h \
598	lib/kadm5/kadm_rpc_xdr.c \
599	lib/kadm5/srv/adb_xdr.c \
600	lib/krb5/krb/strptime.c \
601	kprop/kpropd_rpc.c \
602	util/support/getopt.c \
603	util/support/getopt_long.c \
604	util/support/mkstemp.c \
605	util/support/strlcpy.c
606
607OTHEREXCLUDES = \
608	include/iprop.h \
609	include/k5-platform.h \
610	include/gssrpc \
611	lib/apputils/dummy.c \
612	lib/crypto/crypto_tests/camellia-test.c \
613	lib/crypto/builtin/aes \
614	lib/crypto/builtin/camellia \
615	lib/crypto/builtin/sha2 \
616	lib/gssapi/generic/gssapiP_generic.h \
617	lib/gssapi/generic/gssapi_ext.h \
618	lib/gssapi/krb5/gssapiP_krb5.h \
619	lib/gssapi/mechglue \
620	lib/gssapi/spnego \
621	lib/krb5/krb/deltat.c \
622	lib/krb5/unicode \
623	plugins/kdb/db2/libdb2 \
624	plugins/kdb/db2/pol_xdr.c \
625	plugins/preauth/pkinit/pkcs11.h \
626	plugins/preauth/pkinit/pkinit_accessor.h \
627	plugins/preauth/pkinit/pkinit_crypto.h \
628	plugins/preauth/pkinit/pkinit.h \
629	plugins/preauth/pkinit/pkinit_crypto_openssl.h \
630	tests/asn.1/ktest.h \
631	tests/asn.1/ktest_equal.h \
632	tests/asn.1/utility.h \
633	tests/gss-threads/gss-misc.c \
634	tests/gss-threads/gss-misc.h \
635	tests/hammer/kdc5_hammer.c \
636	util/et/com_err.h \
637	util/profile/prof_int.h \
638	util/profile/profile.hin \
639	util/support/fnmatch.c \
640	util/verto \
641	util/k5ev
642
643EXCLUDES = `for i in $(BSDFILES) $(OTHEREXCLUDES); do echo $$i; done | $(AWK) '{ print "-path", $$1, "-o" }'` -path /dev/null
644
645FIND_REINDENT = cd $(top_srcdir) && \
646	$(FIND) $(INDENTDIRS) \( $(EXCLUDES) \) -prune -o \
647	\( -name '*.[ch]' -o -name '*.hin' -o -name '*.[ch].in' \)
648
649show-reindentfiles:
650	($(FIND_REINDENT) -print)
651
652reindent:
653	($(FIND_REINDENT) \
654	-print0 | $(XARGS) -0 $(EMACS) -q -batch \
655	-l util/krb5-c-style.el \
656	-l util/krb5-batch-reindent.el)
657
658mark-cstyle: mark-cstyle-krb5 mark-cstyle-bsd
659
660mark-cstyle-krb5:
661	(cd $(top_srcdir) && \
662	$(FIND) $(INDENTDIRS) \( $(EXCLUDES) \) -prune -o \
663	-name '*.[ch]' \
664	-print0 | $(XARGS) -0 $(PYTHON) util/krb5-mark-cstyle.py \
665	--cstyle=krb5)
666
667mark-cstyle-bsd:
668	(cd $(top_srcdir) && $(FIND) $(BSDFILES) -print0 | $(XARGS) -0 \
669	$(PYTHON) util/krb5-mark-cstyle.py --cstyle=bsd)
670
671check-copyright:
672	(cd $(top_srcdir) && \
673	$(FIND) . \( -name '*.[ch]' -o -name '*.hin' \) -print0 | \
674	$(XARGS) -0 $(PYTHON) util/krb5-check-copyright.py)
675
676tags: FORCE
677	(cd $(top_srcdir) && \
678	$(FIND) . \( -name '*.[ch]' -o -name '*.hin' \) -print | \
679	etags --lang=c - && \
680	$(FIND) . -name '*.cpp' -print | etags --lang=c++ --append - && \
681	$(FIND) . -name '*.y' -print | etags --lang=yacc --append -)
682FORCE:
683.PHONY: FORCE tags
684
685# Update versioned automatically-generated files.
686regen:
687	$(MAKE) depend
688	(cd man && $(MAKE) man)
689	(cd po && $(MAKE) update-po)
690	(cd lib/krb5/krb && $(RM) deltat.c && $(MAKE) deltat.c)
691
692distclean-unix:
693	$(RM) $(top_srcdir)/TAGS
694