blob: ec1ce88d7083f9935712649ba7be4c90e2231650 [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 \
Paul Bakkerfab5c822012-02-06 16:45:10 +000015 test_suite_cipher.des test_suite_cipher.null \
16 test_suite_ctr_drbg test_suite_debug \
Paul Bakker9d781402011-05-09 16:17:09 +000017 test_suite_des test_suite_dhm \
18 test_suite_error test_suite_hmac_shax \
19 test_suite_md test_suite_mdx \
20 test_suite_mpi test_suite_pkcs1_v21 \
21 test_suite_rsa test_suite_shax \
Paul Bakker6d620502012-02-16 14:09:13 +000022 test_suite_x509parse test_suite_x509write \
23 test_suite_xtea test_suite_version
Paul Bakker0049c2f2009-07-11 19:15:43 +000024
25.SILENT:
26
27all: $(APPS)
28
Paul Bakker46c17942011-07-13 14:54:54 +000029test_suite_cipher.aes.c : suites/test_suite_cipher.function suites/test_suite_cipher.aes.data scripts/generate_code.pl suites/helpers.function
30 echo " Generate $@"
31 scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.aes
32
33test_suite_cipher.camellia.c : suites/test_suite_cipher.function suites/test_suite_cipher.camellia.data scripts/generate_code.pl suites/helpers.function
34 echo " Generate $@"
35 scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.camellia
36
37test_suite_cipher.des.c : suites/test_suite_cipher.function suites/test_suite_cipher.des.data scripts/generate_code.pl suites/helpers.function
38 echo " Generate $@"
39 scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.des
40
Paul Bakkerfab5c822012-02-06 16:45:10 +000041test_suite_cipher.null.c : suites/test_suite_cipher.function suites/test_suite_cipher.null.data scripts/generate_code.pl suites/helpers.function
42 echo " Generate $@"
43 scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.null
44
Paul Bakker4fa1a762011-03-13 16:56:11 +000045%.c : suites/%.function suites/%.data scripts/generate_code.pl suites/helpers.function
Paul Bakker0049c2f2009-07-11 19:15:43 +000046 echo " Generate $@"
Paul Bakker46c17942011-07-13 14:54:54 +000047 scripts/generate_code.pl suites $* $*
Paul Bakker0049c2f2009-07-11 19:15:43 +000048
49test_suite_aes: test_suite_aes.c ../library/libpolarssl.a
50 echo " CC $@.c"
51 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
52
53test_suite_arc4: test_suite_arc4.c ../library/libpolarssl.a
54 echo " CC $@.c"
55 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
56
57test_suite_base64: test_suite_base64.c ../library/libpolarssl.a
58 echo " CC $@.c"
59 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
60
61test_suite_camellia: test_suite_camellia.c ../library/libpolarssl.a
62 echo " CC $@.c"
63 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
64
Paul Bakker46c17942011-07-13 14:54:54 +000065test_suite_cipher.aes: test_suite_cipher.aes.c ../library/libpolarssl.a
66 echo " CC $@.c"
67 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
68
69test_suite_cipher.camellia: test_suite_cipher.camellia.c ../library/libpolarssl.a
70 echo " CC $@.c"
71 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
72
Paul Bakkerfab5c822012-02-06 16:45:10 +000073test_suite_cipher.des: test_suite_cipher.des.c ../library/libpolarssl.a
Paul Bakker0e04d0e2011-11-27 14:46:59 +000074 echo " CC $@.c"
75 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
76
Paul Bakkerfab5c822012-02-06 16:45:10 +000077test_suite_cipher.null: test_suite_cipher.null.c ../library/libpolarssl.a
78 echo " CC $@.c"
79 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
80
81test_suite_ctr_drbg: test_suite_ctr_drbg.c ../library/libpolarssl.a
Paul Bakker8123e9d2011-01-06 15:37:30 +000082 echo " CC $@.c"
83 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
84
Paul Bakker0049c2f2009-07-11 19:15:43 +000085test_suite_des: test_suite_des.c ../library/libpolarssl.a
86 echo " CC $@.c"
87 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
88
89test_suite_dhm: test_suite_dhm.c ../library/libpolarssl.a
90 echo " CC $@.c"
91 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
92
Paul Bakker9d781402011-05-09 16:17:09 +000093test_suite_error: test_suite_error.c ../library/libpolarssl.a
94 echo " CC $@.c"
95 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
96
Paul Bakker0049c2f2009-07-11 19:15:43 +000097test_suite_hmac_shax: test_suite_hmac_shax.c ../library/libpolarssl.a
98 echo " CC $@.c"
99 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
100
Paul Bakker17373852011-01-06 14:20:01 +0000101test_suite_md: test_suite_md.c ../library/libpolarssl.a
102 echo " CC $@.c"
103 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
104
Paul Bakker0049c2f2009-07-11 19:15:43 +0000105test_suite_mdx: test_suite_mdx.c ../library/libpolarssl.a
106 echo " CC $@.c"
107 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
108
109test_suite_mpi: test_suite_mpi.c ../library/libpolarssl.a
110 echo " CC $@.c"
111 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
112
Paul Bakker9dcc3222011-03-08 14:16:06 +0000113test_suite_pkcs1_v21: test_suite_pkcs1_v21.c ../library/libpolarssl.a
114 echo " CC $@.c"
115 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
116
Paul Bakker0049c2f2009-07-11 19:15:43 +0000117test_suite_rsa: test_suite_rsa.c ../library/libpolarssl.a
118 echo " CC $@.c"
119 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
120
121test_suite_shax: test_suite_shax.c ../library/libpolarssl.a
122 echo " CC $@.c"
123 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
124
125test_suite_x509parse: test_suite_x509parse.c ../library/libpolarssl.a
126 echo " CC $@.c"
127 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
128
Paul Bakker6d620502012-02-16 14:09:13 +0000129test_suite_x509write: test_suite_x509write.c ../library/libpolarssl.a
130 echo " CC $@.c"
131 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
132
Paul Bakker0049c2f2009-07-11 19:15:43 +0000133test_suite_xtea: test_suite_xtea.c ../library/libpolarssl.a
134 echo " CC $@.c"
135 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
136
Paul Bakker7d7f4f42010-02-18 18:26:04 +0000137test_suite_debug: test_suite_debug.c ../library/libpolarssl.a
138 echo " CC $@.c"
139 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
140
Paul Bakker3ac1b2d2010-06-18 22:47:29 +0000141test_suite_version: test_suite_version.c ../library/libpolarssl.a
142 echo " CC $@.c"
143 $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
144
Paul Bakker0049c2f2009-07-11 19:15:43 +0000145clean:
146 rm -f $(APPS) *.c
147
Paul Bakker9794cb42009-07-28 18:55:00 +0000148check: $(APPS)
Paul Bakkerd947d762009-07-28 20:16:47 +0000149 echo "Running checks (Success if all tests PASSED)"
150 for i in $(APPS); \
151 do \
152 echo " - $${i}"; \
153 ./$${i} | grep -v 'PASS$$' | grep -v -- '-----' | grep -v '^$$'; \
154 echo ""; \
155 done