Merge branch 'vendor/OPENSSL'
[dragonfly.git] / secure / lib / libcrypto / Makefile.inc
1 # $FreeBSD: src/secure/lib/libcrypto/Makefile.inc,v 1.7.2.11 2003/02/20 15:07:32 nectar Exp $
2 # $DragonFly: src/secure/lib/libcrypto/Makefile.inc,v 1.18 2008/09/27 21:04:45 pavalos Exp $
3
4 OSSLVERSION=    0.9.8k
5 LCRYPTO_SRC=    ${.CURDIR}/../../../crypto/openssl
6 LCRYPTO_DOC=    ${LCRYPTO_SRC}/doc
7
8 CFLAGS+=        -DTERMIOS -DANSI_SOURCE
9 CFLAGS+=        -I${LCRYPTO_SRC} -I${LCRYPTO_SRC}/crypto \
10                 -I${LCRYPTO_SRC}/crypto/engine -I${.OBJDIR}
11
12 CFLAGS+=        -DOPENSSL_NO_GMP
13 CFLAGS+=        -DOPENSSL_NO_CMS
14 CFLAGS+=        -DOPENSSL_NO_JPAKE
15
16 .if !defined(WANT_IDEA)
17 CFLAGS+=        -DOPENSSL_NO_IDEA
18 .else
19 _idea_h=        idea/idea.h
20 .endif
21
22 .if ${MACHINE_ARCH} == "i386"
23 CFLAGS+= -DL_ENDIAN
24 .endif
25
26 CRYTPO_HDRS=    \
27         ../e_os.h ../e_os2.h \
28         crypto.h \
29         ebcdic.h \
30         fips_err.h \
31         opensslv.h \
32         ossl_typ.h \
33         symhacks.h \
34         tmdiff.h \
35         aes/aes.h aes/aes_locl.h \
36         asn1/asn1.h asn1/asn1_mac.h asn1/asn1t.h \
37         bio/bio.h \
38         bf/blowfish.h \
39         bn/bn.h \
40         buffer/buffer.h \
41         camellia/camellia.h \
42         cast/cast.h \
43         comp/comp.h \
44         conf/conf.h conf/conf_api.h \
45         des/des.h des/des_old.h \
46         dh/dh.h \
47         dsa/dsa.h \
48         dso/dso.h \
49         ec/ec.h \
50         ecdh/ecdh.h \
51         ecdsa/ecdsa.h \
52         engine/eng_int.h engine/engine.h \
53         err/err.h \
54         hmac/hmac.h \
55         ${_idea_h} \
56         krb5/krb5_asn.h \
57         lhash/lhash.h \
58         md2/md2.h \
59         md4/md4.h \
60         md5/md5.h \
61         mdc2/mdc2.h \
62         ocsp/ocsp.h \
63         objects/objects.h objects/obj_mac.h \
64         pem/pem.h pem/pem2.h \
65         pkcs12/pkcs12.h pkcs7/pkcs7.h \
66         pqueue/pqueue.h pqueue/pq_compat.h \
67         rand/rand.h \
68         rc2/rc2.h rc4/rc4.h rc5/rc5.h \
69         ripemd/ripemd.h \
70         rsa/rsa.h \
71         stack/stack.h stack/safestack.h \
72         store/store.h \
73         sha/sha.h \
74         txt_db/txt_db.h \
75         ui/ui.h ui/ui_compat.h ui/ui_locl.h \
76         x509/x509.h x509/x509_vfy.h x509v3/x509v3.h
77
78 SSL_HDRS=       \
79         dtls1.h kssl.h ssl.h ssl2.h ssl23.h ssl3.h tls1.h
80
81 HDRS+=  ${CRYTPO_HDRS:S,^,crypto/,} \
82         ${SSL_HDRS:S,^,ssl/,}
83
84 SRCS+=          buildinf.h openssl/opensslconf.h openssl/evp.h
85 CLEANFILES+=    buildinf.h openssl/opensslconf.h openssl/evp.h
86 CLEANDIRS+=     openssl
87
88 buildinf.h:
89         ( echo "#ifndef MK1MF_BUILD"; \
90         echo "  /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
91         echo "  #define CFLAGS \"$(CC)\""; \
92         echo "  #define PLATFORM \"`uname -s`-`uname -m`\""; \
93         echo "  #define DATE \"`LC_ALL=C date`\""; \
94         echo "#endif" ) > ${.TARGET}
95
96 openssl/opensslconf.h: openssl/.dummy ../../lib/libcrypto/opensslconf-${MACHINE_ARCH}.h
97 .if defined(WANT_IDEA)
98         sed '/^#ifndef OPENSSL_NO_IDEA$$/,/^#endif$$/d' ${.ALLSRC:Nopenssl/.dummy} > ${.TARGET}
99 .else
100         cp ${.ALLSRC:Nopenssl/.dummy} ${.TARGET}
101 .endif
102
103 openssl/evp.h: openssl/.dummy ${LCRYPTO_SRC}/crypto/evp/evp.h
104         cp ${.ALLSRC:Nopenssl/.dummy} ${.TARGET}
105
106 SRCS+=  ${HDRS:T:S;^;openssl/;}
107 .for h in ${HDRS:S,^,${LCRYPTO_SRC}/,}
108 openssl/${h:T}: openssl/.dummy ${h}
109         cp ${h} openssl
110 .endfor
111
112 # mkdir the required directory as its own target, so multiple
113 # mkdir commands do not race against each other.
114 #
115 openssl/.dummy:
116         mkdir -p openssl
117         if [ ! -f ${.TARGET} ]; then touch ${.TARGET}; fi
118
119 MANDIR= ${SHAREDIR}/openssl/man/man
120
121 .if defined(LIB)
122 _docs=  ${LIB}
123 _sec=   3
124 .else
125 _docs=  apps
126 _sec=   1
127 .endif
128
129 man-update:
130 .for manpage in ${MAN}
131         @(sec=${manpage:E}; \
132         pod=${manpage:R}.pod; \
133         cp ${LCRYPTO_DOC}/${_docs}/$$pod .; \
134         pod2man --section=$$sec --release="${OSSLVERSION}" --center="OpenSSL" \
135           $$pod > ${.CURDIR}/man/${manpage}; \
136         rm $$pod; \
137         ${ECHO} ${manpage})
138 .endfor
139
140 man-makefile-update:
141         rm -f ${.CURDIR}/Makefile.man
142         echo '# DO NOT EDIT: generated from man-makefile-update target' >> \
143             ${.CURDIR}/Makefile.man
144         for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
145                 fn=`basename $$i .pod`; \
146                 sec=`perl ${LCRYPTO_SRC}/util/extract-section.pl < $$i`; \
147                 sec=$${sec:-${_sec}}; \
148                 ${ECHO} "MAN+= $$fn.$$sec" >> ${.CURDIR}/Makefile.man; \
149                 perl ${LCRYPTO_SRC}/util/extract-names.pl < $$i | \
150                   sed -Ee "/^$$fn\$$/d;s/^(.*)/MLINKS+= $$fn.$$sec \1.$$sec/" >> \
151                     ${.CURDIR}/Makefile.man; \
152         done