]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c-lib/makefile
Security-54.1.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c-lib / makefile
1 # c-lib/makefile
2 #
3 # makes C ASN.1 runtime libraries (one for each flavour of buffer)
4 #
5 # MS 92
6 #
7 # $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/c-lib/makefile,v 1.1.1.1 2001/05/18 23:14:07 mb Exp $
8 # $Log: makefile,v $
9 # Revision 1.1.1.1 2001/05/18 23:14:07 mb
10 # Move from private repository to open source repository
11 #
12 # Revision 1.3 2000/12/22 01:22:41 dmitch
13 # Misc. mods for clean build on Cheetah 1D7.
14 #
15 # Revision 1.2 2000/06/08 20:07:49 dmitch
16 # Mods for X port.
17 #
18 # Revision 1.1.1.1 1999/03/16 18:06:10 aram
19 # Originals from SMIME Free Library.
20 #
21 # Revision 1.12 1997/08/27 15:55:30 wan
22 # Added generic table decoding, debug routines, berdecode, and asnwish.
23 #
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>).
29 #
30 # Revision 1.10 1997/02/16 12:34:03 rj
31 # let make clobber remove the link to install-sh that make made
32 #
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
35 #
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.
38 #
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.
42 #
43 # generate type table library.
44 #
45 # create installation directories only if they do not exist already.
46 #
47 # ranlib the copied libraries.
48 #
49 # call make recursively to generate the libraries different dependencies and concatenate them.
50 #
51 # changed `_' to `-' in file names.
52 #
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!
57 #
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
60 #
61 # Revision 1.5 1994/10/08 05:27:56 rj
62 # typo fixed.
63 #
64 # Revision 1.4 1994/10/08 05:20:07 rj
65 # don't distribute the non-bootstrapping version of asn-useful.[hc]
66 #
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.
69 #
70 # Revision 1.2 1994/08/31 23:51:42 rj
71 # DISTFILES and install phony target added.
72 #
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.
75 #
76
77 include ../makehead
78 include ../makehead.static
79
80 DEPENDENCIES =
81
82 TOP = ..
83
84 ASN1_SRC_DIR = $(TOP)/asn1specs
85
86 COMPILERDIR = $(TOP)/compiler
87 SNACC = $(COMPILERDIR)/snacc
88 USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
89
90 CPPFLAGS += -I$(TOP) -Iinc $(bufFLAGS) $(compilerFLAGS)
91
92 RANLIB= /usr/bin/ranlib
93
94 HFILES.d = \
95 inc/asn-any.h \
96 inc/asn-bits.h \
97 inc/asn-bool.h \
98 inc/asn-config.h \
99 inc/asn-enum.h \
100 inc/asn-incl.h \
101 inc/asn-int.h \
102 inc/asn-len.h \
103 inc/asn-list.h \
104 inc/asn-null.h \
105 inc/asn-octs.h \
106 inc/asn-oid.h \
107 inc/asn-real.h \
108 inc/asn-tag.h \
109 inc/exp-buf.h \
110 inc/gen-buf.h \
111 inc/hash.h \
112 inc/min-buf.h \
113 inc/nibble-alloc.h \
114 inc/print.h \
115 inc/sbuf.h \
116 inc/str-stk.h \
117 \
118 inc/tbl-dec.h \
119 inc/tbl-enc.h \
120 inc/tbl-free.h \
121 inc/tbl-gen.h \
122 inc/tbl-dbg.h \
123 inc/tbl-gen-c-hdr.h \
124 inc/tbl-incl.h \
125 inc/tbl-print.h \
126 inc/tbl-util.h
127
128 HFILES = \
129 $(HFILES.d) \
130 inc/asn-useful.h \
131 inc/tbl.h
132
133 HFILES.shared = \
134 $(TOP)/snacc.h \
135 $(TOP)/config.h \
136 $(TOP)/policy.h
137
138 CFILES.d = \
139 src/asn-len.c \
140 src/asn-tag.c \
141 src/asn-int.c \
142 src/asn-bool.c \
143 src/asn-bits.c \
144 src/asn-octs.c \
145 src/asn-oid.c \
146 src/asn-real.c \
147 src/asn-null.c \
148 src/asn-list.c \
149 src/asn-enum.c \
150 src/str-stk.c \
151 src/nibble-alloc.c \
152 src/print.c \
153 src/asn-any.c \
154 src/hash.c \
155 src/exp-buf.c \
156 src/sbuf.c \
157 \
158 src/tbl-dec.c \
159 src/tbl-enc.c \
160 src/tbl-free.c \
161 src/tbl-gen.c \
162 src/tbl-dbg.c \
163 src/tbl-print.c \
164 src/tbl-util.c
165
166 CFILES = \
167 $(CFILES.d) \
168 src/asn-useful.c \
169 src/tbl.c
170
171 OFILES = \
172 $b/asn-len.o \
173 $b/asn-tag.o \
174 $b/asn-int.o \
175 $b/asn-bool.o \
176 $b/asn-bits.o \
177 $b/asn-octs.o \
178 $b/asn-oid.o \
179 $b/asn-real.o \
180 $b/asn-null.o \
181 $b/asn-list.o \
182 $b/asn-useful.o \
183 $b/asn-enum.o \
184 $b/str-stk.o \
185 $b/nibble-alloc.o \
186 $b/print.o \
187 $b/asn-any.o \
188 $b/hash.o \
189 $b/exp-buf.o \
190 $b/sbuf.o \
191 \
192 $b/tbl.o \
193 $b/tbl-dec.o \
194 $b/tbl-enc.o \
195 $b/tbl-free.o \
196 $b/tbl-gen.o \
197 $b/tbl-dbg.o \
198 $b/tbl-print.o \
199 $b/tbl-util.o
200
201 DISTFILES = \
202 README \
203 makefile \
204 $(HFILES.d) \
205 $(CFILES.d) \
206 boot/asn-useful.h \
207 boot/asn-useful.c \
208 tbl.h.patch \
209 boot/tbl.h \
210 boot/tbl.c
211
212 EXPORTLIBS = libasn1cebuf.a libasn1cmbuf.a libasn1csbuf.a libasn1ctbl.a
213 compilerLIB = libasn1cCebuf.a
214
215 LIBS = \
216 $(EXPORTLIBS) \
217 $(compilerLIB)
218
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
224
225 #-------------------------------------------------------------------------------
226
227 .PHONY: ebuf Cebuf mbuf sbuf tbl
228
229 default:: ebuf-lib mbuf-lib sbuf-lib tbl-lib
230 @echo "C ASN.1 libraries made"
231
232 all:: default Cebuf-lib
233
234 b = dummy
235
236 $b:: $(CFILES)
237
238 $b::
239 test -d $@ || mkdir $@
240 $(RM) $@/*.c
241 -ln $(CFILES) $@
242
243 .PHONY: ofiles lib
244 .PHONY: ebuf-lib Cebuf-lib mbuf-lib sbuf-lib tbl-lib
245
246 ofiles: $(OFILES)
247
248 lib: libasn1c$b.a
249
250 ebuf-lib:
251 $(MAKE) $(MAKEFLAGS.ebuf) ofiles lib
252
253 Cebuf-lib:
254 $(MAKE) $(MAKEFLAGS.Cebuf) ofiles lib
255
256 mbuf-lib:
257 $(MAKE) $(MAKEFLAGS.mbuf) ofiles lib
258
259 sbuf-lib:
260 $(MAKE) $(MAKEFLAGS.sbuf) ofiles lib
261
262 tbl-lib:
263 $(MAKE) $(MAKEFLAGS.tbl) ofiles lib
264
265 libasn1cebuf.a \
266 libasn1cCebuf.a \
267 libasn1cmbuf.a \
268 libasn1csbuf.a \
269 libasn1ctbl.a: $(OFILES)
270 $(AR) rv $@ $?
271 $(RANLIB) $@
272
273 inc/asn-useful.h \
274 src/asn-useful.c::
275 $(RM) inc/asn-useful.h src/asn-useful.c
276 if [ -f $(SNACC) ]; then\
277 $(MAKE) stamp-useful;\
278 else\
279 $(RM) asn-useful.h asn-useful.c;\
280 ln boot/asn-useful.h boot/asn-useful.c .;\
281 fi
282 ln asn-useful.h inc
283 ln asn-useful.c src
284
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;\
293 else\
294 echo "asn-useful.h hasn't changed";\
295 mv asn-useful.h.prev asn-useful.h;\
296 fi;\
297 fi
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;\
301 else\
302 echo "asn-useful.c hasn't changed";\
303 mv asn-useful.c.prev asn-useful.c;\
304 fi;\
305 fi
306 date > $@
307
308 boot/asn-useful.h \
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
312
313 inc/tbl.h \
314 src/tbl.c::
315 $(RM) inc/tbl.h src/tbl.c
316 if [ -f $(SNACC) ]; then\
317 $(MAKE) stamp-tbl;\
318 else\
319 $(RM) tbl.h tbl.c;\
320 ln boot/tbl.h boot/tbl.c .;\
321 fi
322 ln tbl.h inc
323 ln tbl.c src
324
325 stamp-tbl: $(SNACC) $(USEFUL_TYPES) $(ASN1_SRC_DIR)/tbl.asn1 makefile
326 -mv tbl.h tbl.h.prev
327 -mv tbl.c tbl.c.prev
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
333 mv tbl.c.tmp tbl.c
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\
337 $(RM) tbl.h.prev;\
338 else\
339 echo "tbl.h hasn't changed";\
340 mv tbl.h.prev tbl.h;\
341 fi;\
342 fi
343 @if [ -f tbl.c.prev ]; then\
344 if [ `diff tbl.c.prev tbl.c | wc -l` -gt 4 ]; then\
345 $(RM) tbl.c.prev;\
346 else\
347 echo "tbl.c hasn't changed";\
348 mv tbl.c.prev tbl.c;\
349 fi;\
350 fi
351 date > $@
352
353 boot/tbl.h \
354 boot/tbl.c: stamp-tbl
355 $(RM) boot/tbl.h boot/tbl.c
356 cp -p tbl.h tbl.c boot
357
358 install-sh:
359 ln $(TOP)/install-sh $@
360
361 $(incdir)/snacc/c $(libdir):
362 $(TOP)/mkinstalldirs $@
363
364 install:: $(HFILES) ebuf-lib mbuf-lib sbuf-lib tbl-lib install-sh $(incdir)/snacc/c $(libdir)
365
366 install::
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
369
370 clean::
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
378 $(RM) $(compilerLIB)
379
380 clobber::
381 $(RM) $(LIBS)
382 $(RM) install-sh
383
384 depend:: inc/asn-useful.h src/asn-useful.c
385 depend:: inc/tbl.h src/tbl.c
386
387 depend::
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;\
397 $(RM) deps.$$dir;\
398 done;\
399 fi
400
401 include ../maketail