aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Makefile
blob: 3e4695165623466811cee760690e2e7101e930e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
TESTS=test-base64 test-md4 test-md5 test-milenage test-ms_funcs test-sha1 \
	test-sha256 test-aes test-asn1 test-x509

all: $(TESTS)

ifndef CC
CC=gcc
endif

ifndef LDO
LDO=$(CC)
endif

ifndef CFLAGS
CFLAGS = -MMD -O2 -Wall -g
endif

CFLAGS += -I../src
CFLAGS += -I../src/utils

SLIBS = ../src/utils/libutils.a

DLIBS = ../src/crypto/libcrypto.a \
	../src/tls/libtls.a

LIBS = $(SLIBS) $(DLIBS)
LLIBS = -Wl,--start-group $(DLIBS) -Wl,--end-group $(SLIBS)

../src/utils/libutils.a:
	$(MAKE) -C ../src/utils

../src/crypto/libcrypto.a:
	$(MAKE) -C ../src/crypto

../src/tls/libtls.a:
	$(MAKE) -C ../src/tls


test-aes: test-aes.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-asn1: test-asn1.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-base64: test-base64.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-md4: test-md4.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-md5: test-md5.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-milenage: test-milenage.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-ms_funcs: test-ms_funcs.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-sha1: test-sha1.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-sha256: test-sha256.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^

test-x509: test-x509.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)


run-tests: $(TESTS)
	./test-aes
	./test-md4
	./test-md5
	./test-milenage
	./test-sha1
	./test-sha256
	@echo
	@echo All tests completed successfully.

clean:
	$(MAKE) -C ../src clean
	rm -f $(TESTS) *~ *.o *.d

-include $(OBJS:%.o=%.d)