blob: ba4052fb3b0bf125516695da0a6637ed34dff599 [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 Bakkera585beb2011-06-21 08:59:44 +000010LDFLAGS += -L../library -lpolarssl $(SYS_LDFLAGS)
Paul Bakker0049c2f2009-07-11 19:15:43 +000011
Paul Bakker9d781402011-05-09 16:17:09 +000012APPS = test_suite_aes test_suite_arc4 \
13 test_suite_base64 test_suite_camellia \
Paul Bakker46c17942011-07-13 14:54:54 +000014 test_suite_cipher.aes test_suite_cipher.camellia \
15 test_suite_cipher.des test_suite_debug \
Paul Bakker9d781402011-05-09 16:17:09 +000016 test_suite_des test_suite_dhm \
17 test_suite_error test_suite_hmac_shax \
18 test_suite_md test_suite_mdx \
19 test_suite_mpi test_suite_pkcs1_v21 \
20 test_suite_rsa test_suite_shax \
21 test_suite_x509parse test_suite_xtea \
22 test_suite_version
Paul Bakker0049c2f2009-07-11 19:15:43 +000023
24.SILENT:
25
26all: $(APPS)
27
Paul Bakker46c17942011-07-13 14:54:54 +000028test_suite_cipher.aes.c : suites/test_suite_cipher.function suites/test_suite_cipher.aes.data scripts/generate_code.pl suites/helpers.function
29 echo " Generate $@"
30 scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.aes
31
32test_suite_cipher.camellia.c : suites/test_suite_cipher.function suites/test_suite_cipher.camellia.data scripts/generate_code.pl suites/helpers.function
33 echo " Generate $@"
34 scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.camellia
35
36test_suite_cipher.des.c : suites/test_suite_cipher.function suites/test_suite_cipher.des.data scripts/generate_code.pl suites/helpers.function
37 echo " Generate $@"
38 scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.des
39
Paul Bakker4fa1a762011-03-13 16:56:11 +000040%.c : suites/%.function suites/%.data scripts/generate_code.pl suites/helpers.function
Paul Bakker0049c2f2009-07-11 19:15:43 +000041 echo " Generate $@"
Paul Bakker46c17942011-07-13 14:54:54 +000042 scripts/generate_code.pl suites $* $*
Paul Bakker0049c2f2009-07-11 19:15:43 +000043
44test_suite_aes: test_suite_aes.c ../library/libpolarssl.a
45 echo " CC $@.c"
46 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
47
48test_suite_arc4: test_suite_arc4.c ../library/libpolarssl.a
49 echo " CC $@.c"
50 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
51
52test_suite_base64: test_suite_base64.c ../library/libpolarssl.a
53 echo " CC $@.c"
54 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
55
56test_suite_camellia: test_suite_camellia.c ../library/libpolarssl.a
57 echo " CC $@.c"
58 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
59
Paul Bakker46c17942011-07-13 14:54:54 +000060test_suite_cipher.aes: test_suite_cipher.aes.c ../library/libpolarssl.a
61 echo " CC $@.c"
62 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
63
64test_suite_cipher.camellia: test_suite_cipher.camellia.c ../library/libpolarssl.a
65 echo " CC $@.c"
66 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
67
68test_suite_cipher.des: test_suite_cipher.des.c ../library/libpolarssl.a
Paul Bakker8123e9d2011-01-06 15:37:30 +000069 echo " CC $@.c"
70 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
71
Paul Bakker0049c2f2009-07-11 19:15:43 +000072test_suite_des: test_suite_des.c ../library/libpolarssl.a
73 echo " CC $@.c"
74 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
75
76test_suite_dhm: test_suite_dhm.c ../library/libpolarssl.a
77 echo " CC $@.c"
78 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
79
Paul Bakker9d781402011-05-09 16:17:09 +000080test_suite_error: test_suite_error.c ../library/libpolarssl.a
81 echo " CC $@.c"
82 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
83
Paul Bakker0049c2f2009-07-11 19:15:43 +000084test_suite_hmac_shax: test_suite_hmac_shax.c ../library/libpolarssl.a
85 echo " CC $@.c"
86 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
87
Paul Bakker17373852011-01-06 14:20:01 +000088test_suite_md: test_suite_md.c ../library/libpolarssl.a
89 echo " CC $@.c"
90 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
91
Paul Bakker0049c2f2009-07-11 19:15:43 +000092test_suite_mdx: test_suite_mdx.c ../library/libpolarssl.a
93 echo " CC $@.c"
94 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
95
96test_suite_mpi: test_suite_mpi.c ../library/libpolarssl.a
97 echo " CC $@.c"
98 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
99
Paul Bakker9dcc3222011-03-08 14:16:06 +0000100test_suite_pkcs1_v21: test_suite_pkcs1_v21.c ../library/libpolarssl.a
101 echo " CC $@.c"
102 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
103
Paul Bakker0049c2f2009-07-11 19:15:43 +0000104test_suite_rsa: test_suite_rsa.c ../library/libpolarssl.a
105 echo " CC $@.c"
106 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
107
108test_suite_shax: test_suite_shax.c ../library/libpolarssl.a
109 echo " CC $@.c"
110 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
111
112test_suite_x509parse: test_suite_x509parse.c ../library/libpolarssl.a
113 echo " CC $@.c"
114 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
115
116test_suite_xtea: test_suite_xtea.c ../library/libpolarssl.a
117 echo " CC $@.c"
118 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
119
Paul Bakker7d7f4f42010-02-18 18:26:04 +0000120test_suite_debug: test_suite_debug.c ../library/libpolarssl.a
121 echo " CC $@.c"
122 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
123
Paul Bakker3ac1b2d2010-06-18 22:47:29 +0000124test_suite_version: test_suite_version.c ../library/libpolarssl.a
125 echo " CC $@.c"
126 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
127
Paul Bakker0049c2f2009-07-11 19:15:43 +0000128clean:
129 rm -f $(APPS) *.c
130
Paul Bakker9794cb42009-07-28 18:55:00 +0000131check: $(APPS)
Paul Bakkerd947d762009-07-28 20:16:47 +0000132 echo "Running checks (Success if all tests PASSED)"
133 for i in $(APPS); \
134 do \
135 echo " - $${i}"; \
136 ./$${i} | grep -v 'PASS$$' | grep -v -- '-----' | grep -v '^$$'; \
137 echo ""; \
138 done