]> git.saurik.com Git - apple/security.git/blame - SecuritySNACCRuntime/c-examples/simple/makefile
Security-54.1.7.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c-examples / simple / makefile
CommitLineData
bac41a7b
A
1# file: c-examples/simple/makefile
2#
3# WARNING: this makefile isn't safe for parallel making!
4#
a66d0d4a 5# $Header: /cvs/root/Security/SecuritySNACCRuntime/c-examples/simple/Attic/makefile,v 1.1.1.1 2001/05/18 23:14:07 mb Exp $
bac41a7b
A
6# $Log: makefile,v $
7# Revision 1.1.1.1 2001/05/18 23:14:07 mb
8# Move from private repository to open source repository
9#
10# Revision 1.1.1.1 1999/03/16 18:06:08 aram
11# Originals from SMIME Free Library.
12#
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.
15#
16# `cd && make' instead of `cd; make'.
17#
18# changed `_' to `-' in file names.
19#
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.
23#
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.
28#
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.
32#
33# Revision 1.2 1994/08/31 10:31:52 rj
34# since .o files get moved, a few more dependencies are needed.
35#
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.
38#
39
40include ../../makehead
41
42TOP = ../..
43
44ASN1_SRC_DIR = $(TOP)/asn1specs
45
46ASN1_C_LIB_DIR = $(TOP)/c-lib
47ASN1_C_INC_DIR = $(ASN1_C_LIB_DIR)/inc
48MBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1cmbuf.a
49SBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1csbuf.a
50EBUF_ASN1_LIB = $(ASN1_C_LIB_DIR)/libasn1cebuf.a
51
52COMPILERDIR = $(TOP)/compiler
53SNACC = $(COMPILERDIR)/snacc
54USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
55SNACCFLAGS = -u $(USEFUL_TYPES)
56
57CPPFLAGS += -I$(TOP) -I$(ASN1_C_INC_DIR) $(BUFFLAG) $(LENFLAG)
58
59ASN1FILES = $(ASN1_SRC_DIR)/p-rec.asn1
60# generated by snacc from p-rec.asn1:
61ASN1HFILES = p-rec.h
62ASN1CFILES = p-rec.c
63
64CFILES = \
65 genber.c \
66 minbuf-ex.c \
67 expbuf-ex.c \
68 sbuf-ex.c
69
70BUFFLAG = -DUSE_SBUF
71
72DISTFILES = \
73 README \
74 makefile \
75 $(CFILES) \
76 good-pr.ber
77
78#-------------------------------------------------------------------------------
79
80all:: genber minbuf-def minbuf-indef expbuf-def expbuf-indef sbuf-def sbuf-indef
81
82$(ASN1HFILES) \
83$(ASN1CFILES): $(SNACC) $(ASN1FILES)
84 $(REASON)
85 $(SNACC) $(SNACCFLAGS) $(ASN1FILES)
86
87$(SNACC):
88 cd $(@D) && $(MAKE) $(@F)
89
90min-def-obj \
91min-indef-obj \
92exp-def-obj \
93exp-indef-obj \
94s-def-obj \
95s-indef-obj:
96 mkdir $@
97
98min-def-obj/p-rec.o \
99min-def-obj/minbuf-ex.o:
100 $(REASON)
101 $(MAKE) BUFFLAG=-DUSE_MIN_BUF LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
102 mv $(@F) $@
103
104min-indef-obj/p-rec.o \
105min-indef-obj/minbuf-ex.o:
106 $(REASON)
107 $(MAKE) BUFFLAG=-DUSE_MIN_BUF LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
108 mv $(@F) $@
109
110exp-def-obj/p-rec.o \
111exp-def-obj/expbuf-ex.o:
112 $(REASON)
113 $(MAKE) BUFFLAG=-DUSE_EXP_BUF LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
114 mv $(@F) $@
115
116exp-indef-obj/p-rec.o \
117exp-indef-obj/expbuf-ex.o:
118 $(REASON)
119 $(MAKE) BUFFLAG=-DUSE_EXP_BUF LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
120 mv $(@F) $@
121
122s-def-obj/p-rec.o \
123s-def-obj/sbuf-ex.o:
124 $(REASON)
125 $(MAKE) LENFLAG= `echo $(@D) | sed -e 's:/$$::'` $(@F)
126 mv $(@F) $@
127
128s-indef-obj/p-rec.o \
129s-indef-obj/sbuf-ex.o:
130 $(REASON)
131 $(MAKE) LENFLAG=-DUSE_INDEF_LEN `echo $(@D) | sed -e 's:/$$::'` $(@F)
132 mv $(@F) $@
133
134genber: s-def-obj/p-rec.o genber.o
135 $(REASON)
136 $(CC) $(LDFLAGS) -o $@ s-def-obj/p-rec.o genber.o $(SBUF_ASN1_LIB) $(LIBS)
137
138minbuf-def: min-def-obj/p-rec.o min-def-obj/minbuf-ex.o
139 $(REASON)
140 $(CC) $(LDFLAGS) -o $@ min-def-obj/p-rec.o min-def-obj/minbuf-ex.o $(MBUF_ASN1_LIB) $(LIBS)
141
142minbuf-indef: min-indef-obj/p-rec.o min-indef-obj/minbuf-ex.o
143 $(REASON)
144 $(CC) $(LDFLAGS) -o $@ min-indef-obj/p-rec.o min-indef-obj/minbuf-ex.o $(MBUF_ASN1_LIB) $(LIBS)
145
146expbuf-def: exp-def-obj/p-rec.o exp-def-obj/expbuf-ex.o
147 $(REASON)
148 $(CC) $(LDFLAGS) -o $@ exp-def-obj/p-rec.o exp-def-obj/expbuf-ex.o $(EBUF_ASN1_LIB) $(LIBS)
149
150expbuf-indef: exp-indef-obj/p-rec.o exp-indef-obj/expbuf-ex.o
151 $(REASON)
152 $(CC) $(LDFLAGS) -o $@ exp-indef-obj/p-rec.o exp-indef-obj/expbuf-ex.o $(EBUF_ASN1_LIB) $(LIBS)
153
154sbuf-def: s-def-obj/p-rec.o s-def-obj/sbuf-ex.o
155 $(REASON)
156 $(CC) $(LDFLAGS) -o $@ s-def-obj/p-rec.o s-def-obj/sbuf-ex.o $(SBUF_ASN1_LIB) $(LIBS)
157
158sbuf-indef: s-indef-obj/p-rec.o s-indef-obj/sbuf-ex.o
159 $(REASON)
160 $(CC) $(LDFLAGS) -o $@ s-indef-obj/p-rec.o s-indef-obj/sbuf-ex.o $(SBUF_ASN1_LIB) $(LIBS)
161
162genber \
163sbuf-def \
164sbuf-indef: $(SBUF_ASN1_LIB)
165
166minbuf-def \
167minbuf-indef: $(MINBUF_ASN1_LIB)
168
169expbuf-def \
170expbuf-indef: $(EXPBUF_ASN1_LIB)
171
172.PHONY: check
173
174check:: 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;\
179 done
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.";\
183 else\
184 echo "--- Failed simple encode/decode tests using p-rec.asn1 with $${bt}bufs.";\
185 fi;\
186 $(RM) $$bt-foo.ber $$bt-bar.ber;\
187 done
188
189clean::
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
194
195depend:: $(SNACC)
196
197include ../../maketail
198
199depend::
200 cp dependencies deps
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;\
203 done
204 mv deps dependencies