blob: 164a30df8d4be2e88a684366c89eb4f37e659058 [file] [log] [blame]
Lev Walkinad775912017-09-26 22:55:22 -07001-include Makefile.am.libasncodec
Lev Walkine29e6122017-08-04 02:46:28 -07002
Lev Walkine29e6122017-08-04 02:46:28 -07003TARGET = j2735-dump
Lev Walkinad775912017-09-26 22:55:22 -07004ASN_LIBRARY=libasncodec.a
Lev Walkin96d388c2017-09-12 22:40:15 -07005LIBS += -lm
Lev Walkinad775912017-09-26 22:55:22 -07006CFLAGS += -DASN_CONVERTER_TITLE="J2735 DSRC decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=MessageFrame -DASN_PDU_COLLECTION -I.
7ASN_CONVERTER_SOURCES := \
8 converter-example.c\
9 pdu_collection.c
Lev Walkine29e6122017-08-04 02:46:28 -070010
Lev Walkin6aae7c62017-08-10 17:58:48 -070011all: maybe-wip-pause MessageFrame.c $(TARGET)
Lev Walkine29e6122017-08-04 02:46:28 -070012
Lev Walkinad775912017-09-26 22:55:22 -070013$(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 Walkine29e6122017-08-04 02:46:28 -070018
19.SUFFIXES:
20.SUFFIXES: .c .o
21
22.c.o:
Lev Walkinad775912017-09-26 22:55:22 -070023 $(CC) $(CFLAGS) -o $@ -c $<
Lev Walkine29e6122017-08-04 02:46:28 -070024
25clean:
Lev Walkinad775912017-09-26 22:55:22 -070026 rm -f $(TARGET) $(ASN_LIBRARY)
27 rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
Lev Walkine29e6122017-08-04 02:46:28 -070028
29regen: regenerate-from-asn1-source
30
31regenerate-from-asn1-source:
Lev Walkin95d3ac92017-08-26 17:18:12 -070032 ../../asn1c/asn1c -S ../../skeletons -pdu=MessageFrame -fcompound-names -gen-PER -pdu=all ../J2735_201603.asn1
Lev Walkine29e6122017-08-04 02:46:28 -070033
34
Lev Walkind3cc9de2017-08-05 23:01:38 -070035MessageFrame.c: ../sample.makefile.regen ../J2735_201603.asn1
Lev Walkine29e6122017-08-04 02:46:28 -070036 make regen-makefile
37 @touch MessageFrame.c
38 make
39
40regen-makefile:
41 TITLE="J2735 DSRC decoder" \
Lev Walkin95d3ac92017-08-26 17:18:12 -070042 ASN1CMDOPTS="-fcompound-names -gen-PER -pdu=all" \
Lev Walkind3cc9de2017-08-05 23:01:38 -070043 ASN1MODULES="../J2735_201603.asn1" \
Lev Walkine29e6122017-08-04 02:46:28 -070044 ASN1PDU=MessageFrame \
45 PROGNAME=j2735-dump \
Lev Walkine29e6122017-08-04 02:46:28 -070046 ../sample.makefile.regen
47
Lev Walkine4ea1752017-09-05 02:52:19 -070048check: ${TARGET} check-ber check-xer check-oer check-per
Lev Walkine29e6122017-08-04 02:46:28 -070049 @echo ================
50 @echo All tests passed
51 @echo ================
52
53check-ber:
54 @if test -f sample-MessageFrame-1.[db]er ; then \
Lev Walkina926fce2017-08-27 12:54:25 -070055 for f in sample-*-*.[db]er; do \
Lev Walkine4ea1752017-09-05 02:52:19 -070056 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkine29e6122017-08-04 02:46:28 -070057 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -070058 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 Walkine29e6122017-08-04 02:46:28 -070061 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
62 rm -f ./.tmp.[12].$$$$; \
63 echo "Test junking $$f (please wait)..."; \
Lev Walkina926fce2017-08-27 12:54:25 -070064 ./${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 Walkine29e6122017-08-04 02:46:28 -070066 done; done; fi
67
68check-xer:
69 @if test -f sample-MessageFrame-1.xer ; then \
Lev Walkina926fce2017-08-27 12:54:25 -070070 for f in sample-*-*.xer; do \
Lev Walkine4ea1752017-09-05 02:52:19 -070071 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkine29e6122017-08-04 02:46:28 -070072 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -070073 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 Walkine29e6122017-08-04 02:46:28 -070076 diff $$f ./.tmp.2.$$$$ || exit 4; \
77 rm -f ./.tmp.[12].$$$$; \
78 echo "Test junking $$f (please wait)..."; \
Lev Walkina926fce2017-08-27 12:54:25 -070079 ./${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; \
Lev Walkine29e6122017-08-04 02:46:28 -070081 done; done; fi
82
Lev Walkine4ea1752017-09-05 02:52:19 -070083check-oer:
84 @if test -f sample-MessageFrame-1.*oer ; then \
85 for f in sample-*-*.*oer; do \
86 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
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; \
90 ./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
91 diff $$f ./.tmp.2.$$$$ || exit 4; \
92 rm -f ./.tmp.[12].$$$$; \
93 echo "Test junking $$f (please wait) ($$b) ..."; \
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; \
96 done; done; fi
97
Lev Walkine29e6122017-08-04 02:46:28 -070098check-per:
Lev Walkin399f1cf2017-09-13 00:14:46 -070099 @if test -f sample-MessageFrame-1-nopad.per ; then \
100 for f in sample-*-[1-9]-nopad.per; do \
101 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
102 for b in 1 17 33 980 8192; do \
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; \
107 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
108 rm -f ./.tmp.[123].$$$$; \
109 echo "Test junking $$f (please wait)..."; \
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; \
112 done; done; fi
Lev Walkine29e6122017-08-04 02:46:28 -0700113 @if test -f sample-MessageFrame-1.per ; then \
114 for f in sample-*-[1-9].per; do \
Lev Walkine4ea1752017-09-05 02:52:19 -0700115 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkine29e6122017-08-04 02:46:28 -0700116 for b in 1 17 33 980 8192; do \
Lev Walkina926fce2017-08-27 12:54:25 -0700117 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 Walkine29e6122017-08-04 02:46:28 -0700121 diff $$f ./.tmp.1.$$$$ || exit 6; \
122 rm -f ./.tmp.[12].$$$$; \
123 echo "Test junking $$f (please wait)..."; \
Lev Walkina926fce2017-08-27 12:54:25 -0700124 ./${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 Walkine29e6122017-08-04 02:46:28 -0700126 done; done; fi
127
Lev Walkin6aae7c62017-08-10 17:58:48 -0700128maybe-wip-pause:
129 @if [ -f WIP ]; then cat WIP; sleep 2; fi
130
Lev Walkine29e6122017-08-04 02:46:28 -0700131distclean: clean
132 rm -f $(ASN_MODULE_SOURCES)
133 rm -f $(ASN_MODULE_HEADERS)
134 rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
Lev Walkinad775912017-09-26 22:55:22 -0700135 rm -f Makefile.am.example