0f4ec9b2e743f76a97329b8f9b6a8a093a81e865
[com/asn1c.git] / examples / sample.source.J2735 / Makefile
1 ASN_PROGRAM = j2735-dump
2 CFLAGS += -DASN_CONVERTER_TITLE="J2735 DSRC decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE
3 begin: MessageFrame.c maybe-wip-pause all
4
5 -include converter-example.mk
6
7 MessageFrame.c: ../sample.makefile.regen ../J2735_201603.asn1
8         make regen-makefile
9         @touch MessageFrame.c
10         make
11
12 regen-makefile:
13         TITLE="J2735 DSRC decoder" \
14         ASN_CMDOPTS="-fcompound-names -pdu=auto" \
15         ASN_MODULES="../J2735_201603.asn1" \
16         ASN_PDU=MessageFrame \
17         ASN_PROGRAM=j2735-dump \
18         ../sample.makefile.regen
19
20 check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per
21         @echo ================
22         @echo All tests passed
23         @echo ================
24
25 check-ber:
26         @if test -f sample-MessageFrame-1.[db]er ; then \
27         for f in sample-*-*.[db]er; do \
28         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
29         for b in 1 17 33 980 8192; do \
30         echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
31         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
32         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
33         diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
34         rm -f ./.tmp.[12].$$$$; \
35         echo "Test junking $$f (please wait)..."; \
36         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
37         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
38         done; done; fi
39
40 check-xer:
41         @if test -f sample-MessageFrame-1.xer ; then \
42         for f in sample-*-*.xer; do \
43         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
44         for b in 1 17 33 980 8192; do \
45         echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
46         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
47         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
48         diff $$f ./.tmp.2.$$$$ || exit 4; \
49         rm -f ./.tmp.[12].$$$$; \
50         echo "Test junking $$f (please wait)..."; \
51         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
52         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
53         done; done; fi
54
55 check-oer:
56         @if test -f sample-MessageFrame-1.*oer ; then \
57         for f in sample-*-*.*oer; do \
58         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
59         for b in 1 17 33 980 8192; do \
60         echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
61         ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
62         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
63         diff $$f ./.tmp.2.$$$$ || exit 4; \
64         rm -f ./.tmp.[12].$$$$; \
65         echo "Test junking $$f (please wait) ($$b) ..."; \
66         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
67         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
68         done; done; fi
69
70 check-per:
71         @if test -f sample-MessageFrame-1-nopad.per ; then \
72         for f in sample-*-[1-9]-nopad.per; do \
73         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
74         for b in 1 17 33 980 8192; do \
75         echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
76         ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
77         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
78         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
79         diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
80         rm -f ./.tmp.[123].$$$$; \
81         echo "Test junking $$f (please wait)..."; \
82         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
83         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
84         done; done; fi
85         @if test -f sample-MessageFrame-1.per ; then \
86         for f in sample-*-[1-9].per; do \
87         pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
88         for b in 1 17 33 980 8192; do \
89         echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
90         ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
91         ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
92         ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
93         diff $$f ./.tmp.1.$$$$ || exit 6; \
94         rm -f ./.tmp.[12].$$$$; \
95         echo "Test junking $$f (please wait)..."; \
96         ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
97         ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
98         done; done; fi
99
100 maybe-wip-pause:
101         @if [ -f WIP ]; then cat WIP; sleep 2; fi
102
103 distclean: clean
104         rm -f $(ASN_MODULE_SRCS)
105         rm -f $(ASN_MODULE_HDRS)
106         rm -f $(ASN_PROGRAM_SRCS) $(ASN_PROGRAM_HDRS)
107         rm -f converter-example.mk