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