Fix potential buffer overrun
[openssl.git] / crypto / Makefile.in
1 #
2 # OpenSSL/crypto/Makefile
3 #
4
5 DIR=            crypto
6 TOP=            ..
7 CC=             cc
8 INCLUDE=        -I. -I$(TOP) -I../include -Iinclude $(ZLIB_INCLUDE)
9 # INCLUDES targets sudbirs!
10 INCLUDES=       -I.. -I../.. -I../modes -I../include -I../../include $(ZLIB_INCLUDE)
11 CFLAG=          -g
12 MAKEFILE=       Makefile
13 RM=             rm -f
14 AR=             ar r
15
16 RECURSIVE_MAKE= [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
17                     (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
18                     $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
19                 done;
20
21 LDFLAGS=
22 EX_LIBS=
23
24 CFLAGS= $(INCLUDE) $(CFLAG)
25 ASFLAGS= $(INCLUDE) $(ASFLAG)
26 AFLAGS=$(ASFLAGS)
27 CPUID_OBJ=mem_clr.o
28
29 LIBS=
30
31 GENERAL=Makefile README crypto-lib.com install.com
32
33 LIB= $(TOP)/libcrypto.a
34 SHARED_LIB= libcrypto$(SHLIB_EXT)
35 LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
36         ebcdic.c uid.c o_time.c o_str.c o_dir.c thr_id.c lock.c fips_ers.c \
37         o_init.c o_fips.c mem_sec.c
38 LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o \
39         ebcdic.o uid.o o_time.o o_str.o o_dir.o thr_id.o lock.o fips_ers.o \
40         o_init.o o_fips.o mem_sec.o $(CPUID_OBJ)
41
42 SRC= $(LIBSRC)
43
44 HEADER= buildinf.h arm_arch.h ppc_arch.h sparc_arch.h
45
46 ALL=    $(GENERAL) $(SRC) $(HEADER)
47
48 top:
49         @(cd ..; $(MAKE) DIRS=$(DIR) all)
50
51 all: shared
52
53 fips: cryptlib.o thr_id.o uid.o $(CPUID_OBJ)
54         [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
55                     ( obj=`$(PERL) $(TOP)/util/fipsobj.pl $$i` && \
56                         cd $$i && echo "making fips in $(DIR)/$$i..." && \
57                     $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$obj ) || exit 1; \
58                 done;
59
60 buildinf.h: ../Makefile
61         $(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" >buildinf.h
62
63 x86cpuid.s:     x86cpuid.pl perlasm/x86asm.pl
64         $(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
65
66 applink.o:      $(TOP)/ms/applink.c
67         $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
68
69 uplink.o:       $(TOP)/ms/uplink.c applink.o
70         $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
71
72 uplink-x86.s:   $(TOP)/ms/uplink-x86.pl
73         $(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
74
75 x86_64cpuid.s:  x86_64cpuid.pl; $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
76 ia64cpuid.s:    ia64cpuid.S;    $(CC) $(CFLAGS) -E ia64cpuid.S > $@
77 ppccpuid.s:     ppccpuid.pl;    $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
78 pariscid.s:     pariscid.pl;    $(PERL) pariscid.pl $(PERLASM_SCHEME) $@
79 alphacpuid.s:   alphacpuid.pl
80         (preproc=$$$$.$@.S; trap "rm $$preproc" INT; \
81         $(PERL) alphacpuid.pl > $$preproc && \
82         $(CC) -E -P $$preproc > $@ && rm $$preproc)
83 arm64cpuid.S:   arm64cpuid.pl;  $(PERL) arm64cpuid.pl $(PERLASM_SCHEME) > $@
84 armv4cpuid.S:   armv4cpuid.pl;  $(PERL) armv4cpuid.pl $(PERLASM_SCHEME) > $@
85
86 subdirs:
87         @target=all; $(RECURSIVE_MAKE)
88
89 files:
90         $(PERL) $(TOP)/util/files.pl "CPUID_OBJ=$(CPUID_OBJ)" Makefile >> $(TOP)/MINFO
91         @target=files; $(RECURSIVE_MAKE)
92
93 # lib: $(LIB): are splitted to avoid end-less loop
94 lib:    $(LIB)
95         @touch lib
96 $(LIB): $(LIBOBJ)
97         $(AR) $(LIB) $(LIBOBJ)
98         $(RANLIB) $(LIB) || echo Never mind.
99
100 shared: buildinf.h lib subdirs
101         if [ -n "$(SHARED_LIBS)" ]; then \
102                 (cd ..; $(MAKE) $(SHARED_LIB)); \
103         fi
104
105 libs:
106         @target=lib; $(RECURSIVE_MAKE)
107
108 depend:
109         @[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
110         @[ -z "$(THIS)" ] || $(TOP)/util/domd $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
111         @[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
112         @[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
113         @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
114 clean:
115         rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
116         @target=clean; $(RECURSIVE_MAKE)
117
118 # DO NOT DELETE THIS LINE -- make depend depends on it.