Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 1 | |
| 2 | # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS |
| 3 | # To compile on MinGW: add "-lws2_32" to LDFLAGS |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 4 | # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 5 | |
Paul Bakker | 46eb138 | 2011-01-30 17:10:13 +0000 | [diff] [blame] | 6 | CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement \ |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 7 | -Wno-unused-function -Wno-unused-value |
| 8 | |
| 9 | OFLAGS = -O |
Paul Bakker | 46eb138 | 2011-01-30 17:10:13 +0000 | [diff] [blame] | 10 | LDFLAGS += -L../library -lpolarssl |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 11 | |
| 12 | APPS = 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 Bakker | 3ac1b2d | 2010-06-18 22:47:29 +0000 | [diff] [blame] | 18 | test_suite_xtea test_suite_debug \ |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 19 | test_suite_version test_suite_md \ |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 20 | test_suite_cipher test_suite_pkcs1_v21 |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 21 | |
| 22 | .SILENT: |
| 23 | |
| 24 | all: $(APPS) |
| 25 | |
| 26 | %.c : suites/%.function suites/%.data scripts/generate_code.pl |
| 27 | echo " Generate $@" |
| 28 | scripts/generate_code.pl suites $* |
| 29 | |
| 30 | test_suite_aes: test_suite_aes.c ../library/libpolarssl.a |
| 31 | echo " CC $@.c" |
| 32 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 33 | |
| 34 | test_suite_arc4: test_suite_arc4.c ../library/libpolarssl.a |
| 35 | echo " CC $@.c" |
| 36 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 37 | |
| 38 | test_suite_base64: test_suite_base64.c ../library/libpolarssl.a |
| 39 | echo " CC $@.c" |
| 40 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 41 | |
| 42 | test_suite_camellia: test_suite_camellia.c ../library/libpolarssl.a |
| 43 | echo " CC $@.c" |
| 44 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 45 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 46 | test_suite_cipher: test_suite_cipher.c ../library/libpolarssl.a |
| 47 | echo " CC $@.c" |
| 48 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 49 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 50 | test_suite_des: test_suite_des.c ../library/libpolarssl.a |
| 51 | echo " CC $@.c" |
| 52 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 53 | |
| 54 | test_suite_dhm: test_suite_dhm.c ../library/libpolarssl.a |
| 55 | echo " CC $@.c" |
| 56 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 57 | |
| 58 | test_suite_hmac_shax: test_suite_hmac_shax.c ../library/libpolarssl.a |
| 59 | echo " CC $@.c" |
| 60 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 61 | |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 62 | test_suite_md: test_suite_md.c ../library/libpolarssl.a |
| 63 | echo " CC $@.c" |
| 64 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 65 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 66 | test_suite_mdx: test_suite_mdx.c ../library/libpolarssl.a |
| 67 | echo " CC $@.c" |
| 68 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 69 | |
| 70 | test_suite_mpi: test_suite_mpi.c ../library/libpolarssl.a |
| 71 | echo " CC $@.c" |
| 72 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 73 | |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 74 | test_suite_pkcs1_v21: test_suite_pkcs1_v21.c ../library/libpolarssl.a |
| 75 | echo " CC $@.c" |
| 76 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 77 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 78 | test_suite_rsa: test_suite_rsa.c ../library/libpolarssl.a |
| 79 | echo " CC $@.c" |
| 80 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 81 | |
| 82 | test_suite_shax: test_suite_shax.c ../library/libpolarssl.a |
| 83 | echo " CC $@.c" |
| 84 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 85 | |
| 86 | test_suite_x509parse: test_suite_x509parse.c ../library/libpolarssl.a |
| 87 | echo " CC $@.c" |
| 88 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 89 | |
| 90 | test_suite_xtea: test_suite_xtea.c ../library/libpolarssl.a |
| 91 | echo " CC $@.c" |
| 92 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 93 | |
Paul Bakker | 7d7f4f4 | 2010-02-18 18:26:04 +0000 | [diff] [blame] | 94 | test_suite_debug: test_suite_debug.c ../library/libpolarssl.a |
| 95 | echo " CC $@.c" |
| 96 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 97 | |
Paul Bakker | 3ac1b2d | 2010-06-18 22:47:29 +0000 | [diff] [blame] | 98 | test_suite_version: test_suite_version.c ../library/libpolarssl.a |
| 99 | echo " CC $@.c" |
| 100 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 101 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 102 | clean: |
| 103 | rm -f $(APPS) *.c |
| 104 | |
Paul Bakker | 9794cb4 | 2009-07-28 18:55:00 +0000 | [diff] [blame] | 105 | check: $(APPS) |
Paul Bakker | d947d76 | 2009-07-28 20:16:47 +0000 | [diff] [blame] | 106 | 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 |