7e15bb233ddd1ee6606b449f233f8825b5e546e7
[openssl.git] / crypto / Makefile
1 #
2 # SSLeay/crypto/Makefile
3 #
4
5 DIR=            crypto
6 TOP=            ..
7 CC=             cc
8 INCLUDE=        -I. -I$(TOP) -I../include
9 INCLUDES=       -I.. -I../.. -I../../include
10 CFLAG=          -g
11 MAKEDEPPROG=    makedepend
12 MAKEDEPEND=     $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
13 MAKEFILE=       Makefile
14 RM=             rm -f
15 AR=             ar r
16
17 PEX_LIBS=
18 EX_LIBS=
19  
20 CFLAGS= $(INCLUDE) $(CFLAG)
21 ASFLAGS= $(INCLUDE) $(ASFLAG)
22 AFLAGS=$(ASFLAGS)
23
24 LIBS=
25
26 SDIRS=  objects \
27         md2 md4 md5 sha mdc2 hmac ripemd \
28         des rc2 rc4 rc5 idea bf cast \
29         bn ec rsa dsa ecdsa ecdh dh dso engine aes \
30         buffer bio stack lhash rand err \
31         evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
32         store pqueue
33
34 GENERAL=Makefile README crypto-lib.com install.com
35
36 LIB= $(TOP)/libcrypto.a
37 SHARED_LIB= libcrypto$(SHLIB_EXT)
38 LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c o_dir.c
39 LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o $(CPUID_OBJ)
40
41 SRC= $(LIBSRC)
42
43 EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
44         ossl_typ.h
45 HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
46
47 ALL=    $(GENERAL) $(SRC) $(HEADER)
48
49 top:
50         @(cd ..; $(MAKE) DIRS=$(DIR) all)
51
52 all: shared
53
54 buildinf.h: ../Makefile
55         ( echo "#ifndef MK1MF_BUILD"; \
56         echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
57         echo '  #define CFLAGS "$(CC) $(CFLAG)"'; \
58         echo '  #define PLATFORM "$(PLATFORM)"'; \
59         echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
60         echo '#endif' ) >buildinf.h
61
62 x86cpuid-elf.s: x86cpuid.pl perlasm/x86asm.pl
63         $(PERL) x86cpuid.pl elf $(CFLAGS) $(PROCESSOR) > $@
64 x86cpuid-cof.s: x86cpuid.pl perlasm/x86asm.pl
65         $(PERL) x86cpuid.pl coff $(CFLAGS) $(PROCESSOR) > $@
66 x86cpuid-out.s: x86cpuid.pl perlasm/x86asm.pl
67         $(PERL) x86cpuid.pl a.out $(CFLAGS) $(PROCESSOR) > $@
68
69 x86_64cpuid.s: x86_64cpuid.pl
70         $(PERL) x86_64cpuid.pl $@
71 ia64cpuid.s: ia64cpuid.S
72         $(CC) $(CFLAGS) -E ia64cpuid.S > $@
73
74 testapps:
75         @if [ -z "(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
76         [ -z "$(THIS)" ] || ( if echo ${SDIRS} | fgrep ' des '; \
77         then cd des && $(MAKE) des; fi )
78         [ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) testapps );
79
80 subdirs:
81         @for i in $(SDIRS) ;\
82         do \
83         (cd $$i && echo "making all in crypto/$$i..." && \
84         $(MAKE) INCLUDES='${INCLUDES}' all ) || exit 1; \
85         done;
86
87 files:
88         $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
89         @for i in $(SDIRS) ;\
90         do \
91         (cd $$i && echo "making 'files' in crypto/$$i..." && \
92         $(MAKE) PERL='${PERL}' files ); \
93         done;
94
95 links:
96         @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
97         @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
98         @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
99         @for i in $(SDIRS); do \
100             (cd $$i && echo "making links in crypto/$$i..." && \
101             $(MAKE) links ); \
102         done;
103
104 lib:    $(LIBOBJ)
105         $(AR) $(LIB) $(LIBOBJ)
106         $(RANLIB) $(LIB) || echo Never mind.
107         @touch lib
108
109 shared: buildinf.h lib subdirs
110         if [ -n "$(SHARED_LIBS)" ]; then \
111                 (cd ..; $(MAKE) $(SHARED_LIB)); \
112         fi
113
114 libs:
115         @for i in $(SDIRS) ;\
116         do \
117         (cd $$i && echo "making libs in crypto/$$i..." && \
118         $(MAKE) lib );
119         done;
120
121 tests:
122         @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@ fi
123         @[ -z "$(THIS)" ] || (for i in $(SDIRS) ;\
124         do \
125         (cd $$i && echo "making tests in crypto/$$i..." && \
126         $(MAKE) tests ); \
127         done; )
128
129 install:
130         @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
131         @headerlist="$(EXHEADER)"; for i in $$headerlist ;\
132         do \
133         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
134         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
135         done;
136         @for i in $(SDIRS) ;\
137         do \
138         (cd $$i && echo "making install in crypto/$$i..." && \
139         $(MAKE) install ); \
140         done;
141
142 lint:
143         @for i in $(SDIRS) ;\
144         do \
145         (cd $$i && echo "making lint in crypto/$$i..." && \
146         $(MAKE) lint ); \
147         done;
148
149 depend:
150         if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
151         $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
152         if [ ! -s buildinf.h ]; then rm buildinf.h; fi
153         @for i in $(SDIRS) ;\
154         do \
155         (cd $$i && echo "making depend in crypto/$$i..." && \
156         $(MAKE) depend ); \
157         done;
158
159 clean:
160         rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
161         @for i in $(SDIRS) ;\
162         do \
163         (cd $$i && echo "making clean in crypto/$$i..." && \
164         $(MAKE) clean ); \
165         done;
166
167 dclean:
168         $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
169         mv -f Makefile.new $(MAKEFILE)
170         @for i in $(SDIRS) ;\
171         do \
172         (cd $$i && echo "making dclean in crypto/$$i..." && \
173         $(MAKE) dclean ); \
174         done;
175
176 # DO NOT DELETE THIS LINE -- make depend depends on it.
177
178 cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
179 cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
180 cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
181 cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
182 cpt_err.o: ../include/openssl/safestack.h ../include/openssl/stack.h
183 cpt_err.o: ../include/openssl/symhacks.h cpt_err.c
184 cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
185 cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
186 cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h
187 cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
188 cryptlib.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
189 cryptlib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.c
190 cryptlib.o: cryptlib.h
191 cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
192 cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
193 cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
194 cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
195 cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
196 cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
197 cversion.o: cryptlib.h cversion.c
198 ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
199 ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
200 ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
201 ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
202 ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
203 ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
204 ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
205 ex_data.o: ex_data.c
206 mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
207 mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
208 mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
209 mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
210 mem.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
211 mem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
212 mem.o: mem.c
213 mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
214 mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
215 mem_clr.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
216 mem_clr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h mem_clr.c
217 mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
218 mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
219 mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
220 mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
221 mem_dbg.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
222 mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
223 mem_dbg.o: mem_dbg.c
224 o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
225 o_dir.o: LPdir_unix.c o_dir.c o_dir.h
226 o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
227 o_str.o: o_str.c o_str.h
228 o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
229 o_time.o: o_time.h
230 tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
231 tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
232 tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
233 tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
234 tmdiff.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
235 tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
236 tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h tmdiff.c
237 uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
238 uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
239 uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
240 uid.o: ../include/openssl/stack.h ../include/openssl/symhacks.h uid.c