Merge V1_0_FREEZE_3 into the mainline. (Note this merge does *not*
[krb5.git] / src / Makefile.in
1 CFLAGS = $(CCOPTS) $(DEFS)
2
3 ##DOSBUILDTOP = .
4
5 SRCS =  
6 HDRS = 
7
8 DISTFILES = $(SRCS) $(HDRS) COPYING COPYING.LIB ChangeLog Makefile.in
9
10 all-unix::
11
12 all-mac::
13
14 all-windows:: makefile-windows
15         @echo Making in include
16         cd include
17         -$(MAKE) -$(MAKEFLAGS) 
18         @echo Making in util\et
19         cd ..\util\et
20         -$(MAKE) -$(MAKEFLAGS) 
21         @echo Making in util\profile
22         cd ..\profile
23         -$(MAKE) -$(MAKEFLAGS) 
24         @echo Making in lib
25         cd ..\..\lib
26         -$(MAKE) -$(MAKEFLAGS) 
27         @echo Making in windows
28         cd ..\windows
29         -$(MAKE) -$(MAKEFLAGS) 
30         cd ..
31
32 world::
33         date
34         make $(MFLAGS) all
35         date
36
37 INSTALLMKDIRS = $(KRB5ROOT) $(KRB5MANROOT) $(KRB5OTHERMKDIRS) \
38                 $(ADMIN_BINDIR) $(SERVER_BINDIR) $(CLIENT_BINDIR) \
39                 $(ADMIN_MANDIR) $(SERVER_MANDIR) $(CLIENT_MANDIR) \
40                 $(FILE_MANDIR) $(KRB5_LIBDIR) $(KRB5_INCDIR) \
41                 $(KRB5_INCSUBDIRS)
42
43 install-recurse: install-mkdirs
44
45 install-mkdirs:
46         @for i in $(INSTALLMKDIRS); do \
47                 if test -d $(DESTDIR)$$i; then :; else (set -x; mkdir -p $(DESTDIR)$$i); fi ; \
48         done
49
50 # install::
51 #       $(MAKE) $(MFLAGS) install.man
52
53 .c.o:
54         $(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) $(CFLAGS) $<
55
56 TAGS: $(SRCS)
57         etags $(SRCS)
58
59 clean-:: clean-windows
60 clean-mac:: clean-unix
61 clean-unix::
62         $(RM) *.o core
63
64 mostlyclean: clean
65
66 # This doesn't work; if you think you need it, you should use a
67 # separate build directory.
68
69 # distclean: clean
70 #       rm -f Makefile config.status
71
72 # realclean: distclean
73 #       rm -f TAGS
74
75 dist: $(DISTFILES)
76         echo cpio-`sed -e '/version_string/!d' \
77         -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c` > .fname
78         rm -rf `cat .fname`
79         mkdir `cat .fname`
80         -ln $(DISTFILES) `cat .fname`
81         for file in $(DISTFILES); do \
82           test -r `cat .fname`/$$file || cp -p $$file `cat .fname`; \
83         done
84         tar chzf `cat .fname`.tar.gz `cat .fname`
85         rm -rf `cat .fname` .fname
86
87 GZIPPROG= gzip -9v
88 PKGDIR=`pwd`/pkgdir
89 pkgdir:
90         if test ! -d $(PKGDIR); then mkdir $(PKGDIR); else true; fi
91 tgz-bin: pkgdir
92         rm -rf $(PKGDIR)/install cns5-bin.tgz
93         mkdir $(PKGDIR)/install
94         $(MAKE) install DESTDIR=$(PKGDIR)/install
95         (cd $(PKGDIR)/install && tar cf - usr/cygnus) | $(GZIPPROG) > cns5-bin.tgz
96         rm -rf $(PKGDIR)/install
97
98 # Macintosh build process...
99
100 # Build all things for the Mac build, which need to be built on
101 # Unix first.
102 unixmac:
103         (cd lib/krb5/error_tables; make -f Makefile.in unixmac)
104         (cd lib/gssapi/generic; make -f Makefile.in unixmac)
105
106
107 # Microsoft Windows build process...
108 #
109
110 config-windows:: makefile-windows
111         @echo Making in include
112         cd include
113         -$(MAKE) -$(MAKEFLAGS)
114         cd ..
115
116 makefile-windows:: wconfig.exe config\pre.in config\post.in \
117                 include\makefile.in include\krb5\makefile.in \
118                 lib\makefile.in lib\crypto\makefile.in \
119                 lib\crypto\crc32\makefile.in lib\crypto\des\makefile.in \
120                 lib\crypto\sha\makefile.in \
121                 lib\crypto\md4\makefile.in lib\crypto\md5\makefile.in \
122                 lib\crypto\os\makefile.in lib\des425\makefile.in \
123                 lib\gssapi\makefile.in lib\gssapi\generic\makefile.in \
124                 lib\gssapi\krb5\makefile.in lib\gssapi\mechglue\makefile.in \
125                 lib\krb5\makefile.in \
126                 lib\krb5\asn.1\makefile.in lib\krb5\ccache\makefile.in \
127                 lib\krb5\ccache\file\makefile.in \
128                 lib\krb5\ccache\stdio\makefile.in \
129                 lib\krb5\error_tables\makefile.in \
130                 lib\krb5\free\makefile.in lib\krb5\keytab\makefile.in \
131                 lib\krb5\keytab\file\makefile.in lib\krb5\krb\makefile.in \
132                 lib\krb5\os\makefile.in lib\krb5\posix\makefile.in \
133                 lib\krb5\rcache\makefile.in \
134                 util\et\makefile.in util\profile\makefile.in \
135                 windows\cns\Makefile.in windows\gss\Makefile.in \
136                 windows\wintel\Makefile.in
137         .\wconfig config <makefile.in >makefile
138         .\wconfig config <include\makefile.in >include\makefile
139         .\wconfig config <include\krb5\makefile.in >include\krb5\makefile
140         .\wconfig config <lib\makefile.in >lib\makefile
141         .\wconfig config <lib\crypto\makefile.in >lib\crypto\makefile
142         .\wconfig config <lib\crypto\crc32\makefile.in >lib\crypto\crc32\makefile
143         .\wconfig config <lib\crypto\des\makefile.in >lib\crypto\des\makefile
144         .\wconfig config <lib\crypto\sha\makefile.in >lib\crypto\sha\makefile
145         .\wconfig config <lib\crypto\md4\makefile.in >lib\crypto\md4\makefile
146         .\wconfig config <lib\crypto\md5\makefile.in >lib\crypto\md5\makefile
147         .\wconfig config <lib\crypto\os\makefile.in >lib\crypto\os\makefile
148         .\wconfig config <lib\des425\makefile.in >lib\des425\makefile
149         .\wconfig config <lib\gssapi\makefile.in >lib\gssapi\makefile
150         .\wconfig config <lib\gssapi\generic\makefile.in >lib\gssapi\generic\makefile
151         .\wconfig config <lib\gssapi\mechglue\makefile.in >lib\gssapi\mechglue\makefile
152         .\wconfig config <lib\gssapi\krb5\makefile.in >lib\gssapi\krb5\makefile
153         .\wconfig config <lib\kadm\makefile.in >lib\kadm\makefile
154         .\wconfig config <lib\krb5\makefile.in >lib\krb5\makefile
155         .\wconfig config <lib\krb5\asn.1\makefile.in >lib\krb5\asn.1\makefile
156         .\wconfig config <lib\krb5\ccache\makefile.in >lib\krb5\ccache\makefile
157         .\wconfig config <lib\krb5\ccache\file\makefile.in >lib\krb5\ccache\file\makefile
158         .\wconfig config <lib\krb5\ccache\stdio\makefile.in >lib\krb5\ccache\stdio\makefile
159         .\wconfig config <lib\krb5\error_tables\makefile.in >lib\krb5\error_tables\makefile
160         .\wconfig config <lib\krb5\free\makefile.in >lib\krb5\free\makefile
161         .\wconfig config <lib\krb5\keytab\makefile.in >lib\krb5\keytab\makefile
162         .\wconfig config <lib\krb5\keytab\file\makefile.in >lib\krb5\keytab\file\makefile
163         .\wconfig config <lib\krb5\krb\makefile.in >lib\krb5\krb\makefile
164         .\wconfig config <lib\krb5\os\makefile.in >lib\krb5\os\makefile
165         .\wconfig config <lib\krb5\posix\makefile.in >lib\krb5\posix\makefile
166         .\wconfig config <lib\krb5\rcache\makefile.in >lib\krb5\rcache\makefile
167         .\wconfig config <util\et\makefile.in >util\et\makefile
168         .\wconfig config <util\profile\makefile.in >util\profile\makefile
169         .\wconfig < windows\cns\Makefile.in > windows\cns\Makefile
170         .\wconfig < windows\gss\Makefile.in > windows\gss\Makefile
171         .\wconfig < windows\wintel\Makefile.in > windows\wintel\Makefile
172         config\rm.bat wconfig.obj msvc.pdb
173
174 wconfig.exe: wconfig.c
175         SET CL=/nologo
176         $(CC) /AL wconfig.c
177
178 clean-windows::
179         @echo Making clean in include
180         cd include
181         -$(MAKE) -$(MAKEFLAGS) clean
182         @echo Making clean in util\et
183         cd ..\util\et
184         -$(MAKE) -$(MAKEFLAGS) clean
185         @echo Making clean in util\profile
186         cd ..\profile
187         -$(MAKE) -$(MAKEFLAGS) clean
188         @echo Making clean in lib
189         cd ..\..\lib
190         -$(MAKE) -$(MAKEFLAGS) clean
191         @echo Making clean in windows
192         cd ..\windows
193         -$(MAKE) -$(MAKEFLAGS) clean
194         cd ..
195         @echo Making clean in root
196         config\rm.bat *.obj msvc.pdb *.err wconfig.obj wconfig.exe
197
198 #
199 # Renames DOS 8.3 filenames back to their proper, longer names.
200 #
201 ren2long:
202         -sh config/ren2long
203
204 #
205 # Builds the file that distributes Kerberos sources for DOS and 
206 # Macintosh sites from the source tree on Unix.
207 #
208 ZIP=zip
209 FILES= ./* \
210         config/* include/* include/krb5/* include/krb5/asn.1/* \
211         include/krb5/stock/* include/sys/* lib/* lib/crypto/* \
212         lib/crypto/crc32/* lib/crypto/des/* lib/crypto/sha/* lib/crypto/md4/* \
213         lib/crypto/md5/* lib/crypto/os/* lib/des425/* lib/gssapi/* \
214         lib/gssapi/generic/* lib/gssapi/krb5/* lib/gssapi/mechglue/* \
215         lib/kadm/* lib/krb425/* \
216         lib/krb5/* lib/krb5/asn.1/* lib/krb5/krb/* \
217         lib/krb5/ccache/* lib/krb5/ccache/file/* \
218         lib/krb5/ccache/stdio/* lib/krb5/error_tables/* \
219         lib/krb5/free/* lib/krb5/keytab/* lib/krb5/keytab/file/* \
220         lib/krb5/os/* lib/krb5/posix/* lib/krb5/rcache/* util/et/* \
221         util/profile/*
222
223 WINFILES= windows/* windows/cns/* windows/wintel/* windows/gss/*
224
225 MACFILES= mac/* mac/kconfig/* mac/libraries/* mac/telnet-k5-auth/* \
226         mac/gss-sample/* mac/SAP/* config/* include/* include/krb5/* \
227         include/krb5/asn.1/* include/krb5/stock/* include/sys/* \
228         ./patchlevel.h
229
230 WINBINARYFILES=windows/cns/*.ico windows/wintel/*.ico windows/gss/*.ico
231
232 CLEANUP= util/profile/profile.h util/profile/prof_err.[ch] \
233         lib/krb5/error_tables/asn1_err.c lib/krb5/error_tables/kdb5_err.c \
234         lib/krb5/error_tables/krb5_err.c lib/krb5/error_tables/kv5m_err.c \
235         lib/krb5/error_tables/adm_err.c \
236         include/asn1_err.h include/kdb5_err.h \
237         include/krb5_err.h include/kv5m_err.h \
238         include/adm_err.h include/profile.h include/krb5.h \
239         include/krb5/osconf.h \
240         lib/gssapi/generic/gssapi_err_generic.[ch] \
241         lib/gssapi/krb5/gssapi_err_krb5.[ch] winfile.list macfile.list \
242         lib/gssapi/generic/gssapi.h
243
244 kerbsrc.win: kerbsrc.zip
245
246 winfile.list:
247         echo $(FILES) $(WINFILES) | tr ' ' \\012 | \
248                 sed -f config/winexclude.sed > winfile.list
249
250 MAC_SUBDIRS = lib util
251 macfile.list:
252         /bin/sh mac/macfiles.sh $(MAC_SUBDIRS) > macfile.list
253         find $(MACFILES) -prune -type f -print | \
254                 sed -f config/winexclude.sed >> macfile.list
255
256 Makefile.sav:
257         rm -f Makefile.sav
258         mv Makefile Makefile.sav
259         cat config/windows.in Makefile.in config/win-post.in | \
260                 sed -e 's/^##DOS//' > Makefile
261
262 kerbsrc.zip: Makefile.sav awk-windows-mac winfile.list
263         rm -f kerbsrc.zip
264         $(ZIP) -Dlk kerbsrc.zip `cat winfile.list`
265         $(ZIP) -Dk kerbsrc.zip $(WINBINARYFILES)
266         mv Makefile.sav Makefile
267         rm -f $(CLEANUP)
268
269 kerbsrc-nt.zip: Makefile.sav awk-windows-mac winfile.list
270         rm -f kerbsrc-nt.zip
271         $(ZIP) -Dl kerbsrc-nt.zip `cat winfile.list`
272         $(ZIP) -D kerbsrc-nt.zip $(WINBINARYFILES)
273         mv Makefile.sav Makefile
274         rm -f $(CLEANUP)
275
276 dos-zipfiles: Makefile.sav awk-windows-mac winfile.list
277         rm -f kerbsrc.zip
278         $(ZIP) -Dlk kerbsrc.zip `cat winfile.list`
279         $(ZIP) -Dk kerbsrc.zip $(WINBINARYFILES)
280         rm -f kerbsrc-nt.zip
281         $(ZIP) -Dl kerbsrc-nt.zip `cat winfile.list`
282         $(ZIP) -D kerbsrc-nt.zip $(WINBINARYFILES)
283         mv Makefile.sav Makefile
284         rm -f $(CLEANUP)
285
286 Macfile: macfile.list Makefile.sav
287         rm -f Macfile
288         sed -e 's|/|:|g' -e 's/^/:/' -e '/:.:/d' -e '/:mac:/d' macfile.list > macfile.maclist
289         grep '\.c$$' macfile.maclist > macsrcsgss
290         grep -v ':gssapi:' macsrcsgss > macsrcsk5
291         echo SRCS = `cat macsrcsgss` >> Macfile
292         echo GSSOBJS68K = `sed -e 's/$$/.68K.o/' -e 's/.*://' \
293                 -e 's/^/:bin:68K:/' macsrcsgss` >> Macfile
294         echo GSSOBJS68KCFM = `sed -e 's/$$/.68K.o/' -e 's/.*://' \
295                 -e 's/^/:bin:CFM-68K:/' macsrcsgss` >> Macfile
296         echo GSSOBJSPPC = `sed -e 's/$$/.PPC.o/' -e 's/.*://' \
297                 -e 's/^/:bin:PPC:/' macsrcsgss` >> Macfile
298         echo K5OBJS68K = `sed -e 's/$$/.68K.o/' -e 's/.*://' \
299                 -e 's/^/:bin:68K:/' macsrcsk5` >> Macfile
300         echo K5OBJS68KCFM = `sed -e 's/$$/.68K.o/' -e 's/.*://' \
301                 -e 's/^/:bin:CFM-68K:/' macsrcsk5` >> Macfile
302         echo K5OBJSPPC = `sed -e 's/$$/.PPC.o/' -e 's/.*://' \
303                 -e 's/^/:bin:PPC:/' macsrcsk5` >> Macfile
304         echo INCLUDES = `sed -n -e 's/\(.*:\)[^:]*\.h$$/-i \1/p' macfile.maclist | sort -u` >> Macfile
305         echo "" >> Macfile
306         tr '%/:\\' '/:\304\266'< mac/Makefile.tmpl >> Macfile
307
308 mac-bin-dirs:
309         rm -rf bin
310         mkdir bin bin/68K bin/CFM-68K bin/PPC
311         sh mac/mkbindirs.sh bin/68K $(MAC_SUBDIRS)
312         sh mac/mkbindirs.sh bin/CFM-68K $(MAC_SUBDIRS)
313         sh mac/mkbindirs.sh bin/PPC $(MAC_SUBDIRS)
314
315 kerbsrc.mac.tar: awk-windows-mac macfile.list Macfile
316         cp mac/libraries/autoconf.h include/autoconf.h
317         mv Macfile Makefile
318         tar cvf kerbsrc.mac.tar Makefile include/autoconf.h bin \
319                 `cat macfile.list`
320         rm -f $(CLEANUP)
321         rm -rf bin
322         rm -f include/autoconf.h Makefile macsrc* macfile.maclist
323         mv Makefile.sav Makefile
324
325 #
326 # Part of building the PC release has to be done on Unix. This includes
327 # anything the requires awk.
328 #
329 AH  = util/et/et_h.awk
330 AC  = util/et/et_c.awk
331 INC = include/
332 ET  = lib/krb5/error_tables/
333 GG  = lib/gssapi/generic/
334 GK  = lib/gssapi/krb5/
335 PR  = util/profile/
336
337 awk-windows-mac:
338         gawk -f $(AH) outfile=$(INC)asn1_err.h $(ET)asn1_err.et
339         gawk -f $(AH) outfile=$(INC)kdb5_err.h $(ET)kdb5_err.et
340         gawk -f $(AH) outfile=$(INC)krb5_err.h $(ET)krb5_err.et
341         gawk -f $(AH) outfile=$(INC)kv5m_err.h $(ET)kv5m_err.et
342         gawk -f $(AH) outfile=$(INC)adm_err.h $(ET)adm_err.et
343         cat $(INC)/krb5.hin $(INC)/krb5_err.h $(INC)/kdb5_err.h \
344                 $(INC)/kv5m_err.h $(INC)/asn1_err.h > $(INC)/krb5.h
345         gawk -f $(AC) outfile=$(ET)asn1_err.c $(ET)asn1_err.et
346         gawk -f $(AC) outfile=$(ET)kdb5_err.c $(ET)kdb5_err.et
347         gawk -f $(AC) outfile=$(ET)krb5_err.c $(ET)krb5_err.et
348         gawk -f $(AC) outfile=$(ET)kv5m_err.c $(ET)kv5m_err.et
349         gawk -f $(AC) outfile=$(ET)adm_err.c $(ET)adm_err.et
350         gawk -f $(AH) outfile=$(GG)gssapi_err_generic.h $(GG)gssapi_err_generic.et
351         gawk -f $(AC) outfile=$(GG)gssapi_err_generic.c $(GG)gssapi_err_generic.et
352         gawk -f $(AH) outfile=$(GK)gssapi_err_krb5.h $(GK)gssapi_err_krb5.et
353         gawk -f $(AC) outfile=$(GK)gssapi_err_krb5.c $(GK)gssapi_err_krb5.et
354         gawk -f $(AH) outfile=$(PR)prof_err.h $(PR)prof_err.et
355         gawk -f $(AC) outfile=$(PR)prof_err.c $(PR)prof_err.et
356         cat $(PR)/profile.hin $(PR)prof_err.h > $(PR)profile.h
357         cp $(PR)profile.h include/profile.h
358         cp $(INC)/krb5/stock/osconf.h $(INC)/krb5
359         cp $(GG)gssapi.hin $(GG)gssapi.h