1142425Snectar#
2160814Ssimon# OpenSSL/crypto/Makefile
3142425Snectar#
4142425Snectar
5142425SnectarDIR=		crypto
6142425SnectarTOP=		..
7142425SnectarCC=		cc
8238405SjkimINCLUDE=	-I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
9160814Ssimon# INCLUDES targets sudbirs!
10238405SjkimINCLUDES=	-I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include $(ZLIB_INCLUDE)
11142425SnectarCFLAG=		-g
12142425SnectarMAKEDEPPROG=	makedepend
13142425SnectarMAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
14142425SnectarMAKEFILE=       Makefile
15142425SnectarRM=             rm -f
16243933SeadlerARFLAGS?=       r
17243933SeadlerAR=             ar ${ARFLAGS}
18142425Snectar
19160814SsimonRECURSIVE_MAKE=	[ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
20160814Ssimon		    (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
21238405Sjkim		    $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
22160814Ssimon		done;
23160814Ssimon
24142425SnectarPEX_LIBS=
25142425SnectarEX_LIBS=
26142425Snectar 
27142425SnectarCFLAGS= $(INCLUDE) $(CFLAG)
28160814SsimonASFLAGS= $(INCLUDE) $(ASFLAG)
29160814SsimonAFLAGS=$(ASFLAGS)
30238405SjkimCPUID_OBJ=mem_clr.o
31142425Snectar
32142425SnectarLIBS=
33142425Snectar
34142425SnectarGENERAL=Makefile README crypto-lib.com install.com
35273149SjkimTEST=constant_time_test.c
36142425Snectar
37142425SnectarLIB= $(TOP)/libcrypto.a
38142425SnectarSHARED_LIB= libcrypto$(SHLIB_EXT)
39238405SjkimLIBSRC=	cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
40238405Sjkim	ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c
41238405SjkimLIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o \
42238405Sjkim	uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ)
43142425Snectar
44142425SnectarSRC= $(LIBSRC)
45142425Snectar
46238405SjkimEXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
47142425Snectar	ossl_typ.h
48273149SjkimHEADER=	cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h \
49273149Sjkim	constant_time_locl.h $(EXHEADER)
50142425Snectar
51142425SnectarALL=    $(GENERAL) $(SRC) $(HEADER)
52142425Snectar
53142425Snectartop:
54142425Snectar	@(cd ..; $(MAKE) DIRS=$(DIR) all)
55142425Snectar
56238405Sjkimall: shared
57142425Snectar
58142425Snectarbuildinf.h: ../Makefile
59277597Sjkim	$(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" >buildinf.h
60142425Snectar
61238405Sjkimx86cpuid.s:	x86cpuid.pl perlasm/x86asm.pl
62238405Sjkim	$(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
63160814Ssimon
64238405Sjkimapplink.o:	$(TOP)/ms/applink.c
65238405Sjkim	$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
66160814Ssimon
67238405Sjkimuplink.o:	$(TOP)/ms/uplink.c applink.o
68238405Sjkim	$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
69160814Ssimon
70238405Sjkimuplink-x86.s:	$(TOP)/ms/uplink-x86.pl
71238405Sjkim	$(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
72160814Ssimon
73238405Sjkimx86_64cpuid.s: x86_64cpuid.pl;	$(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
74238405Sjkimia64cpuid.s: ia64cpuid.S;	$(CC) $(CFLAGS) -E ia64cpuid.S > $@
75238405Sjkimppccpuid.s:	ppccpuid.pl;	$(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
76238405Sjkimpariscid.s:	pariscid.pl;	$(PERL) pariscid.pl $(PERLASM_SCHEME) $@
77238405Sjkimalphacpuid.s:	alphacpuid.pl
78264331Sjkim	(preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
79264331Sjkim	$(PERL) alphacpuid.pl > $$preproc && \
80264331Sjkim	$(CC) -E $$preproc > $@ && rm $$preproc)
81238405Sjkim
82142425Snectartestapps:
83238405Sjkim	[ -z "$(THIS)" ] || (	if echo $(SDIRS) | fgrep ' des '; \
84160814Ssimon				then cd des && $(MAKE) -e des; fi )
85160814Ssimon	[ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps );
86160814Ssimon	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
87142425Snectar
88142425Snectarsubdirs:
89160814Ssimon	@target=all; $(RECURSIVE_MAKE)
90142425Snectar
91142425Snectarfiles:
92142425Snectar	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
93160814Ssimon	@target=files; $(RECURSIVE_MAKE)
94142425Snectar
95142425Snectarlinks:
96142425Snectar	@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
97142425Snectar	@$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
98142425Snectar	@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
99160814Ssimon	@target=links; $(RECURSIVE_MAKE)
100142425Snectar
101238405Sjkim# lib: $(LIB): are splitted to avoid end-less loop
102238405Sjkimlib:	$(LIB)
103160814Ssimon	@touch lib
104160814Ssimon$(LIB):	$(LIBOBJ)
105238405Sjkim	$(AR) $(LIB) $(LIBOBJ)
106238405Sjkim	[ -z "$(FIPSLIBDIR)" ] || $(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o
107142425Snectar	$(RANLIB) $(LIB) || echo Never mind.
108142425Snectar
109142425Snectarshared: buildinf.h lib subdirs
110142425Snectar	if [ -n "$(SHARED_LIBS)" ]; then \
111142425Snectar		(cd ..; $(MAKE) $(SHARED_LIB)); \
112142425Snectar	fi
113142425Snectar
114142425Snectarlibs:
115160814Ssimon	@target=lib; $(RECURSIVE_MAKE)
116142425Snectar
117142425Snectarinstall:
118160814Ssimon	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
119160814Ssimon	@headerlist="$(EXHEADER)"; for i in $$headerlist ;\
120142425Snectar	do \
121142425Snectar	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
122142425Snectar	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
123142425Snectar	done;
124160814Ssimon	@target=install; $(RECURSIVE_MAKE)
125142425Snectar
126142425Snectarlint:
127160814Ssimon	@target=lint; $(RECURSIVE_MAKE)
128142425Snectar
129284285Sjkimupdate: local_depend
130284285Sjkim	@[ -z "$(THIS)" ] || (set -e; target=update; $(RECURSIVE_MAKE) )
131284285Sjkim	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
132284285Sjkim
133284285Sjkimdepend: local_depend
134284285Sjkim	@[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
135284285Sjkim	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
136284285Sjkimlocal_depend:
137160814Ssimon	@[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
138160814Ssimon	@[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
139160814Ssimon	@[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
140142425Snectar
141142425Snectarclean:
142160814Ssimon	rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
143160814Ssimon	@target=clean; $(RECURSIVE_MAKE)
144142425Snectar
145142425Snectardclean:
146142425Snectar	$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
147142425Snectar	mv -f Makefile.new $(MAKEFILE)
148238405Sjkim	rm -f opensslconf.h
149160814Ssimon	@target=dclean; $(RECURSIVE_MAKE)
150142425Snectar
151142425Snectar# DO NOT DELETE THIS LINE -- make depend depends on it.
152142425Snectar
153142425Snectarcpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
154142425Snectarcpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
155142425Snectarcpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
156160814Ssimoncpt_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
157160814Ssimoncpt_err.o: ../include/openssl/safestack.h ../include/openssl/stack.h
158160814Ssimoncpt_err.o: ../include/openssl/symhacks.h cpt_err.c
159142425Snectarcryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
160142425Snectarcryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
161142425Snectarcryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h
162142425Snectarcryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
163160814Ssimoncryptlib.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
164160814Ssimoncryptlib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.c
165160814Ssimoncryptlib.o: cryptlib.h
166142425Snectarcversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
167142425Snectarcversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
168142425Snectarcversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
169142425Snectarcversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
170160814Ssimoncversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
171160814Ssimoncversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
172160814Ssimoncversion.o: cryptlib.h cversion.c
173142425Snectarebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
174142425Snectarex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
175142425Snectarex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
176142425Snectarex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
177142425Snectarex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
178160814Ssimonex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
179160814Ssimonex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
180160814Ssimonex_data.o: ex_data.c
181238405Sjkimfips_ers.o: ../include/openssl/opensslconf.h fips_ers.c
182142425Snectarmem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
183142425Snectarmem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
184142425Snectarmem.o: ../include/openssl/err.h ../include/openssl/lhash.h
185142425Snectarmem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
186160814Ssimonmem.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
187160814Ssimonmem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
188160814Ssimonmem.o: mem.c
189142425Snectarmem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
190142425Snectarmem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
191160814Ssimonmem_clr.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
192160814Ssimonmem_clr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h mem_clr.c
193142425Snectarmem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
194142425Snectarmem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
195142425Snectarmem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
196142425Snectarmem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
197160814Ssimonmem_dbg.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
198160814Ssimonmem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
199160814Ssimonmem_dbg.o: mem_dbg.c
200160814Ssimono_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
201160814Ssimono_dir.o: LPdir_unix.c o_dir.c o_dir.h
202238405Sjkimo_fips.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
203238405Sjkimo_fips.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
204238405Sjkimo_fips.o: ../include/openssl/err.h ../include/openssl/lhash.h
205238405Sjkimo_fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
206238405Sjkimo_fips.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
207238405Sjkimo_fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
208238405Sjkimo_fips.o: o_fips.c
209194206Ssimono_init.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/crypto.h
210194206Ssimono_init.o: ../include/openssl/e_os2.h ../include/openssl/err.h
211194206Ssimono_init.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
212194206Ssimono_init.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
213194206Ssimono_init.o: ../include/openssl/safestack.h ../include/openssl/stack.h
214194206Ssimono_init.o: ../include/openssl/symhacks.h o_init.c
215160814Ssimono_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
216160814Ssimono_str.o: o_str.c o_str.h
217142425Snectaro_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
218142425Snectaro_time.o: o_time.h
219142425Snectaruid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
220142425Snectaruid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
221160814Ssimonuid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
222160814Ssimonuid.o: ../include/openssl/stack.h ../include/openssl/symhacks.h uid.c
223