Fool-proofing Makefiles
[oweals/openssl.git] / crypto / md5 / Makefile
1 #
2 # SSLeay/crypto/md5/Makefile
3 #
4
5 DIR=    md5
6 TOP=    ../..
7 CC=     cc
8 CPP=    $(CC) -E
9 INCLUDES=-I.. -I$(TOP) -I../../include
10 CFLAG=-g
11 MAKEDEPPROG=    makedepend
12 MAKEDEPEND=     $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
13 MAKEFILE=       Makefile
14 AR=             ar r
15
16 MD5_ASM_OBJ=
17
18 CFLAGS= $(INCLUDES) $(CFLAG)
19 ASFLAGS= $(INCLUDES) $(ASFLAG)
20 AFLAGS= $(ASFLAGS)
21
22 GENERAL=Makefile
23 TEST=md5test.c
24 APPS=
25
26 LIB=$(TOP)/libcrypto.a
27 LIBSRC=md5_dgst.c md5_one.c
28 LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ)
29
30 SRC= $(LIBSRC)
31
32 EXHEADER= md5.h
33 HEADER= md5_locl.h $(EXHEADER)
34
35 ALL=    $(GENERAL) $(SRC) $(HEADER)
36
37 top:
38         (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
39
40 all:    lib
41
42 lib:    $(LIBOBJ)
43         $(AR) $(LIB) $(LIBOBJ)
44         $(RANLIB) $(LIB) || echo Never mind.
45         @touch lib
46
47 # ELF
48 mx86-elf.s: asm/md5-586.pl ../perlasm/x86asm.pl
49         (cd asm; $(PERL) md5-586.pl elf $(CFLAGS) > ../$@)
50 # COFF
51 mx86-cof.s: asm/md5-586.pl ../perlasm/x86asm.pl
52         (cd asm; $(PERL) md5-586.pl coff $(CFLAGS) > ../$@)
53 # a.out
54 mx86-out.s: asm/md5-586.pl ../perlasm/x86asm.pl
55         (cd asm; $(PERL) md5-586.pl a.out $(CFLAGS) > ../$@)
56
57 md5-sparcv8plus.o: asm/md5-sparcv9.S
58         $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \
59                 -o md5-sparcv8plus.o asm/md5-sparcv9.S
60
61 # Old GNU assembler doesn't understand V9 instructions, so we
62 # hire /usr/ccs/bin/as to do the job. Note that option is called
63 # *-gcc27, but even gcc 2>=8 users may experience similar problem
64 # if they didn't bother to upgrade GNU assembler. Such users should
65 # not choose this option, but be adviced to *remove* GNU assembler
66 # or upgrade it.
67 md5-sparcv8plus-gcc27.o: asm/md5-sparcv9.S
68         $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -E asm/md5-sparcv9.S | \
69                 /usr/ccs/bin/as -xarch=v8plus - -o md5-sparcv8plus-gcc27.o
70
71 md5-sparcv9.o: asm/md5-sparcv9.S
72         $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \
73                 -o md5-sparcv9.o asm/md5-sparcv9.S
74
75 md5-x86_64.s:   asm/md5-x86_64.pl;      $(PERL) asm/md5-x86_64.pl $@
76
77 files:
78         $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
79
80 links:
81         @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
82         @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
83         @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
84
85 install:
86         @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
87         @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
88         do  \
89         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
90         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
91         done;
92
93 tags:
94         ctags $(SRC)
95
96 tests:
97
98 lint:
99         lint -DLINT $(INCLUDES) $(SRC)>fluff
100
101 depend:
102         $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
103
104 dclean:
105         $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
106         mv -f Makefile.new $(MAKEFILE)
107
108 clean:
109         rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
110
111 # DO NOT DELETE THIS LINE -- make depend depends on it.
112
113 md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md5.h
114 md5_dgst.o: ../../include/openssl/opensslconf.h
115 md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c
116 md5_dgst.o: md5_locl.h
117 md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
118 md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
119 md5_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
120 md5_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
121 md5_one.o: ../../include/openssl/symhacks.h md5_one.c