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