Fix test-{md5,sha1} builds
[mech_eap.git] / tests / Makefile
1 TESTS=test-base64 test-md4 test-md5 test-milenage test-ms_funcs \
2         test-printf \
3         test-sha1 \
4         test-sha256 test-aes test-asn1 test-x509 test-x509v3 test-list test-rc4
5
6 all: $(TESTS)
7
8 ifndef CC
9 CC=gcc
10 endif
11
12 ifndef LDO
13 LDO=$(CC)
14 endif
15
16 ifndef CFLAGS
17 CFLAGS = -MMD -O2 -Wall -g
18 endif
19
20 CFLAGS += -I../src
21 CFLAGS += -I../src/utils
22
23 SLIBS = ../src/utils/libutils.a
24
25 DLIBS = ../src/crypto/libcrypto.a \
26         ../src/tls/libtls.a
27
28 LIBS = $(SLIBS) $(DLIBS)
29 LLIBS = -Wl,--start-group $(DLIBS) -Wl,--end-group $(SLIBS)
30
31 ../src/utils/libutils.a:
32         $(MAKE) -C ../src/utils
33
34 ../src/crypto/libcrypto.a:
35         $(MAKE) -C ../src/crypto
36
37 ../src/tls/libtls.a:
38         $(MAKE) -C ../src/tls
39
40
41 test-aes: test-aes.o $(LIBS)
42         $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
43
44 test-asn1: test-asn1.o $(LIBS)
45         $(LDO) $(LDFLAGS) -o $@ $^
46
47 test-base64: test-base64.o $(LIBS)
48         $(LDO) $(LDFLAGS) -o $@ $^
49
50 test-https: test-https.o $(LIBS)
51         $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
52
53 test-list: test-list.o $(LIBS)
54         $(LDO) $(LDFLAGS) -o $@ $^
55
56 test-md4: test-md4.o $(LIBS)
57         $(LDO) $(LDFLAGS) -o $@ $^
58
59 test-md5: test-md5.o $(LIBS)
60         $(LDO) $(LDFLAGS) -o $@ $^ $(LIBS)
61
62 test-milenage: test-milenage.o $(LIBS)
63         $(LDO) $(LDFLAGS) -o $@ $^
64
65 test-ms_funcs: test-ms_funcs.o $(LIBS)
66         $(LDO) $(LDFLAGS) -o $@ $^
67
68 test-printf: test-printf.o $(LIBS)
69         $(LDO) $(LDFLAGS) -o $@ $^
70
71 test-rc4: test-rc4.o $(LIBS)
72         $(LDO) $(LDFLAGS) -o $@ $^
73
74 test-sha1: test-sha1.o $(LIBS)
75         $(LDO) $(LDFLAGS) -o $@ $^ $(LIBS)
76
77 test-sha256: test-sha256.o $(LIBS)
78         $(LDO) $(LDFLAGS) -o $@ $^
79
80 test-x509: test-x509.o $(LIBS)
81         $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
82
83 test-x509v3: test-x509v3.o $(LIBS)
84         $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
85
86
87 run-tests: $(TESTS)
88         ./test-aes
89         ./test-list
90         ./test-md4
91         ./test-md5
92         ./test-milenage
93         ./test-printf
94         ./test-sha1
95         ./test-sha256
96         @echo
97         @echo All tests completed successfully.
98
99 clean:
100         $(MAKE) -C ../src clean
101         rm -f $(TESTS) *~ *.o *.d
102         rm -f test-https
103         rm -f test_x509v3_nist.out.*
104         rm -f test_x509v3_nist2.out.*
105
106 -include $(OBJS:%.o=%.d)