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