Merge from vendor branch GDB:
[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.6 2004/09/02 08:57:05 asmodai Exp $
3
4 OSSLVERSION=    0.9.7d
5 LCRYPTO_SRC=    ${.CURDIR}/../../../crypto/openssl-${OSSLVERSION}
6 LCRYPTO_DOC=    ${.CURDIR}/../../../crypto/openssl-${OSSLVERSION}/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(MAKE_IDEA) || ${MAKE_IDEA} != YES
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 .elif ${MACHINE_ARCH} == "alpha"
21 # no ENDIAN stuff defined for alpha (64-bit)
22 .endif
23
24 HDRS+=  \
25         ../e_os.h ../e_os2.h \
26         crypto.h \
27         ebcdic.h \
28         opensslv.h \
29         ossl_typ.h \
30         symhacks.h \
31         tmdiff.h \
32         aes/aes.h aes/aes_locl.h \
33         asn1/asn1.h asn1/asn1_mac.h asn1/asn1t.h \
34         bio/bio.h \
35         bf/blowfish.h \
36         bn/bn.h \
37         buffer/buffer.h \
38         cast/cast.h \
39         comp/comp.h \
40         conf/conf.h conf/conf_api.h \
41         des/des.h des/des_old.h \
42         dh/dh.h \
43         dsa/dsa.h \
44         dso/dso.h \
45         ec/ec.h \
46         engine/eng_int.h engine/engine.h engine/hw_4758_cca_err.h \
47         engine/hw_aep_err.h engine/hw_atalla_err.h engine/hw_cswift_err.h \
48         engine/hw_ncipher_err.h engine/hw_nuron_err.h engine/hw_sureware_err.h \
49         engine/hw_ubsec_err.h \
50         err/err.h \
51         hmac/hmac.h \
52         ${_idea_h} \
53         krb5/krb5_asn.h \
54         lhash/lhash.h \
55         md2/md2.h \
56         md4/md4.h \
57         md5/md5.h \
58         mdc2/mdc2.h \
59         ocsp/ocsp.h \
60         objects/objects.h objects/obj_mac.h \
61         pem/pem.h pem/pem2.h \
62         pkcs12/pkcs12.h pkcs7/pkcs7.h \
63         rand/rand.h \
64         rc2/rc2.h rc4/rc4.h rc5/rc5.h \
65         ripemd/ripemd.h \
66         rsa/rsa.h \
67         stack/stack.h stack/safestack.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 SRCS+=          buildinf.h openssl/opensslconf.h openssl/evp.h
74 CLEANFILES+=    buildinf.h openssl/opensslconf.h openssl/evp.h
75 CLEANDIRS+=     openssl
76
77 buildinf.h:
78         ( echo "#ifndef MK1MF_BUILD"; \
79         echo "  /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
80         echo "  #define CFLAGS \"$(CC)\""; \
81         echo "  #define PLATFORM \"`uname -s`-`uname -m`\""; \
82         echo "  #define DATE \"`LC_ALL=C date`\""; \
83         echo "#endif" ) > ${.TARGET}
84
85 openssl/opensslconf.h: openssl/.dummy ../../lib/libcrypto/opensslconf-${MACHINE_ARCH}.h
86         cp ${.ALLSRC:Nopenssl/.dummy} ${.TARGET}
87
88 openssl/evp.h: openssl/.dummy ${LCRYPTO_SRC}/crypto/evp/evp.h
89 .if !defined(MAKE_IDEA) || ${MAKE_IDEA} != YES
90         sed '/^#ifndef OPENSSL_NO_IDEA$$/,/^#endif$$/d' ${.ALLSRC:Nopenssl/.dummy} > ${.TARGET}
91 .else
92         ${INSTALL} -C -m 444 ${.ALLSRC:Nopenssl/.dummy} ${.TARGET}
93 .endif
94
95 SRCS+=  ${HDRS:T:S;^;openssl/;}
96 .for h in ${HDRS:S/^/${LCRYPTO_SRC}\/crypto\//}
97 openssl/${h:T}: openssl/.dummy ${h}
98         ${INSTALL} -C -m 444 ${h} openssl
99 .endfor
100
101 # mkdir the required directory as its own target, so multiple
102 # mkdir commands do not race against each other.
103 #
104 openssl/.dummy:
105         mkdir -p openssl
106         if [ ! -f ${.TARGET} ]; then touch ${.TARGET}; fi
107
108 MANDIR= ${SHAREDIR}/openssl/man/man
109
110 .if defined(LIB)
111 _docs=  ${LIB}
112 _skip=  des_modes
113 _sec=   3
114 .else
115 _docs=  apps
116 _skip=  config
117 _sec=   1
118 .endif
119
120 man-update:
121 .for manpage in ${MAN}
122         @(sec=${manpage:E}; \
123         pod=${manpage:R}.pod; \
124         cp ${LCRYPTO_DOC}/${_docs}/$$pod .; \
125         pod2man --section=$$sec --release="${OSSLVERSION}" --center="OpenSSL" \
126           $$pod > ${.CURDIR}/man/${manpage}; \
127         rm $$pod; \
128         ${ECHO} ${manpage})
129 .endfor
130
131 man-makefile-update:
132         rm -f ${.CURDIR}/Makefile.man
133         echo '# $$DragonFly: src/secure/lib/libcrypto/Makefile.inc,v 1.6 2004/09/02 08:57:05 asmodai Exp $$' >> ${.CURDIR}/Makefile.man
134         echo '# DO NOT EDIT: generated from man-makefile-update target' >> \
135             ${.CURDIR}/Makefile.man
136         for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
137                 fn=`basename $$i .pod`; \
138                 if [ "$$fn" != "${_skip}" ]; then \
139                 ${ECHO} "MAN+= $$fn.${_sec}" >> ${.CURDIR}/Makefile.man; \
140                 fi; \
141         done
142         for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
143                 fn=`basename $$i .pod`; \
144                 if [ "$$fn" != "${_skip}" ]; then \
145                 perl ${LCRYPTO_SRC}/util/extract-names.pl < $$i | \
146                   awk "/^$$fn\$$/ { next; } \
147                   { print \"MLINKS+= $$fn.${_sec} \" \$$1 \".${_sec}\" }" >> \
148                   ${.CURDIR}/Makefile.man; \
149                 fi; \
150         done