]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/compiler/makefile
Security-54.1.tar.gz
[apple/security.git] / SecuritySNACCRuntime / compiler / makefile
1 # file: .../compiler/makefile
2 #
3 # makefile for ASN.1 '88 parser
4 #
5 # compiles the snacc ASN.1 compiler
6 #
7 # Mike Sample
8 # 1992
9 #
10 # $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/compiler/makefile,v 1.1.1.1 2001/05/18 23:14:08 mb Exp $
11 # $Log: makefile,v $
12 # Revision 1.1.1.1 2001/05/18 23:14:08 mb
13 # Move from private repository to open source repository
14 #
15 # Revision 1.2 2000/12/22 01:11:42 dmitch
16 # include ../makehead.static to workaround broken autoconf.
17 #
18 # Revision 1.1.1.1 1999/03/16 18:06:38 aram
19 # Originals from SMIME Free Library.
20 #
21 # Revision 1.12 1997/09/03 12:50:33 wan
22 # Shifted parse and lex
23 #
24 # Revision 1.11 1997/03/03 11:58:33 wan
25 # Final pre-delivery stuff (I hope).
26 #
27 # Revision 1.10 1997/02/28 13:39:52 wan
28 # Modifications collected for new version 1.3: Bug fixes, tk4.2.
29 #
30 # Revision 1.9 1997/02/16 18:02:49 rj
31 # snacc is needed to generate the distfiles
32 #
33 # Revision 1.8 1997/02/16 12:34:47 rj
34 # let make clobber remove the link to install-sh that make made
35 # let make clean remove more created files
36 #
37 # Revision 1.7 1997/01/02 08:47:20 rj
38 # an option to snacc added (when compiling the tbl.asn1 file)
39 #
40 # Revision 1.6 1995/07/25 18:09:18 rj
41 # the compiler is compiled from two files, tbl.h and tbl.c, it generates itself.
42 # for bootstrapping purposes, initial versions are supplied with the distribution.
43 #
44 # `cd && make' instead of `cd; make'.
45 #
46 # create installation directories only if they do not exist already.
47 #
48 # the compiler is compiled from two files, tbl.h and tbl.c, it generates itself.
49 # for bootstrapping purposes, initial versions are supplied with the distribution.
50 #
51 # changed `_' to `-' in file names.
52 #
53 # Revision 1.5 1995/02/20 11:53:57 rj
54 # distribute install-sh.
55 #
56 # Revision 1.4 1995/02/13 15:06:52 rj
57 # augment CPPFLAGS, not overwrite.
58 # CFLAGS moved to ../makehead.
59 #
60 # Revision 1.3 1994/10/08 03:47:23 rj
61 # added bootstrapping functionality for asn-useful.[ch].
62 #
63 # Revision 1.2 1994/09/01 00:08:49 rj
64 # gnu autoconf stuff added, DISTFILES, install phony target.
65 #
66 # Revision 1.1 1994/08/28 09:47:52 rj
67 # first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
68 #
69
70 include ../makehead
71 include ../makehead.static
72
73 TOP = ..
74
75 ASN1_SRC_DIR = $(TOP)/asn1specs
76 USEFUL_TYPES = $(ASN1_SRC_DIR)/asn-useful.asn1
77
78 CORE_DIR = core
79 BACKEND_DIR = back-ends
80 C_BACKEND_DIR = $(BACKEND_DIR)/c-gen
81 C++_BACKEND_DIR = $(BACKEND_DIR)/c++-gen
82 IDL_BACKEND_DIR = $(BACKEND_DIR)/idl-gen
83
84 ASN1_LIB_DIR = ../c-lib
85 ASN1_INC_DIR = $(ASN1_LIB_DIR)/inc
86 ASN1_BOOT_DIR = $(ASN1_LIB_DIR)/boot
87 ASN1_LIB = $(ASN1_LIB_DIR)/libasn1cCebuf.a
88
89 # some CFLAG options:
90 # -DYYDEBUG use for yacc/lex debug info
91 # -DDEBUG use to get general debug info
92
93 DEFS = -DCOMPILER -DUSE_NIBBLE_MEMORY=0 -DUSE_EXP_BUF
94 INCLUDES = -I$(CORE_DIR) -I$(ASN1_INC_DIR) -I$(ASN1_BOOT_DIR) -I$(BACKEND_DIR) -I$(TOP)
95 CPPFLAGS += $(DEFS) $(INCLUDES)
96
97 compilerFLAGS = $(DEFS) -I../compiler/$(CORE_DIR)
98
99 LFILES = \
100 $(CORE_DIR)/lex-asn1.l
101 LCFILES = \
102 $(CORE_DIR)/lex-asn1.c
103
104 YFILES = \
105 $(CORE_DIR)/parse-asn1.y
106 YHFILES = \
107 $(CORE_DIR)/parse-asn1.h
108 YCFILES = \
109 $(CORE_DIR)/parse-asn1.c
110
111 HFILES.d = \
112 $(CORE_DIR)/asn1module.h \
113 $(CORE_DIR)/define.h \
114 $(CORE_DIR)/dependency.h \
115 $(CORE_DIR)/do-macros.h \
116 $(CORE_DIR)/err-chk.h \
117 $(CORE_DIR)/exports.h \
118 $(CORE_DIR)/gen-tbls.h \
119 $(CORE_DIR)/lex-stuff.h \
120 $(CORE_DIR)/lib-types.h \
121 $(CORE_DIR)/link-types.h \
122 $(CORE_DIR)/link-values.h \
123 $(CORE_DIR)/mem.h \
124 $(CORE_DIR)/meta.h \
125 $(CORE_DIR)/normalize.h \
126 $(CORE_DIR)/oid.h \
127 $(CORE_DIR)/parser.h \
128 $(CORE_DIR)/print.h \
129 $(CORE_DIR)/recursive.h \
130 $(CORE_DIR)/snacc-util.h \
131 $(CORE_DIR)/tbl.h \
132 $(CORE_DIR)/val-parser.h \
133 \
134 $(BACKEND_DIR)/str-util.h \
135 $(BACKEND_DIR)/tag-util.h \
136 $(BACKEND_DIR)/cond.h \
137 \
138 $(C_BACKEND_DIR)/kwd.h \
139 $(C_BACKEND_DIR)/gen-any.h \
140 $(C_BACKEND_DIR)/gen-code.h \
141 $(C_BACKEND_DIR)/gen-dec.h \
142 $(C_BACKEND_DIR)/gen-enc.h \
143 $(C_BACKEND_DIR)/gen-free.h \
144 $(C_BACKEND_DIR)/gen-print.h \
145 $(C_BACKEND_DIR)/gen-type.h \
146 $(C_BACKEND_DIR)/gen-vals.h \
147 $(C_BACKEND_DIR)/rules.h \
148 $(C_BACKEND_DIR)/type-info.h \
149 $(C_BACKEND_DIR)/util.h \
150 \
151 $(C++_BACKEND_DIR)/kwd.h \
152 $(C++_BACKEND_DIR)/rules.h \
153 $(C++_BACKEND_DIR)/types.h \
154 $(C++_BACKEND_DIR)/gen-any.h \
155 $(C++_BACKEND_DIR)/gen-code.h \
156 $(C++_BACKEND_DIR)/gen-vals.h \
157 \
158 $(IDL_BACKEND_DIR)/rules.h \
159 $(IDL_BACKEND_DIR)/types.h \
160 $(IDL_BACKEND_DIR)/gen-any.h \
161 $(IDL_BACKEND_DIR)/gen-code.h \
162 $(IDL_BACKEND_DIR)/gen-vals.h
163
164 HFILES = \
165 $(HFILES.d) \
166 $(CORE_DIR)/tbl.h
167
168 CFILES.d = \
169 $(CORE_DIR)/define.c \
170 $(CORE_DIR)/dependency.c \
171 $(CORE_DIR)/do-macros.c \
172 $(CORE_DIR)/err-chk.c \
173 $(CORE_DIR)/exports.c \
174 $(CORE_DIR)/gen-tbls.c \
175 $(CORE_DIR)/lib-types.c \
176 $(CORE_DIR)/link-types.c \
177 $(CORE_DIR)/link-values.c \
178 $(CORE_DIR)/mem.c \
179 $(CORE_DIR)/meta.c \
180 $(CORE_DIR)/normalize.c \
181 $(CORE_DIR)/oid.c \
182 $(CORE_DIR)/print.c \
183 $(CORE_DIR)/recursive.c \
184 $(CORE_DIR)/snacc.c \
185 $(CORE_DIR)/snacc-util.c \
186 $(CORE_DIR)/val-parser.c \
187 \
188 $(BACKEND_DIR)/str-util.c \
189 $(BACKEND_DIR)/tag-util.c \
190 $(BACKEND_DIR)/cond.c \
191 \
192 $(C_BACKEND_DIR)/type-info.c \
193 $(C_BACKEND_DIR)/util.c \
194 $(C_BACKEND_DIR)/rules.c \
195 $(C_BACKEND_DIR)/gen-code.c \
196 $(C_BACKEND_DIR)/gen-type.c \
197 $(C_BACKEND_DIR)/gen-enc.c \
198 $(C_BACKEND_DIR)/gen-dec.c \
199 $(C_BACKEND_DIR)/gen-vals.c \
200 $(C_BACKEND_DIR)/gen-free.c \
201 $(C_BACKEND_DIR)/gen-print.c \
202 $(C_BACKEND_DIR)/gen-any.c \
203 $(C_BACKEND_DIR)/kwd.c \
204 \
205 $(C++_BACKEND_DIR)/kwd.c \
206 $(C++_BACKEND_DIR)/types.c \
207 $(C++_BACKEND_DIR)/rules.c \
208 $(C++_BACKEND_DIR)/gen-code.c \
209 $(C++_BACKEND_DIR)/gen-vals.c \
210 $(C++_BACKEND_DIR)/gen-any.c \
211 \
212 $(IDL_BACKEND_DIR)/rules.c \
213 $(IDL_BACKEND_DIR)/types.c \
214 $(IDL_BACKEND_DIR)/gen-any.c \
215 $(IDL_BACKEND_DIR)/gen-code.c \
216 $(IDL_BACKEND_DIR)/gen-vals.c
217
218 CFILES = \
219 $(CFILES.d) \
220 $(CORE_DIR)/tbl.c
221
222 OFILES = \
223 $(CORE_DIR)/parse-asn1.o \
224 $(CORE_DIR)/lex-asn1.o \
225 \
226 $(CORE_DIR)/link-types.o \
227 $(CORE_DIR)/exports.o \
228 $(CORE_DIR)/snacc-util.o \
229 $(CORE_DIR)/dependency.o \
230 $(CORE_DIR)/lib-types.o \
231 $(CORE_DIR)/mem.o \
232 $(CORE_DIR)/meta.o \
233 $(CORE_DIR)/print.o \
234 $(CORE_DIR)/do-macros.o \
235 $(CORE_DIR)/oid.o \
236 $(CORE_DIR)/link-values.o \
237 $(CORE_DIR)/normalize.o \
238 $(CORE_DIR)/val-parser.o \
239 $(CORE_DIR)/err-chk.o \
240 $(CORE_DIR)/define.o \
241 $(CORE_DIR)/recursive.o \
242 $(CORE_DIR)/snacc.o \
243 $(CORE_DIR)/tbl.o \
244 $(CORE_DIR)/gen-tbls.o \
245 \
246 $(BACKEND_DIR)/str-util.o \
247 $(BACKEND_DIR)/tag-util.o \
248 $(BACKEND_DIR)/cond.o \
249 \
250 $(C_BACKEND_DIR)/type-info.o \
251 $(C_BACKEND_DIR)/util.o \
252 $(C_BACKEND_DIR)/rules.o \
253 $(C_BACKEND_DIR)/gen-code.o \
254 $(C_BACKEND_DIR)/gen-type.o \
255 $(C_BACKEND_DIR)/gen-enc.o \
256 $(C_BACKEND_DIR)/gen-dec.o \
257 $(C_BACKEND_DIR)/gen-vals.o \
258 $(C_BACKEND_DIR)/gen-free.o \
259 $(C_BACKEND_DIR)/gen-print.o \
260 $(C_BACKEND_DIR)/gen-any.o \
261 $(C_BACKEND_DIR)/kwd.o \
262 \
263 $(C++_BACKEND_DIR)/kwd.o \
264 $(C++_BACKEND_DIR)/types.o \
265 $(C++_BACKEND_DIR)/rules.o \
266 $(C++_BACKEND_DIR)/gen-code.o \
267 $(C++_BACKEND_DIR)/gen-vals.o \
268 $(C++_BACKEND_DIR)/gen-any.o \
269 \
270 $(IDL_BACKEND_DIR)/rules.o \
271 $(IDL_BACKEND_DIR)/types.o \
272 $(IDL_BACKEND_DIR)/gen-any.o \
273 $(IDL_BACKEND_DIR)/gen-code.o \
274 $(IDL_BACKEND_DIR)/gen-vals.o
275
276 DISTFILES = \
277 README \
278 makefile \
279 $(HFILES.d) \
280 $(LFILES) \
281 $(YFILES) \
282 $(CFILES.d) \
283 boot/tbl.h \
284 boot/tbl.c
285
286 # end of definitions
287 # ----------------------------------------------------------------------
288 # rules start here
289
290 default:: all
291
292 all:: snacc
293
294 snacc: $(OFILES) $(ASN1_LIB)
295 $(REASON)
296 $(CC) $(LDFLAGS) -o snacc $(OFILES) $(ASN1_LIB) $(LEXLIB) $(LIBS)
297
298 # compiling with the generated file currently doesn't work!
299 # otherwise, one could use the bootstrapping mechanism like for asn-useful.[ch] and tbl.[ch], below
300 # $(CORE_DIR)/asn1module.h: $(ASN1_SRC_DIR)/asn1module.asn1
301 # ./snacc -t -u $(USEFUL_TYPES) $(ASN1_SRC_DIR)/asn1module.asn1
302 # # this file is empty, anyway:
303 # $(RM) asn1module.c
304 # mv asn1module.h $(CORE_DIR)
305
306 $(CORE_DIR)/tbl.h \
307 $(CORE_DIR)/tbl.c::
308 $(RM) $(CORE_DIR)/tbl.h $(CORE_DIR)/tbl.c
309 if [ -f snacc ]; then\
310 $(MAKE) stamp-tbl;\
311 else\
312 $(RM) tbl.h tbl.c;\
313 ln boot/tbl.h boot/tbl.c .;\
314 fi
315 ln tbl.h $(CORE_DIR)
316 ln tbl.c $(CORE_DIR)
317
318 # `../compiler/snacc' instead of `snacc' or `./snacc' to trick make(1) into believing that both are different files to avoid infinitre recursion:
319 stamp-tbl: ../compiler/snacc $(USEFUL_TYPES) $(ASN1_SRC_DIR)/tbl.asn1 makefile
320 $(REASON)
321 -mv tbl.h tbl.h.prev
322 -mv tbl.c tbl.c.prev
323 ./snacc -c -t -e -u $(USEFUL_TYPES) $(ASN1_SRC_DIR)/tbl.asn1
324 # the dates in the two files will differ, so the files really differ if diff prints more than 4 lines of output:
325 @-if [ -f tbl.h.prev ]; then\
326 if [ `diff tbl.h.prev tbl.h | wc -l` -gt 4 ]; then\
327 $(RM) tbl.h.prev;\
328 else\
329 echo "tbl.h hasn't changed";\
330 mv tbl.h.prev tbl.h;\
331 fi;\
332 fi
333 @-if [ -f tbl.c.prev ]; then\
334 if [ `diff tbl.c.prev tbl.c | wc -l` -gt 4 ]; then\
335 $(RM) tbl.c.prev;\
336 else\
337 echo "tbl.c hasn't changed";\
338 mv tbl.c.prev tbl.c;\
339 fi;\
340 fi
341 date > $@
342
343 boot/tbl.h \
344 boot/tbl.c: stamp-tbl
345 $(RM) boot/tbl.h boot/tbl.c
346 cp -p tbl.h tbl.c boot
347
348 # the default rules work for .y.c, but often lack the .h
349 $(CORE_DIR)/parse-asn1.h \
350 $(CORE_DIR)/parse-asn1.c: $(CORE_DIR)/parse-asn1.y
351 $(REASON)
352 @echo "expect 61 shift/reduce and 2 reduce/reduce conflicts"
353 $(YACC) -d $(CORE_DIR)/parse-asn1.y
354 mv y.tab.h $(CORE_DIR)/parse-asn1.h
355 mv y.tab.c $(CORE_DIR)/parse-asn1.c
356
357 $(ASN1_LIB)::
358 # cd $(ASN1_LIB_DIR) && $(MAKE) Cebuf-lib compilerFLAGS="$(compilerFLAGS)"
359 # since different make versions handle the above line different, we use the more portable passing thru the environment:
360 cd $(ASN1_LIB_DIR) && compilerFLAGS="$(compilerFLAGS)" $(MAKE) Cebuf-lib
361
362 install-sh:
363 ln $(TOP)/install-sh $@
364
365 install:: snacc install-sh $(bindir)
366
367 $(bindir):
368 $(TOP)/mkinstalldirs $@
369
370 install::
371 $(INSTALL_PROGRAM) snacc $(bindir)/
372
373 clean::
374 $(RM) $(OFILES) $(LCFILES) $(YHFILES) $(YCFILES)
375 $(RM) *.o y.tab.c y.tab.h lex.yy.c y.output .emacs* *~ *.orig *.prev *.bak yacc.tmp yacc.acts yacc.debug
376 $(RM) stamp-tbl tbl.h tbl.h.prev tbl.c tbl.c.prev
377
378 clobber::
379 $(RM) snacc
380 $(RM) install-sh
381
382 depend:: $(CORE_DIR)/tbl.h $(CORE_DIR)/tbl.c
383
384 gen-distfiles:: snacc
385
386 include ../maketail