Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 1 | -include Makefile.am.libasncodec |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 2 | |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 3 | TARGET = 1609-2-dump |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 4 | ASN_LIBRARY=libasncodec.a |
Lev Walkin | 96d388c | 2017-09-12 22:40:15 -0700 | [diff] [blame] | 5 | LIBS += -lm |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 6 | CFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=Certificate -DASN_PDU_COLLECTION -I. |
| 7 | ASN_CONVERTER_SOURCES := \ |
| 8 | converter-example.c\ |
| 9 | pdu_collection.c |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 10 | |
| 11 | all: maybe-wip-pause Certificate.c $(TARGET) |
| 12 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 13 | $(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o) |
| 14 | $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS) |
| 15 | |
| 16 | $(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o) |
| 17 | $(AR) rcs $@ $^ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 18 | |
| 19 | .SUFFIXES: |
| 20 | .SUFFIXES: .c .o |
| 21 | |
| 22 | .c.o: |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 23 | $(CC) $(CFLAGS) -o $@ -c $< |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 24 | |
| 25 | clean: |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 26 | rm -f $(TARGET) $(ASN_LIBRARY) |
| 27 | rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o) |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 28 | |
| 29 | regen: regenerate-from-asn1-source |
| 30 | |
| 31 | regenerate-from-asn1-source: |
Lev Walkin | fe4e047 | 2017-09-04 22:34:50 -0700 | [diff] [blame] | 32 | ../../asn1c/asn1c -S ../../skeletons -pdu=Certificate -pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER ../IEEE-1609.2-2016.asn1 |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 33 | |
| 34 | |
| 35 | Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1 |
| 36 | make regen-makefile |
| 37 | @touch Certificate.c |
| 38 | make |
| 39 | |
| 40 | regen-makefile: |
| 41 | TITLE="IEEE 1609.2-2016 decoder" \ |
Lev Walkin | fe4e047 | 2017-09-04 22:34:50 -0700 | [diff] [blame] | 42 | ASN1CMDOPTS="-pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER" \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 43 | ASN1MODULES="../IEEE-1609.2-2016.asn1" \ |
| 44 | ASN1PDU=Certificate \ |
| 45 | PROGNAME=1609-2-dump \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 46 | ../sample.makefile.regen |
| 47 | |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 48 | check: ${TARGET} check-ber check-xer check-oer check-per |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 49 | @echo ================ |
| 50 | @echo All tests passed |
| 51 | @echo ================ |
| 52 | |
| 53 | check-ber: |
| 54 | @if test -f sample-Certificate-1.[db]er ; then \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 55 | for f in sample-*-*.[db]er; do \ |
Lev Walkin | fe4e047 | 2017-09-04 22:34:50 -0700 | [diff] [blame] | 56 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 57 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 58 | echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ |
| 59 | ./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ |
| 60 | ./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 61 | diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ |
| 62 | rm -f ./.tmp.[12].$$$$; \ |
| 63 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 64 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \ |
| 65 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 66 | done; done; fi |
| 67 | |
| 68 | check-xer: |
| 69 | @if test -f sample-Certificate-1.xer ; then \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 70 | for f in sample-*-*.xer; do \ |
Lev Walkin | fe4e047 | 2017-09-04 22:34:50 -0700 | [diff] [blame] | 71 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 72 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 73 | echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \ |
| 74 | ./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ |
| 75 | ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 76 | diff $$f ./.tmp.2.$$$$ || exit 4; \ |
| 77 | rm -f ./.tmp.[12].$$$$; \ |
| 78 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 79 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \ |
| 80 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \ |
| 81 | done; done; fi |
| 82 | |
| 83 | check-oer: |
| 84 | @if test -f sample-Certificate-1.*oer ; then \ |
Lev Walkin | 3b6cba5 | 2017-08-31 01:57:04 -0700 | [diff] [blame] | 85 | for f in sample-*-*.*oer; do \ |
Lev Walkin | fe4e047 | 2017-09-04 22:34:50 -0700 | [diff] [blame] | 86 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 87 | for b in 1 17 33 980 8192; do \ |
| 88 | echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ |
| 89 | ./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ |
Lev Walkin | 3b6cba5 | 2017-08-31 01:57:04 -0700 | [diff] [blame] | 90 | ./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
| 91 | diff $$f ./.tmp.2.$$$$ || exit 4; \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 92 | rm -f ./.tmp.[12].$$$$; \ |
Lev Walkin | 3b6cba5 | 2017-08-31 01:57:04 -0700 | [diff] [blame] | 93 | echo "Test junking $$f (please wait) ($$b) ..."; \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 94 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \ |
| 95 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 96 | done; done; fi |
| 97 | |
| 98 | check-per: |
| 99 | @if test -f sample-Certificate-1-nopad.per ; then \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 100 | for f in sample-*-[1-9]-nopad.per; do \ |
Lev Walkin | fe4e047 | 2017-09-04 22:34:50 -0700 | [diff] [blame] | 101 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 102 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 103 | echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \ |
| 104 | ./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ |
| 105 | ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
| 106 | ./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 107 | diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ |
| 108 | rm -f ./.tmp.[123].$$$$; \ |
| 109 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 110 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \ |
| 111 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 112 | done; done; fi |
| 113 | @if test -f sample-Certificate-1.per ; then \ |
| 114 | for f in sample-*-[1-9].per; do \ |
Lev Walkin | fe4e047 | 2017-09-04 22:34:50 -0700 | [diff] [blame] | 115 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 116 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 117 | echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \ |
| 118 | ./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ |
| 119 | ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ |
| 120 | ./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 121 | diff $$f ./.tmp.1.$$$$ || exit 6; \ |
| 122 | rm -f ./.tmp.[12].$$$$; \ |
| 123 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 124 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \ |
| 125 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \ |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 126 | done; done; fi |
| 127 | |
| 128 | maybe-wip-pause: |
Lev Walkin | aa7e94f | 2017-08-27 23:44:58 -0700 | [diff] [blame] | 129 | @if [ -f WIP ]; then cat WIP; sleep 2; fi |
Lev Walkin | d748bff | 2017-08-07 17:47:50 -0700 | [diff] [blame] | 130 | |
| 131 | distclean: clean |
| 132 | rm -f $(ASN_MODULE_SOURCES) |
| 133 | rm -f $(ASN_MODULE_HEADERS) |
| 134 | rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 135 | rm -f Makefile.am.example |