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