blob: 74c1a32fc1a6251d381a723d0aea70a9434961fe [file] [log] [blame]
Paul Bakker0049c2f2009-07-11 19:15:43 +00001
2# To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS
3# To compile on MinGW: add "-lws2_32" to LDFLAGS
Paul Bakker43b7e352011-01-18 15:27:19 +00004# To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS
Paul Bakker0049c2f2009-07-11 19:15:43 +00005
Paul Bakker46eb1382011-01-30 17:10:13 +00006CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement \
Paul Bakker0049c2f2009-07-11 19:15:43 +00007 -Wno-unused-function -Wno-unused-value
8
9OFLAGS = -O
Paul Bakker46eb1382011-01-30 17:10:13 +000010LDFLAGS += -L../library -lpolarssl
Paul Bakker0049c2f2009-07-11 19:15:43 +000011
12APPS = test_suite_aes test_suite_arc4 \
13 test_suite_base64 test_suite_camellia \
14 test_suite_des test_suite_dhm \
15 test_suite_hmac_shax test_suite_mdx \
16 test_suite_mpi test_suite_rsa \
17 test_suite_shax test_suite_x509parse\
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000018 test_suite_xtea test_suite_debug \
Paul Bakker8123e9d2011-01-06 15:37:30 +000019 test_suite_version test_suite_md \
Paul Bakker9dcc3222011-03-08 14:16:06 +000020 test_suite_cipher test_suite_pkcs1_v21
Paul Bakker0049c2f2009-07-11 19:15:43 +000021
22.SILENT:
23
24all: $(APPS)
25
Paul Bakker4fa1a762011-03-13 16:56:11 +000026%.c : suites/%.function suites/%.data scripts/generate_code.pl suites/helpers.function
Paul Bakker0049c2f2009-07-11 19:15:43 +000027 echo " Generate $@"
28 scripts/generate_code.pl suites $*
29
30test_suite_aes: test_suite_aes.c ../library/libpolarssl.a
31 echo " CC $@.c"
32 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
33
34test_suite_arc4: test_suite_arc4.c ../library/libpolarssl.a
35 echo " CC $@.c"
36 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
37
38test_suite_base64: test_suite_base64.c ../library/libpolarssl.a
39 echo " CC $@.c"
40 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
41
42test_suite_camellia: test_suite_camellia.c ../library/libpolarssl.a
43 echo " CC $@.c"
44 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
45
Paul Bakker8123e9d2011-01-06 15:37:30 +000046test_suite_cipher: test_suite_cipher.c ../library/libpolarssl.a
47 echo " CC $@.c"
48 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
49
Paul Bakker0049c2f2009-07-11 19:15:43 +000050test_suite_des: test_suite_des.c ../library/libpolarssl.a
51 echo " CC $@.c"
52 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
53
54test_suite_dhm: test_suite_dhm.c ../library/libpolarssl.a
55 echo " CC $@.c"
56 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
57
58test_suite_hmac_shax: test_suite_hmac_shax.c ../library/libpolarssl.a
59 echo " CC $@.c"
60 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
61
Paul Bakker17373852011-01-06 14:20:01 +000062test_suite_md: test_suite_md.c ../library/libpolarssl.a
63 echo " CC $@.c"
64 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
65
Paul Bakker0049c2f2009-07-11 19:15:43 +000066test_suite_mdx: test_suite_mdx.c ../library/libpolarssl.a
67 echo " CC $@.c"
68 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
69
70test_suite_mpi: test_suite_mpi.c ../library/libpolarssl.a
71 echo " CC $@.c"
72 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
73
Paul Bakker9dcc3222011-03-08 14:16:06 +000074test_suite_pkcs1_v21: test_suite_pkcs1_v21.c ../library/libpolarssl.a
75 echo " CC $@.c"
76 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
77
Paul Bakker0049c2f2009-07-11 19:15:43 +000078test_suite_rsa: test_suite_rsa.c ../library/libpolarssl.a
79 echo " CC $@.c"
80 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
81
82test_suite_shax: test_suite_shax.c ../library/libpolarssl.a
83 echo " CC $@.c"
84 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
85
86test_suite_x509parse: test_suite_x509parse.c ../library/libpolarssl.a
87 echo " CC $@.c"
88 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
89
90test_suite_xtea: test_suite_xtea.c ../library/libpolarssl.a
91 echo " CC $@.c"
92 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
93
Paul Bakker7d7f4f42010-02-18 18:26:04 +000094test_suite_debug: test_suite_debug.c ../library/libpolarssl.a
95 echo " CC $@.c"
96 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
97
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000098test_suite_version: test_suite_version.c ../library/libpolarssl.a
99 echo " CC $@.c"
100 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
101
Paul Bakker0049c2f2009-07-11 19:15:43 +0000102clean:
103 rm -f $(APPS) *.c
104
Paul Bakker9794cb42009-07-28 18:55:00 +0000105check: $(APPS)
Paul Bakkerd947d762009-07-28 20:16:47 +0000106 echo "Running checks (Success if all tests PASSED)"
107 for i in $(APPS); \
108 do \
109 echo " - $${i}"; \
110 ./$${i} | grep -v 'PASS$$' | grep -v -- '-----' | grep -v '^$$'; \
111 echo ""; \
112 done