Merge from vendor branch GCC:
[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.5 2004/03/23 07:47:14 dillon Exp $
3
4 LCRYPTO_SRC=    ${.CURDIR}/../../../crypto/openssl
5 LCRYPTO_DOC=    ${.CURDIR}/../../../crypto/openssl/doc
6
7 CFLAGS+=        -DTERMIOS -DANSI_SOURCE
8 CFLAGS+=        -I${LCRYPTO_SRC} -I${LCRYPTO_SRC}/crypto \
9                 -I${LCRYPTO_SRC}/crypto/engine -I${.OBJDIR}
10
11 .if !defined(MAKE_IDEA) || ${MAKE_IDEA} != YES
12 CFLAGS+=        -DOPENSSL_NO_IDEA
13 .else
14 _idea_h=        idea/idea.h
15 .endif
16
17 .if ${MACHINE_ARCH} == "i386"
18 CFLAGS+= -DL_ENDIAN
19 .elif ${MACHINE_ARCH} == "alpha"
20 # no ENDIAN stuff defined for alpha (64-bit)
21 .endif
22
23 HDRS+=  \
24         ../e_os.h ../e_os2.h \
25         crypto.h \
26         ebcdic.h \
27         opensslv.h \
28         ossl_typ.h \
29         symhacks.h \
30         tmdiff.h \
31         aes/aes.h aes/aes_locl.h \
32         asn1/asn1.h asn1/asn1_mac.h asn1/asn1t.h \
33         bio/bio.h \
34         bf/blowfish.h \
35         bn/bn.h \
36         buffer/buffer.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         engine/eng_int.h engine/engine.h engine/hw_4758_cca_err.h \
46         engine/hw_aep_err.h engine/hw_atalla_err.h engine/hw_cswift_err.h \
47         engine/hw_ncipher_err.h engine/hw_nuron_err.h engine/hw_sureware_err.h \
48         engine/hw_ubsec_err.h \
49         err/err.h \
50         hmac/hmac.h \
51         ${_idea_h} \
52         krb5/krb5_asn.h \
53         lhash/lhash.h \
54         md2/md2.h \
55         md4/md4.h \
56         md5/md5.h \
57         mdc2/mdc2.h \
58         ocsp/ocsp.h \
59         objects/objects.h objects/obj_mac.h \
60         pem/pem.h pem/pem2.h \
61         pkcs12/pkcs12.h pkcs7/pkcs7.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         sha/sha.h \
68         txt_db/txt_db.h \
69         ui/ui.h ui/ui_compat.h ui/ui_locl.h \
70         x509/x509.h x509/x509_vfy.h x509v3/x509v3.h
71
72 SRCS+=          buildinf.h openssl/opensslconf.h openssl/evp.h
73 CLEANFILES+=    buildinf.h openssl/opensslconf.h openssl/evp.h
74 CLEANDIRS+=     openssl
75
76 buildinf.h:
77         ( echo "#ifndef MK1MF_BUILD"; \
78         echo "  /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
79         echo "  #define CFLAGS \"$(CC)\""; \
80         echo "  #define PLATFORM \"`uname -s`-`uname -m`\""; \
81         echo "  #define DATE \"`LC_ALL=C date`\""; \
82         echo "#endif" ) > ${.TARGET}
83
84 openssl/opensslconf.h: openssl/.dummy ../../lib/libcrypto/opensslconf-${MACHINE_ARCH}.h
85         cp ${.ALLSRC:Nopenssl/.dummy} ${.TARGET}
86
87 openssl/evp.h: openssl/.dummy ${LCRYPTO_SRC}/crypto/evp/evp.h
88 .if !defined(MAKE_IDEA) || ${MAKE_IDEA} != YES
89         sed '/^#ifndef OPENSSL_NO_IDEA$$/,/^#endif$$/d' ${.ALLSRC:Nopenssl/.dummy} > ${.TARGET}
90 .else
91         ${INSTALL} -C -m 444 ${.ALLSRC:Nopenssl/.dummy} ${.TARGET}
92 .endif
93
94 SRCS+=  ${HDRS:T:S;^;openssl/;}
95 .for h in ${HDRS:S/^/${LCRYPTO_SRC}\/crypto\//}
96 openssl/${h:T}: openssl/.dummy ${h}
97         ${INSTALL} -C -m 444 ${h} openssl
98 .endfor
99
100 # mkdir the required directory as its own target, so multiple
101 # mkdir commands do not race against each other.
102 #
103 openssl/.dummy:
104         mkdir -p openssl
105         if [ ! -f ${.TARGET} ]; then touch ${.TARGET}; fi
106
107 MANDIR= ${SHAREDIR}/openssl/man/man
108
109 .if defined(LIB)
110 _docs=  ${LIB}
111 _skip=  des_modes
112 _sec=   3
113 .else
114 _docs=  apps
115 _skip=  config
116 _sec=   1
117 .endif
118
119 man-update:
120 .for manpage in ${MAN}
121         @(sec=${manpage:E}; \
122         pod=${manpage:R}.pod; \
123         cp ${LCRYPTO_DOC}/${_docs}/$$pod .; \
124         pod2man --section=$$sec --release="0.9.7a" --center="OpenSSL" \
125           $$pod > ${.CURDIR}/man/${manpage}; \
126         rm $$pod; \
127         ${ECHO} ${manpage})
128 .endfor
129
130 man-makefile-update:
131         rm -f ${.CURDIR}/Makefile.man
132         echo '# $$FreeBSD: src/secure/lib/libcrypto/Makefile.inc,v 1.7.2.11 2003/02/20 15:07:32 nectar Exp $$' >> ${.CURDIR}/Makefile.man
133         echo '# DO NOT EDIT: generated from man-makefile-update target' >> \
134             ${.CURDIR}/Makefile.man
135         for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
136                 fn=`basename $$i .pod`; \
137                 if [ "$$fn" != "${_skip}" ]; then \
138                 ${ECHO} "MAN+= $$fn.${_sec}" >> ${.CURDIR}/Makefile.man; \
139                 fi; \
140         done
141         for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
142                 fn=`basename $$i .pod`; \
143                 if [ "$$fn" != "${_skip}" ]; then \
144                 perl ${LCRYPTO_SRC}/util/extract-names.pl < $$i | \
145                   awk "/^$$fn\$$/ { next; } \
146                   { print \"MLINKS+= $$fn.${_sec} \" \$$1 \".${_sec}\" }" >> \
147                   ${.CURDIR}/Makefile.man; \
148                 fi; \
149         done