3 # makes C ASN.1 runtime libraries (one for each flavour of buffer)
7 # $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/c-lib/makefile,v 1.1.1.1 2001/05/18 23:14:07 mb Exp $
9 # Revision 1.1.1.1 2001/05/18 23:14:07 mb
10 # Move from private repository to open source repository
12 # Revision 1.3 2000/12/22 01:22:41 dmitch
13 # Misc. mods for clean build on Cheetah 1D7.
15 # Revision 1.2 2000/06/08 20:07:49 dmitch
18 # Revision 1.1.1.1 1999/03/16 18:06:10 aram
19 # Originals from SMIME Free Library.
21 # Revision 1.12 1997/08/27 15:55:30 wan
22 # Added generic table decoding, debug routines, berdecode, and asnwish.
24 # Revision 1.11 1997/03/13 09:15:08 wan
25 # Improved dependency generation for stupid makedepends.
26 # Corrected PeekTag to peek into buffer only as far as necessary.
27 # Added installable error handler.
28 # Fixed small glitch in idl-code generator (Markku Savela <msa@msa.tte.vtt.fi>).
30 # Revision 1.10 1997/02/16 12:34:03 rj
31 # let make clobber remove the link to install-sh that make made
33 # Revision 1.9 1995/09/07 18:58:15 rj
34 # asn-useful.asn1 is compiled with the -l 50 option, as recommended by MS in the documentation
36 # Revision 1.8 1995/07/24 20:56:31 rj
37 # useful.asn1 renamed to asn-useful.asn1 to accomodate to snacc's new file name generation scheme.
39 # generate tbl.[hc] from .../asn1specs/tbl.asn1
40 # patch tbl.h to add some data members.
41 # distribute boot versions of tbl.[ch] and tbl.h.path.
43 # generate type table library.
45 # create installation directories only if they do not exist already.
47 # ranlib the copied libraries.
49 # call make recursively to generate the libraries different dependencies and concatenate them.
51 # changed `_' to `-' in file names.
53 # Revision 1.7 1995/02/20 11:42:04 rj
54 # remove stamp-useful before removing asn-useful.[hc].
55 # distribute install-sh.
56 # use $(INSTALL*) in a for-loop as some install programs (namely the distributed install-sh) only process their first argument!
58 # Revision 1.6 1995/02/09 14:02:47 rj
59 # enforce generation of inc/asn-useful.h and src/asn-useful.c when making dependencies
61 # Revision 1.5 1994/10/08 05:27:56 rj
64 # Revision 1.4 1994/10/08 05:20:07 rj
65 # don't distribute the non-bootstrapping version of asn-useful.[hc]
67 # Revision 1.3 1994/10/08 04:47:42 rj
68 # the files asn-useful.[hc] get regenerated automagically. since the compiler itself is compiled with it, a bootstapping version is included in the distribution.
70 # Revision 1.2 1994/08/31 23:51:42 rj
71 # DISTFILES and install phony target added.
73 # Revision 1.1 1994/08/28 09:21:20 rj
74 # first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
78 include ../makehead.static
84 ASN1_SRC_DIR = $(TOP)/asn1specs
86 COMPILERDIR = $(TOP)/compiler
87 SNACC = $(COMPILERDIR)/snacc
88 USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
90 CPPFLAGS += -I$(TOP) -Iinc $(bufFLAGS) $(compilerFLAGS)
92 RANLIB= /usr/bin/ranlib
123 inc/tbl-gen-c-hdr.h \
212 EXPORTLIBS = libasn1cebuf.a libasn1cmbuf.a libasn1csbuf.a libasn1ctbl.a
213 compilerLIB = libasn1cCebuf.a
219 MAKEFLAGS.ebuf = bufFLAGS=-DUSE_EXP_BUF b=ebuf ebuf
220 MAKEFLAGS.Cebuf = bufFLAGS=-DUSE_EXP_BUF b=Cebuf Cebuf
221 MAKEFLAGS.mbuf = bufFLAGS=-DUSE_MIN_BUF b=mbuf mbuf
222 MAKEFLAGS.sbuf = bufFLAGS=-DUSE_SBUF b=sbuf sbuf
223 MAKEFLAGS.tbl = bufFLAGS="-DUSE_GEN_BUF -DTTBL" b=tbl tbl
225 #-------------------------------------------------------------------------------
227 .PHONY: ebuf Cebuf mbuf sbuf tbl
229 default:: ebuf-lib mbuf-lib sbuf-lib tbl-lib
230 @echo "C ASN.1 libraries made"
232 all:: default Cebuf-lib
239 test -d $@ || mkdir $@
244 .PHONY: ebuf-lib Cebuf-lib mbuf-lib sbuf-lib tbl-lib
251 $(MAKE) $(MAKEFLAGS.ebuf) ofiles lib
254 $(MAKE) $(MAKEFLAGS.Cebuf) ofiles lib
257 $(MAKE) $(MAKEFLAGS.mbuf) ofiles lib
260 $(MAKE) $(MAKEFLAGS.sbuf) ofiles lib
263 $(MAKE) $(MAKEFLAGS.tbl) ofiles lib
269 libasn1ctbl.a: $(OFILES)
275 $(RM) inc/asn-useful.h src/asn-useful.c
276 if [ -f $(SNACC) ]; then\
277 $(MAKE) stamp-useful;\
279 $(RM) asn-useful.h asn-useful.c;\
280 ln boot/asn-useful.h boot/asn-useful.c .;\
285 stamp-useful: $(SNACC) $(USEFUL_TYPES) makefile
286 -mv asn-useful.h asn-useful.h.prev
287 -mv asn-useful.c asn-useful.c.prev
288 $(SNACC) -c -l 50 $(USEFUL_TYPES)
289 # the dates in the two files will differ, so the files really differ if diff prints more than 4 lines of output:
290 @if [ -f asn-useful.h.prev ]; then\
291 if [ `diff asn-useful.h.prev asn-useful.h | wc -l` -gt 4 ]; then\
292 $(RM) asn-useful.h.prev;\
294 echo "asn-useful.h hasn't changed";\
295 mv asn-useful.h.prev asn-useful.h;\
298 @if [ -f asn-useful.c.prev ]; then\
299 if [ `diff asn-useful.c.prev asn-useful.c | wc -l` -gt 4 ]; then\
300 $(RM) asn-useful.c.prev;\
302 echo "asn-useful.c hasn't changed";\
303 mv asn-useful.c.prev asn-useful.c;\
309 boot/asn-useful.c: stamp-useful
310 $(RM) boot/asn-useful.h boot/asn-useful.c
311 cp -p asn-useful.h asn-useful.c boot
315 $(RM) inc/tbl.h src/tbl.c
316 if [ -f $(SNACC) ]; then\
320 ln boot/tbl.h boot/tbl.c .;\
325 stamp-tbl: $(SNACC) $(USEFUL_TYPES) $(ASN1_SRC_DIR)/tbl.asn1 makefile
328 $(SNACC) -u $(USEFUL_TYPES) $(ASN1_SRC_DIR)/tbl.asn1
329 $(PATCH) < tbl.h.patch
330 echo '#if TTBL' > tbl.c.tmp
331 cat tbl.c >> tbl.c.tmp
332 echo '#endif /* TTBL */' >> tbl.c.tmp
334 # the dates in the two files will differ, so the files really differ if diff prints more than 4 lines of output:
335 @if [ -f tbl.h.prev ]; then\
336 if [ `diff tbl.h.prev tbl.h | wc -l` -gt 4 ]; then\
339 echo "tbl.h hasn't changed";\
340 mv tbl.h.prev tbl.h;\
343 @if [ -f tbl.c.prev ]; then\
344 if [ `diff tbl.c.prev tbl.c | wc -l` -gt 4 ]; then\
347 echo "tbl.c hasn't changed";\
348 mv tbl.c.prev tbl.c;\
354 boot/tbl.c: stamp-tbl
355 $(RM) boot/tbl.h boot/tbl.c
356 cp -p tbl.h tbl.c boot
359 ln $(TOP)/install-sh $@
361 $(incdir)/snacc/c $(libdir):
362 $(TOP)/mkinstalldirs $@
364 install:: $(HFILES) ebuf-lib mbuf-lib sbuf-lib tbl-lib install-sh $(incdir)/snacc/c $(libdir)
367 for h in $(HFILES) $(HFILES.shared); do $(INSTALL_DATA) $$h $(incdir)/snacc/c/; done
368 for l in $(EXPORTLIBS); do $(INSTALL_DATA) $$l $(libexecdir)/; $(RANLIB) -t $(libexecdir)/$$l; done
371 $(RM) *.o *~ *.prev .emacs* core
372 $(RM) stamp-useful stamp-tbl
373 $(RM) asn-useful.h inc/asn-useful.h
374 $(RM) asn-useful.c src/asn-useful.c
375 $(RM) tbl.h inc/tbl.h
376 $(RM) tbl.c src/tbl.c
377 $(RM) -r ebuf Cebuf mbuf sbuf tbl
384 depend:: inc/asn-useful.h src/asn-useful.c
385 depend:: inc/tbl.h src/tbl.c
388 if [ x"$(DEPENDENCIES)" = x ]; then\
389 $(MAKE) $(MAKEFLAGS.ebuf) DEPENDENCIES=deps.ebuf depend;\
390 $(MAKE) $(MAKEFLAGS.Cebuf) DEPENDENCIES=deps.Cebuf depend;\
391 $(MAKE) $(MAKEFLAGS.mbuf) DEPENDENCIES=deps.mbuf depend;\
392 $(MAKE) $(MAKEFLAGS.sbuf) DEPENDENCIES=deps.sbuf depend;\
393 $(MAKE) $(MAKEFLAGS.tbl) DEPENDENCIES=deps.tbl depend;\
394 cp /dev/null dependencies;\
395 for dir in ebuf Cebuf mbuf sbuf tbl; do\
396 < deps.$$dir sed -e "s/^src/$$dir/;s/^[a-z-]*\.o:/$$dir\/&/" >> dependencies;\