Makefile revision 340704
1#
2# OpenSSL/crypto/Makefile
3#
4
5DIR=		crypto
6TOP=		..
7CC=		cc
8INCLUDE=	-I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
9# INCLUDES targets sudbirs!
10INCLUDES=	-I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include $(ZLIB_INCLUDE)
11CFLAG=		-g
12MAKEDEPPROG=	makedepend
13MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
14MAKEFILE=       Makefile
15RM=             rm -f
16ARFLAGS?=       r
17AR=             ar ${ARFLAGS}
18
19RECURSIVE_MAKE=	[ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
20		    (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
21		    $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
22		done;
23
24PEX_LIBS=
25EX_LIBS=
26 
27CFLAGS= $(INCLUDE) $(CFLAG)
28ASFLAGS= $(INCLUDE) $(ASFLAG)
29AFLAGS=$(ASFLAGS)
30CPUID_OBJ=mem_clr.o
31
32LIBS=
33
34GENERAL=Makefile README crypto-lib.com install.com
35TEST=constant_time_test.c
36
37LIB= $(TOP)/libcrypto.a
38SHARED_LIB= libcrypto$(SHLIB_EXT)
39LIBSRC=	cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
40	ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c \
41	getenv.c
42LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o \
43	uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o getenv.o \
44	$(CPUID_OBJ)
45
46SRC= $(LIBSRC)
47
48EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
49	ossl_typ.h
50HEADER=	cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h \
51	constant_time_locl.h bn_int.h $(EXHEADER)
52
53ALL=    $(GENERAL) $(SRC) $(HEADER)
54
55top:
56	@(cd ..; $(MAKE) DIRS=$(DIR) all)
57
58all: shared
59
60buildinf.h: ../Makefile
61	$(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" >buildinf.h
62
63x86cpuid.s:	x86cpuid.pl perlasm/x86asm.pl
64	$(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
65
66applink.o:	$(TOP)/ms/applink.c
67	$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
68
69uplink.o:	$(TOP)/ms/uplink.c applink.o
70	$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
71
72uplink-x86.s:	$(TOP)/ms/uplink-x86.pl
73	$(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
74
75x86_64cpuid.s: x86_64cpuid.pl;	$(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
76ia64cpuid.s: ia64cpuid.S;	$(CC) $(CFLAGS) -E ia64cpuid.S > $@
77ppccpuid.s:	ppccpuid.pl;	$(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
78pariscid.s:	pariscid.pl;	$(PERL) pariscid.pl $(PERLASM_SCHEME) $@
79alphacpuid.s:	alphacpuid.pl
80	(preproc=$$$$.$@.S; trap "rm $$preproc" INT; \
81	$(PERL) alphacpuid.pl > $$preproc && \
82	$(CC) -E -P $$preproc > $@ && rm $$preproc)
83
84testapps:
85	[ -z "$(THIS)" ] || (	if echo $(SDIRS) | fgrep ' des '; \
86				then cd des && $(MAKE) -e des; fi )
87	[ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps );
88	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
89
90subdirs:
91	@target=all; $(RECURSIVE_MAKE)
92
93files:
94	$(PERL) $(TOP)/util/files.pl "CPUID_OBJ=$(CPUID_OBJ)" Makefile >> $(TOP)/MINFO
95	@target=files; $(RECURSIVE_MAKE)
96
97links:
98	@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
99	@$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
100	@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
101	@target=links; $(RECURSIVE_MAKE)
102
103# lib: $(LIB): are splitted to avoid end-less loop
104lib:	$(LIB)
105	@touch lib
106$(LIB):	$(LIBOBJ)
107	$(AR) $(LIB) $(LIBOBJ)
108	test -z "$(FIPSLIBDIR)" || $(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o
109	$(RANLIB) $(LIB) || echo Never mind.
110
111shared: buildinf.h lib subdirs
112	if [ -n "$(SHARED_LIBS)" ]; then \
113		(cd ..; $(MAKE) $(SHARED_LIB)); \
114	fi
115
116libs:
117	@target=lib; $(RECURSIVE_MAKE)
118
119install:
120	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
121	@headerlist="$(EXHEADER)"; for i in $$headerlist ;\
122	do \
123	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
124	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
125	done;
126	@target=install; $(RECURSIVE_MAKE)
127
128lint:
129	@target=lint; $(RECURSIVE_MAKE)
130
131update: local_depend
132	@[ -z "$(THIS)" ] || (set -e; target=update; $(RECURSIVE_MAKE) )
133	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
134
135depend: local_depend
136	@[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
137	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
138local_depend:
139	@[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
140	@[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
141	@[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
142
143clean:
144	rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
145	@target=clean; $(RECURSIVE_MAKE)
146
147dclean:
148	$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
149	mv -f Makefile.new $(MAKEFILE)
150	rm -f opensslconf.h
151	@target=dclean; $(RECURSIVE_MAKE)
152
153# DO NOT DELETE THIS LINE -- make depend depends on it.
154
155cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
156cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
157cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
158cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
159cpt_err.o: ../include/openssl/safestack.h ../include/openssl/stack.h
160cpt_err.o: ../include/openssl/symhacks.h cpt_err.c
161cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
162cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
163cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h
164cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
165cryptlib.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
166cryptlib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.c
167cryptlib.o: cryptlib.h
168cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
169cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
170cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
171cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
172cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
173cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
174cversion.o: cryptlib.h cversion.c
175ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
176ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
177ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
178ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
179ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
180ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
181ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
182ex_data.o: ex_data.c
183fips_ers.o: ../include/openssl/opensslconf.h fips_ers.c
184getenv.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
185getenv.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
186getenv.o: ../include/openssl/err.h ../include/openssl/lhash.h
187getenv.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
188getenv.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
189getenv.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
190getenv.o: getenv.c
191mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
192mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
193mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
194mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
195mem.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
196mem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
197mem.o: mem.c
198mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
199mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
200mem_clr.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
201mem_clr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h mem_clr.c
202mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
203mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
204mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
205mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
206mem_dbg.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
207mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
208mem_dbg.o: mem_dbg.c
209o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
210o_dir.o: LPdir_unix.c o_dir.c o_dir.h
211o_fips.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
212o_fips.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
213o_fips.o: ../include/openssl/err.h ../include/openssl/lhash.h
214o_fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
215o_fips.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
216o_fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
217o_fips.o: o_fips.c
218o_init.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/crypto.h
219o_init.o: ../include/openssl/e_os2.h ../include/openssl/err.h
220o_init.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
221o_init.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
222o_init.o: ../include/openssl/safestack.h ../include/openssl/stack.h
223o_init.o: ../include/openssl/symhacks.h o_init.c
224o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
225o_str.o: o_str.c o_str.h
226o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
227o_time.o: o_time.h
228uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
229uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
230uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
231uid.o: ../include/openssl/stack.h ../include/openssl/symhacks.h uid.c
232