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 | |
Paul Bakker | 9d78140 | 2011-05-09 16:17:09 +0000 | [diff] [blame] | 12 | APPS = test_suite_aes test_suite_arc4 \ |
| 13 | test_suite_base64 test_suite_camellia \ |
| 14 | test_suite_cipher test_suite_debug \ |
| 15 | test_suite_des test_suite_dhm \ |
| 16 | test_suite_error test_suite_hmac_shax \ |
| 17 | test_suite_md test_suite_mdx \ |
| 18 | test_suite_mpi test_suite_pkcs1_v21 \ |
| 19 | test_suite_rsa test_suite_shax \ |
| 20 | test_suite_x509parse test_suite_xtea \ |
| 21 | test_suite_version |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 22 | |
| 23 | .SILENT: |
| 24 | |
| 25 | all: $(APPS) |
| 26 | |
Paul Bakker | 4fa1a76 | 2011-03-13 16:56:11 +0000 | [diff] [blame] | 27 | %.c : suites/%.function suites/%.data scripts/generate_code.pl suites/helpers.function |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 28 | echo " Generate $@" |
| 29 | scripts/generate_code.pl suites $* |
| 30 | |
| 31 | test_suite_aes: test_suite_aes.c ../library/libpolarssl.a |
| 32 | echo " CC $@.c" |
| 33 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 34 | |
| 35 | test_suite_arc4: test_suite_arc4.c ../library/libpolarssl.a |
| 36 | echo " CC $@.c" |
| 37 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 38 | |
| 39 | test_suite_base64: test_suite_base64.c ../library/libpolarssl.a |
| 40 | echo " CC $@.c" |
| 41 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 42 | |
| 43 | test_suite_camellia: test_suite_camellia.c ../library/libpolarssl.a |
| 44 | echo " CC $@.c" |
| 45 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 46 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 47 | test_suite_cipher: test_suite_cipher.c ../library/libpolarssl.a |
| 48 | echo " CC $@.c" |
| 49 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 50 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 51 | test_suite_des: test_suite_des.c ../library/libpolarssl.a |
| 52 | echo " CC $@.c" |
| 53 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 54 | |
| 55 | test_suite_dhm: test_suite_dhm.c ../library/libpolarssl.a |
| 56 | echo " CC $@.c" |
| 57 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 58 | |
Paul Bakker | 9d78140 | 2011-05-09 16:17:09 +0000 | [diff] [blame] | 59 | test_suite_error: test_suite_error.c ../library/libpolarssl.a |
| 60 | echo " CC $@.c" |
| 61 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 62 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 63 | test_suite_hmac_shax: test_suite_hmac_shax.c ../library/libpolarssl.a |
| 64 | echo " CC $@.c" |
| 65 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 66 | |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 67 | test_suite_md: test_suite_md.c ../library/libpolarssl.a |
| 68 | echo " CC $@.c" |
| 69 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 70 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 71 | test_suite_mdx: test_suite_mdx.c ../library/libpolarssl.a |
| 72 | echo " CC $@.c" |
| 73 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 74 | |
| 75 | test_suite_mpi: test_suite_mpi.c ../library/libpolarssl.a |
| 76 | echo " CC $@.c" |
| 77 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 78 | |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 79 | test_suite_pkcs1_v21: test_suite_pkcs1_v21.c ../library/libpolarssl.a |
| 80 | echo " CC $@.c" |
| 81 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 82 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 83 | test_suite_rsa: test_suite_rsa.c ../library/libpolarssl.a |
| 84 | echo " CC $@.c" |
| 85 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 86 | |
| 87 | test_suite_shax: test_suite_shax.c ../library/libpolarssl.a |
| 88 | echo " CC $@.c" |
| 89 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 90 | |
| 91 | test_suite_x509parse: test_suite_x509parse.c ../library/libpolarssl.a |
| 92 | echo " CC $@.c" |
| 93 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 94 | |
| 95 | test_suite_xtea: test_suite_xtea.c ../library/libpolarssl.a |
| 96 | echo " CC $@.c" |
| 97 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 98 | |
Paul Bakker | 7d7f4f4 | 2010-02-18 18:26:04 +0000 | [diff] [blame] | 99 | test_suite_debug: test_suite_debug.c ../library/libpolarssl.a |
| 100 | echo " CC $@.c" |
| 101 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 102 | |
Paul Bakker | 3ac1b2d | 2010-06-18 22:47:29 +0000 | [diff] [blame] | 103 | test_suite_version: test_suite_version.c ../library/libpolarssl.a |
| 104 | echo " CC $@.c" |
| 105 | $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ |
| 106 | |
Paul Bakker | 0049c2f | 2009-07-11 19:15:43 +0000 | [diff] [blame] | 107 | clean: |
| 108 | rm -f $(APPS) *.c |
| 109 | |
Paul Bakker | 9794cb4 | 2009-07-28 18:55:00 +0000 | [diff] [blame] | 110 | check: $(APPS) |
Paul Bakker | d947d76 | 2009-07-28 20:16:47 +0000 | [diff] [blame] | 111 | echo "Running checks (Success if all tests PASSED)" |
| 112 | for i in $(APPS); \ |
| 113 | do \ |
| 114 | echo " - $${i}"; \ |
| 115 | ./$${i} | grep -v 'PASS$$' | grep -v -- '-----' | grep -v '^$$'; \ |
| 116 | echo ""; \ |
| 117 | done |