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