1 # file: c-examples/simple/makefile
3 # WARNING: this makefile isn't safe for parallel making!
5 # $Header: /cvs/Darwin/src/live/Security/SecuritySNACCRuntime/c-examples/simple/makefile,v 1.1.1.1 2001/05/18 23:14:07 mb Exp $
7 # Revision 1.1.1.1 2001/05/18 23:14:07 mb
8 # Move from private repository to open source repository
10 # Revision 1.1.1.1 1999/03/16 18:06:08 aram
11 # Originals from SMIME Free Library.
13 # Revision 1.6 1995/07/24 20:46:17 rj
14 # useful.asn1 renamed to asn-useful.asn1 to accomodate to snacc's new file name generation scheme.
16 # `cd && make' instead of `cd; make'.
18 # changed `_' to `-' in file names.
20 # Revision 1.5 1995/02/20 11:50:49 rj
21 # build snacc if it doesn't exist.
22 # some makes leave a trailing slash on $(@D), others don't. this causes some mkdir(1)s to deny their cooperation. therefore, the slash has got to be stripped.
24 # Revision 1.4 1995/02/13 15:05:36 rj
25 # augment CPPFLAGS, not overwrite.
26 # use $(@D) and $(@F) instead of `dirname $@` and `basename $@` (not every system's got the commands).
27 # we need the compiler for the dependencies, so make it if it doesn't yet exist.
29 # Revision 1.3 1994/08/31 21:42:52 rj
30 # rebuild the executables when the c-lib they get linked against is newer.
31 # the file good-pr.ber needs to be distributed.
33 # Revision 1.2 1994/08/31 10:31:52 rj
34 # since .o files get moved, a few more dependencies are needed.
36 # Revision 1.1 1994/08/31 08:46:27 rj
37 # first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
40 include ../../makehead
44 ASN1_SRC_DIR = $(TOP)/asn1specs
46 ASN1_C_LIB_DIR = $(TOP)/c-lib
47 ASN1_C_INC_DIR = $(ASN1_C_LIB_DIR)/inc
48 MBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1cmbuf.a
49 SBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1csbuf.a
50 EBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1cebuf.a
52 COMPILERDIR = $(TOP)/compiler
53 SNACC = $(COMPILERDIR)/snacc
54 USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
55 SNACCFLAGS = -u $(USEFUL_TYPES)
57 CPPFLAGS += -I$(TOP) -I$(ASN1_C_INC_DIR) $(BUFFLAG) $(LENFLAG)
59 ASN1FILES = $(ASN1_SRC_DIR)/p-rec.asn1
60 # generated by snacc from p-rec.asn1:
78 #-------------------------------------------------------------------------------
80 all:: genber minbuf-def minbuf-indef expbuf-def expbuf-indef sbuf-def sbuf-indef
83 $(ASN1CFILES): $(SNACC) $(ASN1FILES)
85 $(SNACC) $(SNACCFLAGS) $(ASN1FILES)
88 cd $(@D) && $(MAKE) $(@F)
99 min-def-obj/minbuf-ex.o:
101 $(MAKE) BUFFLAG=-DUSE_MIN_BUF LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
104 min-indef-obj/p-rec.o \
105 min-indef-obj/minbuf-ex.o:
107 $(MAKE) BUFFLAG=-DUSE_MIN_BUF LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
110 exp-def-obj/p-rec.o \
111 exp-def-obj/expbuf-ex.o:
113 $(MAKE) BUFFLAG=-DUSE_EXP_BUF LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
116 exp-indef-obj/p-rec.o \
117 exp-indef-obj/expbuf-ex.o:
119 $(MAKE) BUFFLAG=-DUSE_EXP_BUF LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
125 $(MAKE) LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
128 s-indef-obj/p-rec.o \
129 s-indef-obj/sbuf-ex.o:
131 $(MAKE) LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
134 genber: s-def-obj/p-rec.o genber.o
136 $(CC) $(LDFLAGS) -o $@ s-def-obj/p-rec.o genber.o $(SBUF_ASN1_LIB) $(LIBS)
138 minbuf-def: min-def-obj/p-rec.o min-def-obj/minbuf-ex.o
140 $(CC) $(LDFLAGS) -o $@ min-def-obj/p-rec.o min-def-obj/minbuf-ex.o $(MBUF_ASN1_LIB) $(LIBS)
142 minbuf-indef: min-indef-obj/p-rec.o min-indef-obj/minbuf-ex.o
144 $(CC) $(LDFLAGS) -o $@ min-indef-obj/p-rec.o min-indef-obj/minbuf-ex.o $(MBUF_ASN1_LIB) $(LIBS)
146 expbuf-def: exp-def-obj/p-rec.o exp-def-obj/expbuf-ex.o
148 $(CC) $(LDFLAGS) -o $@ exp-def-obj/p-rec.o exp-def-obj/expbuf-ex.o $(EBUF_ASN1_LIB) $(LIBS)
150 expbuf-indef: exp-indef-obj/p-rec.o exp-indef-obj/expbuf-ex.o
152 $(CC) $(LDFLAGS) -o $@ exp-indef-obj/p-rec.o exp-indef-obj/expbuf-ex.o $(EBUF_ASN1_LIB) $(LIBS)
154 sbuf-def: s-def-obj/p-rec.o s-def-obj/sbuf-ex.o
156 $(CC) $(LDFLAGS) -o $@ s-def-obj/p-rec.o s-def-obj/sbuf-ex.o $(SBUF_ASN1_LIB) $(LIBS)
158 sbuf-indef: s-indef-obj/p-rec.o s-indef-obj/sbuf-ex.o
160 $(CC) $(LDFLAGS) -o $@ s-indef-obj/p-rec.o s-indef-obj/sbuf-ex.o $(SBUF_ASN1_LIB) $(LIBS)
164 sbuf-indef: $(SBUF_ASN1_LIB)
167 minbuf-indef: $(MINBUF_ASN1_LIB)
170 expbuf-indef: $(EXPBUF_ASN1_LIB)
174 check:: minbuf-def minbuf-indef expbuf-def expbuf-indef sbuf-def sbuf-indef
175 for bt in min exp s; do\
176 $(RM) $$bt-foo.ber $$bt-bar.ber;\
177 ./$${bt}buf-indef good-pr.ber > $$bt-foo.ber;\
178 ./$${bt}buf-def $$bt-foo.ber > $$bt-bar.ber;\
180 @for bt in min exp s; do\
181 if cmp -s $$bt-bar.ber good-pr.ber; then\
182 echo "+++ Passed simple encode/decode tests using p-rec.asn1 with $${bt}bufs.";\
184 echo "--- Failed simple encode/decode tests using p-rec.asn1 with $${bt}bufs.";\
186 $(RM) $$bt-foo.ber $$bt-bar.ber;\
190 $(RM) *.o *~ core .emacs*
191 $(RM) expbuf-def expbuf-indef sbuf-indef sbuf-def minbuf-def minbuf-indef genber pr.ber $(ASN1HFILES) $(ASN1CFILES)
192 $(RM) -r *-def-obj *-indef-obj
193 $(RM) *-foo.ber *-bar.ber
197 include ../../maketail
201 for dir in min-def-obj min-indef-obj exp-def-obj exp-indef-obj s-def-obj s-indef-obj; do\
202 < dependencies sed -e 's:^\(.*\.o\):'"$$dir"'/\1:' >> deps;\