Windows: Build hxtool with the correct options
[abartlet/lorikeet-heimdal.git/.git] / lib / hx509 / 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\hx509
33 intcflags=-DASN1_LIB
34
35 !include ../../windows/NTMakefile.w32
36
37 gen_files_ocsp =                        \
38         $(OBJ)\asn1_OCSPBasicOCSPResponse.x     \
39         $(OBJ)\asn1_OCSPCertID.x                \
40         $(OBJ)\asn1_OCSPCertStatus.x            \
41         $(OBJ)\asn1_OCSPInnerRequest.x          \
42         $(OBJ)\asn1_OCSPKeyHash.x               \
43         $(OBJ)\asn1_OCSPRequest.x               \
44         $(OBJ)\asn1_OCSPResponderID.x           \
45         $(OBJ)\asn1_OCSPResponse.x              \
46         $(OBJ)\asn1_OCSPResponseBytes.x \
47         $(OBJ)\asn1_OCSPResponseData.x          \
48         $(OBJ)\asn1_OCSPResponseStatus.x        \
49         $(OBJ)\asn1_OCSPSignature.x             \
50         $(OBJ)\asn1_OCSPSingleResponse.x        \
51         $(OBJ)\asn1_OCSPTBSRequest.x            \
52         $(OBJ)\asn1_OCSPVersion.x               \
53         $(OBJ)\asn1_id_pkix_ocsp.x              \
54         $(OBJ)\asn1_id_pkix_ocsp_basic.x        \
55         $(OBJ)\asn1_id_pkix_ocsp_nonce.x
56
57 gen_files_pkcs10 =                      \
58         $(OBJ)\asn1_CertificationRequestInfo.x  \
59         $(OBJ)\asn1_CertificationRequest.x
60
61 gen_files_crmf =                        \
62         $(OBJ)\asn1_CRMFRDNSequence.x           \
63         $(OBJ)\asn1_CertReqMessages.x           \
64         $(OBJ)\asn1_CertReqMsg.x                \
65         $(OBJ)\asn1_CertRequest.x               \
66         $(OBJ)\asn1_CertTemplate.x              \
67         $(OBJ)\asn1_Controls.x                  \
68         $(OBJ)\asn1_PBMParameter.x              \
69         $(OBJ)\asn1_PKMACValue.x                \
70         $(OBJ)\asn1_POPOPrivKey.x               \
71         $(OBJ)\asn1_POPOSigningKey.x            \
72         $(OBJ)\asn1_POPOSigningKeyInput.x       \
73         $(OBJ)\asn1_ProofOfPossession.x \
74         $(OBJ)\asn1_SubsequentMessage.x 
75
76 libhx509_la_OBJS = \
77         $(OBJ)\ca.obj \
78         $(OBJ)\cert.obj \
79         $(OBJ)\cms.obj \
80         $(OBJ)\collector.obj \
81         $(OBJ)\crypto.obj \
82         $(OBJ)\error.obj \
83         $(OBJ)\env.obj \
84         $(OBJ)\file.obj \
85         $(OBJ)\hx509_err.obj    \
86         $(OBJ)\sel.obj \
87         $(OBJ)\sel-gram.obj     \
88         $(OBJ)\sel-lex.obj      \
89         $(OBJ)\keyset.obj \
90         $(OBJ)\ks_dir.obj \
91         $(OBJ)\ks_file.obj \
92         $(OBJ)\ks_mem.obj \
93         $(OBJ)\ks_null.obj \
94         $(OBJ)\ks_p11.obj \
95         $(OBJ)\ks_p12.obj \
96         $(OBJ)\ks_keychain.obj \
97         $(OBJ)\lock.obj \
98         $(OBJ)\name.obj \
99         $(OBJ)\peer.obj \
100         $(OBJ)\print.obj \
101         $(OBJ)\softp11.obj \
102         $(OBJ)\req.obj \
103         $(OBJ)\revoke.obj       \
104         $(gen_files_ocsp:.x=.obj)       \
105         $(gen_files_pkcs10:.x=.obj)
106
107 $(LIBHX509): $(libhx509_la_OBJS)
108         $(LIBCON)
109
110 dist_libhx509_la_SOURCES = \
111         $(SRCDIR)\ca.c \
112         $(SRCDIR)\cert.c \
113         $(SRCDIR)\cms.c \
114         $(SRCDIR)\collector.c \
115         $(SRCDIR)\crypto.c \
116         $(SRCDIR)\doxygen.c \
117         $(SRCDIR)\error.c \
118         $(SRCDIR)\env.c \
119         $(SRCDIR)\file.c \
120         $(SRCDIR)\hx509.h \
121         $(SRCDIR)\hx_locl.h \
122         $(SRCDIR)\sel.c \
123         $(SRCDIR)\sel.h \
124         $(SRCDIR)\sel-gram.y \
125         $(SRCDIR)\sel-lex.l \
126         $(SRCDIR)\keyset.c \
127         $(SRCDIR)\ks_dir.c \
128         $(SRCDIR)\ks_file.c \
129         $(SRCDIR)\ks_mem.c \
130         $(SRCDIR)\ks_null.c \
131         $(SRCDIR)\ks_p11.c \
132         $(SRCDIR)\ks_p12.c \
133         $(SRCDIR)\ks_keychain.c \
134         $(SRCDIR)\lock.c \
135         $(SRCDIR)\name.c \
136         $(SRCDIR)\peer.c \
137         $(SRCDIR)\print.c \
138         $(SRCDIR)\softp11.c \
139         $(SRCDIR)\ref\pkcs11.h \
140         $(SRCDIR)\req.c \
141         $(SRCDIR)\revoke.c
142
143 AUXCFLAGS=$(AUXCFLAGS) -I$(SRCDIR)\ref -I$(OBJ)
144
145 asn1_compile=$(BINDIR)\asn1_compile.exe
146
147 $(gen_files_ocsp:.x=.c): $$(@R).x
148
149 $(gen_files_pkcs10:.x=.c): $$(@R).x
150
151 $(gen_files_crmf:.x=.c): $$(@R).x
152
153 $(gen_files_ocsp) $(OBJ)\ocsp_asn1.hx: $(asn1_compile) ocsp.asn1
154         cd $(OBJ)
155         $(asn1_compile) \
156                 --preserve-binary=OCSPTBSRequest \
157                 --preserve-binary=OCSPResponseData \
158                 $(SRCDIR)\ocsp.asn1 ocsp_asn1 \
159         || ( $(RM) -f $(gen_files_ocsp) $(OBJ)\ocsp_asn1.h ; exit /b 1 )
160         cd $(SRCDIR)
161
162 $(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.hx: $(asn1_compile) pkcs10.asn1
163         cd $(OBJ)
164         $(asn1_compile) \
165                 --preserve-binary=CertificationRequestInfo \
166                 $(SRCDIR)\pkcs10.asn1 pkcs10_asn1 \
167         || ( $(RM) -f $(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.h ; exit /b 1 )
168         cd $(SRCDIR)
169
170 $(gen_files_crmf) $(OBJ)\crmf_asn1.hx: $(asn1_compile) crmf.asn1
171         cd $(OBJ)
172         $(asn1_compile) $(SRCDIR)\crmf.asn1 crmf_asn1 \
173         || ( $(RM) -f $(gen_files_crmf) $(OBJ)\crmf_asn1.h ; exit /b 1 )
174         cd $(SRCDIR)
175
176 INCFILES=                           \
177         $(INCDIR)\hx509.h           \
178         $(INCDIR)\hx509-protos.h    \
179         $(INCDIR)\hx509-private.h   \
180         $(INCDIR)\hx509_err.h       \
181         $(INCDIR)\ocsp_asn1.h       \
182         $(INCDIR)\pkcs10_asn1.h     \
183         $(INCDIR)\crmf_asn1.h       \
184         $(OBJ)\ocsp_asn1-priv.h     \
185         $(OBJ)\pkcs10_asn1-priv.h   \
186         $(OBJ)\crmf_asn1-priv.h
187
188 hxtool.c: $(OBJ)\hxtool-commands.h
189
190 SLC=$(BINDIR)\slc.exe
191
192 $(OBJ)\hxtool-commands.c $(OBJ)\hxtool-commands.h: hxtool-commands.in $(SLC)
193         cd $(OBJ)
194         $(CP) $(SRCDIR)\hxtool-commands.in $(OBJ)\hxtool-commands.in
195         $(SLC) hxtool-commands.in
196         cd $(SRCDIR)
197
198 $(BINDIR)\hxtool.exe: $(OBJ)\tool\hxtool.obj $(OBJ)\tool\hxtool-commands.obj $(LIBHEIMDAL) $(OBJ)\hxtool-version.res
199         $(EXECONLINK) $(LIBHEIMDAL) $(LIBROKEN) $(LIBSL) $(LIBVERS) $(LIBCOMERR)
200         $(EXEPREP)
201
202 $(OBJ)\hx509-protos.h:
203         cd $(OBJ)
204         $(PERL) $(SRCDIR)\..\..\cf\make-proto.pl -R "^(_|^C)" -E HX509_LIB -q -P remove -o hx509-protos.h $(dist_libhx509_la_SOURCES) || $(RM) -f hx509-protos.h
205         cd $(SRCDIR)
206
207 $(OBJ)\hx509-private.h:
208         cd $(OBJ)
209         $(PERL) $(SRCDIR)\..\..\cf\make-proto.pl -q -P remove -p hx509-private.h $(dist_libhx509_la_SOURCES) || $(RM) -f hx509-private.h
210         cd $(SRCDIR)
211
212 $(OBJ)\hx509_err.c $(OBJ)\hx509_err.h: hx509_err.et
213         cd $(OBJ)
214         $(BINDIR)\compile_et.exe $(SRCDIR)\hx509_err.et
215         cd $(SRCDIR)
216
217 $(OBJ)\sel-gram.obj: $(OBJ)\sel-gram.c
218         $(C2OBJ) -I$(SRCDIR)
219
220 $(OBJ)\sel-lex.obj: $(OBJ)\sel-lex.c
221         $(C2OBJ) -I$(SRCDIR) -I$(OBJ)
222
223 $(OBJ)\sel-gram.c: sel-gram.y
224         $(YACC) -o $@ --defines=$(OBJ)\sel-gram.h sel-gram.y
225
226 $(OBJ)\sel-lex.c: sel-lex.l
227         $(LEX) -o$@ sel-lex.l
228
229 all:: $(INCFILES) $(LIBHX509)
230
231 prep:: mktooldir
232
233 mktooldir:
234 !  if !exist($(OBJ)\tool)
235         $(MKDIR) $(OBJ)\tool
236 !  endif
237
238 all-tools:: $(BINDIR)\hxtool.exe
239
240 clean::
241         -$(RM) $(BINDIR)\hxtool.exe
242         -$(RM) $(OBJ)\tool\*.*
243
244 {}.c{$(OBJ)\tool}.obj::
245         $(C2OBJ_C) /Fd$(OBJ)\tool\ /Fo$(OBJ)\tool\ /MP /UASN1_LIB $<
246
247 {$(OBJ)}.c{$(OBJ)\tool}.obj::
248         $(C2OBJ_C) /Fd$(OBJ)\tool\ /Fo$(OBJ)\tool\ /MP /UASN1_LIB $<