1# $NetBSD: Makefile,v 1.5 2017/02/21 16:07:17 christos Exp $
2
3USE_FORT?= yes	# network protocol library
4
5.include <bsd.own.mk>
6.include <${.CURDIR}/../../Makefile.inc>
7
8.PATH:		${HEIMDIST}/lib/asn1 ${HEIMBASE}/include
9
10LIB=		asn1
11
12LIBDPLIBS+=	com_err	${.CURDIR}/../libcom_err
13LIBDPLIBS+=	roken	${.CURDIR}/../libroken
14
15HEIMSRCS =		\
16	asn1_err.et	\
17	krb5.asn1	\
18	cms.asn1	\
19	rfc2459.asn1	\
20	pkinit.asn1	\
21	pkcs12.asn1	\
22	pkcs8.asn1	\
23	pkcs9.asn1	\
24	digest.asn1	\
25	kx509.asn1
26
27ASN1_OPTS.rfc2459.asn1 = \
28	--one-code-file				\
29	--preserve-binary=TBSCertificate	\
30	--preserve-binary=TBSCRLCertList	\
31	--preserve-binary=Name			\
32	--sequence=GeneralNames			\
33	--sequence=Extensions			\
34	--sequence=CRLDistributionPoints
35
36INCSDIR= /usr/include/krb5
37
38INCS=	asn1-common.h		\
39	heim_asn1.h		\
40	der.h			\
41	der-protos.h		\
42	${COMPILE_ET_INCS}	\
43	${ASN1_INCS}
44
45SRCS=			\
46	der.c		\
47	der_get.c	\
48	der_put.c	\
49	der_free.c	\
50	der_length.c	\
51	der_copy.c	\
52	der_cmp.c	\
53	der_format.c	\
54	fuzzer.c	\
55	extra.c		\
56	template.c	\
57	timegm.c
58
59.if ${USETOOLS} != "yes"
60# .PHONY: ${ASN1COMPILEOBJ}/asn1_compile
61.PHONY: try_to_build_asn1_compile
62
63try_to_build_asn1_compile:
64	@cd ${.CURDIR}/asn1_compile && ${MAKE}
65
66${ASN1COMPILEOBJ}/asn1_compile: try_to_build_asn1_compile
67
68SUBDIR=	asn1_compile
69.endif
70
71
72.include <${HEIMBASE}/Makefile.rules.inc>
73.include <bsd.lib.mk>
74.if ${USETOOLS} != "yes"
75.include <bsd.subdir.mk>
76.endif
77
78.if ${MACHINE_ARCH} == "sparc64"
79# Or anything else that uses PROFILE_HOOK with gcc.
80# What happens is that we end up generating one of two different
81# function orders and since the profile code uses the function
82# number for label generation, we end up with one of two different
83# label orders. Disabling ASLR or optimization fixes it.
84COPTS.asn1_krb5_asn1.c+=-O0
85.endif
86