NTMakefile   [plain text]


########################################################################
#
# Copyright (c) 2009, Secure Endpoints Inc.
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 
# - Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
# 
# - Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimer in
#   the documentation and/or other materials provided with the
#   distribution.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# 

RELDIR=lib\hx509

!include ../../windows/NTMakefile.w32

gen_files_ocsp = 			\
	$(OBJ)\asn1_OCSPBasicOCSPResponse.x	\
	$(OBJ)\asn1_OCSPCertID.x		\
	$(OBJ)\asn1_OCSPCertStatus.x		\
	$(OBJ)\asn1_OCSPInnerRequest.x		\
	$(OBJ)\asn1_OCSPKeyHash.x		\
	$(OBJ)\asn1_OCSPRequest.x		\
	$(OBJ)\asn1_OCSPResponderID.x		\
	$(OBJ)\asn1_OCSPResponse.x		\
	$(OBJ)\asn1_OCSPResponseBytes.x	\
	$(OBJ)\asn1_OCSPResponseData.x		\
	$(OBJ)\asn1_OCSPResponseStatus.x	\
	$(OBJ)\asn1_OCSPSignature.x		\
	$(OBJ)\asn1_OCSPSingleResponse.x	\
	$(OBJ)\asn1_OCSPTBSRequest.x		\
	$(OBJ)\asn1_OCSPVersion.x		\
	$(OBJ)\asn1_id_pkix_ocsp.x		\
	$(OBJ)\asn1_id_pkix_ocsp_basic.x	\
	$(OBJ)\asn1_id_pkix_ocsp_nonce.x

gen_files_pkcs10 = 			\
	$(OBJ)\asn1_CertificationRequestInfo.x	\
	$(OBJ)\asn1_CertificationRequest.x

gen_files_crmf = 			\
	$(OBJ)\asn1_CRMFRDNSequence.x		\
	$(OBJ)\asn1_CertReqMessages.x		\
	$(OBJ)\asn1_CertReqMsg.x		\
	$(OBJ)\asn1_CertRequest.x		\
	$(OBJ)\asn1_CertTemplate.x		\
	$(OBJ)\asn1_Controls.x			\
	$(OBJ)\asn1_PBMParameter.x		\
	$(OBJ)\asn1_PKMACValue.x		\
	$(OBJ)\asn1_POPOPrivKey.x		\
	$(OBJ)\asn1_POPOSigningKey.x		\
	$(OBJ)\asn1_POPOSigningKeyInput.x	\
	$(OBJ)\asn1_ProofOfPossession.x	\
	$(OBJ)\asn1_SubsequentMessage.x	

libhx509_la_OBJS = \
	$(OBJ)\ca.obj \
	$(OBJ)\cert.obj \
	$(OBJ)\cms.obj \
	$(OBJ)\collector.obj \
	$(OBJ)\crypto.obj \
	$(OBJ)\error.obj \
	$(OBJ)\env.obj \
	$(OBJ)\file.obj \
	$(OBJ)\hx509_err.obj	\
	$(OBJ)\sel.obj \
	$(OBJ)\sel-gram.obj	\
	$(OBJ)\sel-lex.obj	\
	$(OBJ)\keyset.obj \
	$(OBJ)\ks_dir.obj \
	$(OBJ)\ks_file.obj \
	$(OBJ)\ks_mem.obj \
	$(OBJ)\ks_null.obj \
	$(OBJ)\ks_p11.obj \
	$(OBJ)\ks_p12.obj \
	$(OBJ)\ks_keychain.obj \
	$(OBJ)\lock.obj \
	$(OBJ)\name.obj \
	$(OBJ)\peer.obj \
	$(OBJ)\print.obj \
	$(OBJ)\softp11.obj \
	$(OBJ)\req.obj \
	$(OBJ)\revoke.obj	\
	$(gen_files_ocsp:.x=.obj)	\
	$(gen_files_pkcs10:.x=.obj)

!ifndef STATICLIBS

$(LIBHX509): $(BINDIR)\libhx509.dll

$(BINDIR)\libhx509.dll: $(libhx509_la_OBJS) $(LIBHCRYPTO) $(LIBASN1) $(LIBWIND) $(LIBROKEN) $(LIBCOMERR)
	$(DLLGUILINK) -def:libhx509-exports.def -implib:$(LIBHX509) shell32.lib
	$(DLLPREP)

!else

$(LIBHX509): $(libhx509_la_OBJS)
	$(LIBCON)

!endif

dist_libhx509_la_SOURCES = \
	$(SRCDIR)\ca.c \
	$(SRCDIR)\cert.c \
	$(SRCDIR)\cms.c \
	$(SRCDIR)\collector.c \
	$(SRCDIR)\crypto.c \
	$(SRCDIR)\doxygen.c \
	$(SRCDIR)\error.c \
	$(SRCDIR)\env.c \
	$(SRCDIR)\file.c \
	$(SRCDIR)\hx509.h \
	$(SRCDIR)\hx_locl.h \
	$(SRCDIR)\sel.c \
	$(SRCDIR)\sel.h \
	$(SRCDIR)\sel-gram.y \
	$(SRCDIR)\sel-lex.l \
	$(SRCDIR)\keyset.c \
	$(SRCDIR)\ks_dir.c \
	$(SRCDIR)\ks_file.c \
	$(SRCDIR)\ks_mem.c \
	$(SRCDIR)\ks_null.c \
	$(SRCDIR)\ks_p11.c \
	$(SRCDIR)\ks_p12.c \
	$(SRCDIR)\ks_keychain.c \
	$(SRCDIR)\lock.c \
	$(SRCDIR)\name.c \
	$(SRCDIR)\peer.c \
	$(SRCDIR)\print.c \
	$(SRCDIR)\softp11.c \
	$(SRCDIR)\ref\pkcs11.h \
	$(SRCDIR)\req.c \
	$(SRCDIR)\revoke.c

AUXCFLAGS=$(AUXCFLAGS) -I$(SRCDIR)\ref -I$(OBJ)

asn1_compile=$(BINDIR)\asn1_compile.exe

$(gen_files_ocsp:.x=.c): $$(@R).x

$(gen_files_pkcs10:.x=.c): $$(@R).x

$(gen_files_crmf:.x=.c): $$(@R).x

$(gen_files_ocsp) $(OBJ)\ocsp_asn1.hx: $(asn1_compile) ocsp.asn1
	cd $(OBJ)
	$(asn1_compile) \
		--preserve-binary=OCSPTBSRequest \
		--preserve-binary=OCSPResponseData \
		$(SRCDIR)\ocsp.asn1 ocsp_asn1 \
	|| ( $(RM) -f $(gen_files_ocsp) $(OBJ)\ocsp_asn1.h ; exit /b 1 )
	cd $(SRCDIR)

$(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.hx: $(asn1_compile) pkcs10.asn1
	cd $(OBJ)
	$(asn1_compile) \
		--preserve-binary=CertificationRequestInfo \
		$(SRCDIR)\pkcs10.asn1 pkcs10_asn1 \
	|| ( $(RM) -f $(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.h ; exit /b 1 )
	cd $(SRCDIR)

$(gen_files_crmf) $(OBJ)\crmf_asn1.hx: $(asn1_compile) crmf.asn1
	cd $(OBJ)
	$(asn1_compile) $(SRCDIR)\crmf.asn1 crmf_asn1 \
	|| ( $(RM) -f $(gen_files_crmf) $(OBJ)\crmf_asn1.h ; exit /b 1 )
	cd $(SRCDIR)

INCFILES=			    \
	$(INCDIR)\hx509.h	    \
	$(INCDIR)\hx509-protos.h    \
	$(INCDIR)\hx509-private.h   \
	$(INCDIR)\hx509_err.h	    \
	$(INCDIR)\ocsp_asn1.h	    \
	$(INCDIR)\pkcs10_asn1.h	    \
	$(INCDIR)\crmf_asn1.h	    \
	$(OBJ)\ocsp_asn1-priv.h	    \
	$(OBJ)\pkcs10_asn1-priv.h   \
	$(OBJ)\crmf_asn1-priv.h

hxtool.c: $(OBJ)\hxtool-commands.h

SLC=$(BINDIR)\slc.exe

$(OBJ)\hxtool-commands.c $(OBJ)\hxtool-commands.h: hxtool-commands.in $(SLC)
	cd $(OBJ)
	$(CP) $(SRCDIR)\hxtool-commands.in $(OBJ)\hxtool-commands.in
	$(SLC) hxtool-commands.in
	cd $(SRCDIR)

$(BINDIR)\hxtool.exe: $(OBJ)\hxtool.obj $(OBJ)\hxtool-commands.obj $(LIBHX509)
	$(EXECONLINK) $(LIBASN1) $(LIBHCRYPTO) $(LIBROKEN) $(LIBSL) $(LIBVERS) $(LIBWIND) $(LIBCOMERR)
	$(_VC_MANIFEST_EMBED_EXE)
	$(_VC_MANIFEST_CLEAN)
	$(_CODESIGN)

$(OBJ)\hx509-protos.h:
	cd $(OBJ)
	$(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
	cd $(SRCDIR)

$(OBJ)\hx509-private.h:
	cd $(OBJ)
	$(PERL) $(SRCDIR)\..\..\cf\make-proto.pl -q -P remove -p hx509-private.h $(dist_libhx509_la_SOURCES) || $(RM) -f hx509-private.h
	cd $(SRCDIR)

$(OBJ)\hx509_err.c $(OBJ)\hx509_err.h: hx509_err.et
	cd $(OBJ)
	$(BINDIR)\compile_et.exe $(SRCDIR)\hx509_err.et
	cd $(SRCDIR)

$(OBJ)\sel-gram.obj: $(OBJ)\sel-gram.c
	$(C2OBJ) -I$(SRCDIR)

$(OBJ)\sel-lex.obj: $(OBJ)\sel-lex.c
	$(C2OBJ) -I$(SRCDIR) -I$(OBJ)

$(OBJ)\sel-gram.c: sel-gram.y
	$(YACC) -o $@ --defines=$(OBJ)\sel-gram.h sel-gram.y

$(OBJ)\sel-lex.c: sel-lex.l
	$(LEX) -o$@ sel-lex.l

all:: $(INCFILES) $(LIBHX509) $(BINDIR)\hxtool.exe

clean::
	-$(RM) $(BINDIR)\hxtool.exe