s4:heimdal: import lorikeet-heimdal-202201172009 (commit 5a0b45cd723628b3690ea848548b...
[samba.git] / source4 / heimdal / lib / asn1 / NTMakefile
1 ########################################################################
2 #
3 # Copyright (c) 2009, Secure Endpoints Inc.
4 # All rights reserved.
5
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9
10 # - Redistributions of source code must retain the above copyright
11 #   notice, this list of conditions and the following disclaimer.
12
13 # - Redistributions in binary form must reproduce the above copyright
14 #   notice, this list of conditions and the following disclaimer in
15 #   the documentation and/or other materials provided with the
16 #   distribution.
17
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
30
31
32 RELDIR=lib\asn1
33
34 intcflags=-I$(SRCDIR) -I$(OBJ) -DROKEN_RENAME -DASN1_IOS_SUPPORTED
35
36 !include ../../windows/NTMakefile.w32
37
38 gen_files_krb5          = $(OBJ)\asn1_krb5_asn1.x
39
40 gen_files_cms           = $(OBJ)\asn1_cms_asn1.x
41
42 gen_files_crmf          = $(OBJ)\asn1_crmf_asn1.x
43
44 gen_files_rfc2459       = $(OBJ)\asn1_rfc2459_asn1.x
45
46 gen_files_rfc4108       = $(OBJ)\asn1_rfc4108_asn1.x
47
48 gen_files_ocsp          = $(OBJ)\asn1_ocsp_asn1.x
49
50 gen_files_pkinit        = $(OBJ)\asn1_pkinit_asn1.x
51
52 gen_files_pkcs12        = $(OBJ)\asn1_pkcs12_asn1.x
53
54 gen_files_pkcs8         = $(OBJ)\asn1_pkcs8_asn1.x
55
56 gen_files_pkcs9         = $(OBJ)\asn1_pkcs9_asn1.x
57
58 gen_files_pkcs10        = $(OBJ)\asn1_pkcs10_asn1.x
59
60 gen_files_test          = $(OBJ)\asn1_test_asn1.x
61
62 gen_files_test_template = $(OBJ)\asn1_test_template_asn1.x
63
64 gen_files_digest        = $(OBJ)\asn1_digest_asn1.x
65
66 gen_files_kx509         = $(OBJ)\asn1_kx509_asn1.x
67
68 gen_files_x690sample    = $(OBJ)\asn1_x690sample_asn1.x
69
70 ASN1_BINARIES =                                             \
71         $(LIBEXECDIR)\asn1_compile.exe
72
73 $(BINDIR)\asn1_compile.exe:                                 \
74         $(OBJ)\asn1parse.obj                                \
75         $(OBJ)\gen.obj                                      \
76         $(OBJ)\gen_copy.obj                                 \
77         $(OBJ)\gen_decode.obj                               \
78         $(OBJ)\gen_encode.obj                               \
79         $(OBJ)\gen_print.obj                                \
80         $(OBJ)\gen_free.obj                                 \
81         $(OBJ)\gen_glue.obj                                 \
82         $(OBJ)\gen_length.obj                               \
83         $(OBJ)\gen_seq.obj                                  \
84         $(OBJ)\gen_template.obj                             \
85         $(OBJ)\hash.obj                                     \
86         $(OBJ)\lex.obj                                      \
87         $(OBJ)\main.obj                                     \
88         $(OBJ)\symbol.obj                                   \
89         $(OBJ)\asn1_compile-version.res
90         $(EXECONLINK) $(LIBROKEN) $(LIBVERS)
91         $(EXEPREP_NOHEIM)
92
93 $(OBJ)\lex.c: lex.l $(OBJ)\asn1parse.h
94         $(LEX) -o$@ lex.l
95
96 $(OBJ)\lex.obj: $(OBJ)\lex.c
97         $(C2OBJ) -DYY_NO_UNISTD_H
98
99 $(OBJ)\asn1parse.c $(OBJ)\asn1parse.h: asn1parse.y
100         $(YACC) -o $(OBJ)\asn1parse.c --defines=$(OBJ)\asn1parse.h $**
101
102 $(OBJ)\asn1_err.c $(OBJ)\asn1_err.h: asn1_err.et
103         cd $(OBJ)
104         $(BINDIR)\compile_et.exe $(SRCDIR)\asn1_err.et
105         cd $(SRCDIR)
106
107 $(BINDIR)\asn1_print.exe: $(OBJ)\asn1_print.obj $(LIBHEIMDAL)
108         $(EXECONLINK) $(LIBVERS) $(LIBROKEN) $(LIBCOMERR)
109         $(EXEPREP)
110
111 $(BINDIR)\asn1_gen.exe: $(OBJ)\asn1_gen.obj $(LIBHEIMDAL)
112         $(EXECONLINK) $(LIBVERS) $(LIBROKEN)
113         $(EXEPREP)
114
115 LIBASN1_OBJS=   \
116         $(OBJ)\der.obj                          \
117         $(OBJ)\der_get.obj                      \
118         $(OBJ)\der_put.obj                      \
119         $(OBJ)\der_free.obj                     \
120         $(OBJ)\der_print.obj                    \
121         $(OBJ)\der_length.obj                   \
122         $(OBJ)\der_copy.obj                     \
123         $(OBJ)\der_cmp.obj                      \
124         $(OBJ)\der_format.obj                   \
125         $(OBJ)\template.obj                     \
126         $(OBJ)\extra.obj                        \
127         $(OBJ)\timegm.obj                       \
128         $(gen_files_rfc2459:.x=.obj)            \
129         $(gen_files_rfc4108:.x=.obj)            \
130         $(gen_files_cms:.x=.obj)                \
131         $(gen_files_krb5:.x=.obj)               \
132         $(gen_files_ocsp:.x=.obj)               \
133         $(gen_files_pkinit:.x=.obj)             \
134         $(gen_files_pkcs8:.x=.obj)              \
135         $(gen_files_pkcs9:.x=.obj)              \
136         $(gen_files_pkcs10:.x=.obj)             \
137         $(gen_files_pkcs12:.x=.obj)             \
138         $(gen_files_digest:.x=.obj)             \
139         $(gen_files_kx509:.x=.obj)              \
140         $(gen_files_x690sample:.x=.obj)         \
141         $(OBJ)\asn1_err.obj
142
143 $(OBJ)\oid_resolution.obj: $(LIBASN1_OBJS)
144
145 LIBASN1_OBJS2=  $(LIBASN1_OBJS) $(OBJ)\oid_resolution.obj
146
147 $(LIBASN1): $(LIBASN1_OBJS2)
148         $(LIBCON_C) -out:$@ @<<
149 $(**: =
150 )
151 <<
152
153 clean::
154         -$(RM) $(LIBASN1)
155
156 #
157 # Generate list of exports
158 #
159 # This target is only used during development to generate a list of
160 # symbols that are exported from all the object files in LIBASN1_OBJS.
161 #
162 exports-list.txt: $(LIBASN1_OBJS)
163         $(PERL) ..\..\cf\w32-list-externs-from-objs.pl -q -u @<< > $@
164 $(**: =
165 )
166 <<
167
168 $(gen_files_krb5:.x=.c)     : $$(@R).x
169
170 $(gen_files_ocsp:.x=.c)   : $$(@R).x
171
172 $(gen_files_pkinit:.x=.c)   : $$(@R).x
173
174 $(gen_files_pkcs8:.x=.c)    : $$(@R).x
175
176 $(gen_files_pkcs9:.x=.c)    : $$(@R).x
177
178 $(gen_files_pkcs10:.x=.c)   : $$(@R).x
179
180 $(gen_files_pkcs12:.x=.c)   : $$(@R).x
181
182 $(gen_files_digest:.x=.c)   : $$(@R).x
183
184 $(gen_files_kx509:.x=.c)    : $$(@R).x
185
186 $(gen_files_rfc2459:.x=.c)  : $$(@R).x
187
188 $(gen_files_rfc4108:.x=.c)  : $$(@R).x
189
190 $(gen_files_cms:.x=.c)      : $$(@R).x
191
192 $(gen_files_crmf:.x=.c)     : $$(@R).x
193
194 $(gen_files_x690sample:.x=.c)       : $$(@R).x
195
196 $(gen_files_test:.x=.c)     : $$(@R).x
197
198 $(gen_files_test_template:.x=.c)            : $$(@R).x
199
200 $(gen_files_krb5) $(OBJ)\krb5_asn1.hx: $(BINDIR)\asn1_compile.exe krb5.asn1 krb5.opt
201         cd $(OBJ)
202         $(BINDIR)\asn1_compile.exe \
203                 --template      \
204                 --one-code-file \
205                 --decorate="Principal:PrincipalNameAttrs:nameattrs?" \
206                 --option-file=$(SRCDIR)\krb5.opt \
207                 $(SRCDIR)\krb5.asn1 krb5_asn1 \
208         || ($(RM) $(OBJ)\krb5_asn1.h ; exit /b 1)
209         cd $(SRCDIR)
210
211 $(gen_files_ocsp) $(OBJ)\ocsp_asn1.hx: $(BINDIR)\asn1_compile.exe ocsp.asn1
212         cd $(OBJ)
213         $(BINDIR)\asn1_compile.exe \
214                 --template      \
215                 --one-code-file \
216                 --option-file=$(SRCDIR)\ocsp.opt \
217                 $(SRCDIR)\ocsp.asn1 \
218                 ocsp_asn1 \
219         || ($(RM) $(OBJ)\ocsp_asn1.h ; exit /b 1)
220         cd $(SRCDIR)
221
222 $(gen_files_pkinit) $(OBJ)\pkinit_asn1.hx: $(BINDIR)\asn1_compile.exe pkinit.asn1
223         cd $(OBJ)
224         $(BINDIR)\asn1_compile.exe --template --one-code-file $(SRCDIR)\pkinit.asn1 pkinit_asn1 \
225         || ($(RM) $(OBJ)\pkinit_asn1.h ; exit /b 1)
226         cd $(SRCDIR)
227
228 $(gen_files_pkcs8) $(OBJ)\pkcs8_asn1.hx: $(BINDIR)\asn1_compile.exe pkcs8.asn1
229         cd $(OBJ)
230         $(BINDIR)\asn1_compile.exe --template --one-code-file $(SRCDIR)\pkcs8.asn1 pkcs8_asn1 \
231         || ($(RM) $(OBJ)\pkcs8_asn1.h ; exit /b 1)
232         cd $(SRCDIR)
233
234 $(gen_files_pkcs9) $(OBJ)\pkcs9_asn1.hx: $(BINDIR)\asn1_compile.exe pkcs9.asn1
235         cd $(OBJ)
236         $(BINDIR)\asn1_compile.exe --template --one-code-file $(SRCDIR)\pkcs9.asn1 pkcs9_asn1 \
237         || ($(RM) $(OBJ)\pkcs9_asn1.h ; exit /b 1)
238         cd $(SRCDIR)
239
240 $(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.hx: $(BINDIR)\asn1_compile.exe pkcs10.asn1
241         cd $(OBJ)
242         $(BINDIR)\asn1_compile.exe \
243                 --template      \
244                 --one-code-file \
245                 --option-file=$(SRCDIR)\pkcs10.opt \
246                 $(SRCDIR)\pkcs10.asn1 \
247                 pkcs10_asn1 \
248         || ($(RM) $(OBJ)\pkcs10_asn1.h ; exit /b 1)
249         cd $(SRCDIR)
250
251 $(gen_files_pkcs12) $(OBJ)\pkcs12_asn1.hx: $(BINDIR)\asn1_compile.exe pkcs12.asn1
252         cd $(OBJ)
253         $(BINDIR)\asn1_compile.exe --template --one-code-file $(SRCDIR)\pkcs12.asn1 pkcs12_asn1 \
254         || ($(RM) $(OBJ)\pkcs12_asn1.h ; exit /b 1)
255         cd $(SRCDIR)
256
257 $(gen_files_digest) $(OBJ)\digest_asn1.hx: $(BINDIR)\asn1_compile.exe digest.asn1
258         cd $(OBJ)
259         $(BINDIR)\asn1_compile.exe --template --one-code-file $(SRCDIR)\digest.asn1 digest_asn1 \
260         || ($(RM) $(OBJ)\digest_asn1.h ; exit /b 1)
261         cd $(SRCDIR)
262
263 $(gen_files_kx509) $(OBJ)\kx509_asn1.hx: $(BINDIR)\asn1_compile.exe kx509.asn1
264         cd $(OBJ)
265         $(BINDIR)\asn1_compile.exe --template --one-code-file $(SRCDIR)\kx509.asn1 kx509_asn1 \
266         || ($(RM) $(OBJ)\kx509_asn1.h ; exit /b 1)
267         cd $(SRCDIR)
268
269 $(gen_files_rfc2459) $(OBJ)\rfc2459_asn1.hx: $(BINDIR)\asn1_compile.exe rfc2459.asn1
270         cd $(OBJ)
271         $(BINDIR)\asn1_compile.exe \
272                 --template      \
273                 --one-code-file \
274                 --option-file=$(SRCDIR)\rfc2459.opt \
275                 $(SRCDIR)\rfc2459.asn1 rfc2459_asn1 \
276         || ($(RM) $(OBJ)\rfc2459_asn1.h ; exit /b 1)
277         cd $(SRCDIR)
278
279 $(gen_files_rfc4108) $(OBJ)\rfc4108_asn1.hx: $(BINDIR)\asn1_compile.exe rfc4108.asn1
280         cd $(OBJ)
281         $(BINDIR)\asn1_compile.exe \
282                 --template      \
283                 --one-code-file \
284                 $(SRCDIR)\rfc4108.asn1 rfc4108_asn1 \
285         || ($(RM) $(OBJ)\rfc4108_asn1.h ; exit /b 1)
286         cd $(SRCDIR)
287
288 $(gen_files_cms) $(OBJ)\cms_asn1.hx: $(BINDIR)\asn1_compile.exe cms.asn1 cms.opt
289         cd $(OBJ)
290         $(BINDIR)\asn1_compile.exe \
291                 --template      \
292                 --one-code-file --option-file=$(SRCDIR)\cms.opt \
293                 $(SRCDIR)\cms.asn1 cms_asn1 \
294         || ($(RM) $(OBJ)\cms_asn1.h ; exit /b 1)
295         cd $(SRCDIR)
296
297 $(gen_files_crmf) $(OBJ)\crmf_asn1.hx: $(BINDIR)\asn1_compile.exe crmf.asn1 crmf.opt
298         cd $(OBJ)
299         $(BINDIR)\asn1_compile.exe \
300                 --template      \
301                 --one-code-file --option-file=$(SRCDIR)\crmf.opt \
302                 $(SRCDIR)\crmf.asn1 crmf_asn1 \
303         || ($(RM) $(OBJ)\crmf_asn1.h ; exit /b 1)
304         cd $(SRCDIR)
305
306 $(gen_files_x690sample) $(OBJ)\x690sample_asn1.hx: $(BINDIR)\asn1_compile.exe x690sample.asn1
307         cd $(OBJ)
308         $(BINDIR)\asn1_compile.exe \
309                 --template      \
310                 --one-code-file \
311                 $(SRCDIR)\x690sample.asn1 x690sample_asn1 \
312         || ($(RM) $(OBJ)\x690sample_asn1.h ; exit /b 1)
313         cd $(SRCDIR)
314
315 $(gen_files_test) $(OBJ)\test_asn1.hx: $(BINDIR)\asn1_compile.exe test.asn1
316         cd $(OBJ)
317         $(BINDIR)\asn1_compile.exe \
318                 --template      \
319                 --decorate="TESTDecorated:TESTuint32:version2?" \
320                 --one-code-file --sequence=TESTSeqOf \
321                 $(SRCDIR)\test.asn1 test_asn1 \
322         || ($(RM) $(OBJ)\test_asn1.h ; exit /b 1)
323         cd $(SRCDIR)
324
325 $(gen_files_test_template) $(OBJ)\test_template_asn1.hx: $(BINDIR)\asn1_compile.exe test.asn1
326         cd $(OBJ)
327         $(BINDIR)\asn1_compile.exe \
328                 --template      \
329                 --decorate="TESTDecorated:TESTuint32:version2?" \
330                 --one-code-file \
331                 --sequence=TESTSeqOf \
332                 $(SRCDIR)\test.asn1 test_template_asn1 \
333         || ($(RM) $(OBJ)\test_template_asn1.h ; exit /b 1)
334         cd $(SRCDIR)
335
336 INCFILES=                           \
337         $(INCDIR)\der.h             \
338         $(INCDIR)\heim_asn1.h       \
339         $(INCDIR)\der-protos.h      \
340         $(INCDIR)\der-private.h     \
341         $(INCDIR)\asn1-common.h     \
342         $(INCDIR)\asn1-template.h   \
343         $(OBJ)\asn1_err.h
344
345 $(INCDIR)\der-protos.h: $(OBJ)\der-protos.h
346
347 GENINCFILES=                                    \
348         $(INCDIR)\asn1_err.h                    \
349         $(INCDIR)\cms_asn1.h                    \
350         $(INCDIR)\crmf_asn1.h                   \
351         $(INCDIR)\digest_asn1.h                 \
352         $(INCDIR)\krb5_asn1.h                   \
353         $(INCDIR)\kx509_asn1.h                  \
354         $(INCDIR)\ocsp_asn1.h                   \
355         $(INCDIR)\pkcs12_asn1.h                 \
356         $(INCDIR)\pkcs8_asn1.h                  \
357         $(INCDIR)\pkcs9_asn1.h                  \
358         $(INCDIR)\pkcs10_asn1.h                 \
359         $(INCDIR)\pkinit_asn1.h                 \
360         $(INCDIR)\rfc2459_asn1.h                \
361         $(INCDIR)\rfc4108_asn1.h                \
362         $(INCDIR)\x690sample_asn1.h             \
363         $(OBJ)\krb5_asn1-priv.h                 \
364         $(OBJ)\ocsp_asn1-priv.h                 \
365         $(OBJ)\pkinit_asn1-priv.h               \
366         $(OBJ)\cms_asn1-priv.h                  \
367         $(OBJ)\crmf_asn1-priv.h                 \
368         $(OBJ)\rfc2459_asn1-priv.h              \
369         $(OBJ)\rfc4108_asn1-priv.h              \
370         $(OBJ)\x690sample_asn1-priv.h           \
371         $(OBJ)\pkcs8_asn1-priv.h                \
372         $(OBJ)\pkcs9_asn1-priv.h                \
373         $(OBJ)\pkcs10_asn1-priv.h               \
374         $(OBJ)\pkcs12_asn1-priv.h               \
375         $(OBJ)\digest_asn1-priv.h               \
376         $(OBJ)\kx509_asn1-priv.h                \
377         $(OBJ)\test_template_asn1.h             \
378         $(OBJ)\test_template_asn1-priv.h        \
379         $(OBJ)\test_asn1.h                      \
380         $(OBJ)\test_asn1-priv.h
381
382 libasn1_base_SOURCES=   \
383         der_locl.h      \
384         der.c           \
385         der.h           \
386         der_get.c       \
387         der_put.c       \
388         der_free.c      \
389         der_print.c     \
390         der_length.c    \
391         der_copy.c      \
392         der_cmp.c       \
393         der_format.c    \
394         template.c      \
395         heim_asn1.h     \
396         extra.c         \
397         timegm.c
398
399 libasn1_SOURCES=        \
400         oid_resolution.c
401
402 $(OBJ)\der-protos.h: $(libasn1_SOURCES)
403         $(PERL) ..\..\cf\make-proto.pl -q -P remove -o $(OBJ)\der-protos.h $(libasn1_base_SOURCES) $(libasn1_SOURCES) || $(RM) $(OBJ)\der-protos.h
404
405 $(OBJ)\der-private.h: $(libasn1_SOURCES)
406         $(PERL) ..\..\cf\make-proto.pl -q -P remove -p $(OBJ)\der-private.h $(libasn1_base_SOURCES) $(libasn1_SOURCES) || $(RM) $(OBJ)\der-private.h
407
408 clean::
409         -$(RM) $(INCDIR)\der-protos.h
410
411 all:: $(INCFILES) $(GENINCFILES) $(ASN1_BINARIES) $(LIBASN1)
412
413 all-tools:: $(LIBEXECDIR)\asn1_print.exe $(BINDIR)\asn1_gen.exe
414
415 clean::
416         -$(RM) $(INCFILES)
417         -$(RM) $(GENINCFILES)
418         -$(RM) $(ASN1_BINARIES:.exe=.*)
419         -$(RM) $(LIBASN1)
420         -$(RM) $(LIBEXECDIR)\asn1_print.*
421         -$(RM) $(LIBEXECDIR)\asn1_gen.*
422
423 TEST_BINARIES=\
424         $(OBJ)\check-der.exe            \
425         $(OBJ)\check-gen-template.exe   \
426         $(OBJ)\check-timegm.exe         \
427         $(OBJ)\check-ber.exe            \
428         $(OBJ)\check-template.exe
429
430 test-binaries: $(TEST_BINARIES)
431
432 test-run:
433         cd $(OBJ)
434         -check-der.exe
435         -check-gen-template.exe
436         -check-timegm.exe
437         -check-ber.exe
438         -check-template.exe
439         cd $(SRC)
440
441 test:: test-binaries test-run
442
443 clean::
444         -$(RM) $(TEST_BINARIES:.exe=*)
445
446 $(OBJ)\check-ber.exe: $(OBJ)\check-ber.obj \
447                 $(LIBHEIMDAL) $(LIBROKEN)
448         $(EXECONLINK)
449         $(EXEPREP_NODIST)
450
451 $(OBJ)\check-der.exe: $(OBJ)\check-der.obj $(OBJ)\check-common.obj \
452                 $(LIBHEIMDAL) $(LIBROKEN)
453         $(EXECONLINK)
454         $(EXEPREP_NODIST)
455
456 $(OBJ)\check-gen-template.exe: $(OBJ)\check-gen.obj $(OBJ)\check-common.obj \
457                 $(LIBHEIMDAL) $(LIBROKEN) $(gen_files_test_template:.x=.obj)
458         $(EXECONLINK)
459         $(EXEPREP_NODIST)
460
461 $(OBJ)\check-timegm.exe: $(OBJ)\check-timegm.obj \
462                 $(LIBHEIMDAL) $(LIBROKEN)
463         $(EXECONLINK)
464         $(EXEPREP_NODIST)
465
466 $(OBJ)\check-template.exe: $(OBJ)\check-template.obj $(OBJ)\check-common.obj \
467                 $(LIBHEIMDAL) $(LIBROKEN) $(gen_files_test:.x=.obj)
468         $(EXECONLINK)
469         $(EXEPREP_NODIST)