blob: 3b4b2bfda41bcc62db5ac01990a47ee090ed7a9a [file] [log] [blame]
Lev Walkinad775912017-09-26 22:55:22 -07001-include Makefile.am.libasncodec
Lev Walkin5aef2c52007-06-29 12:46:06 +00002
Lev Walkin5aef2c52007-06-29 12:46:06 +00003TARGET = ulp-dump
Lev Walkinad775912017-09-26 22:55:22 -07004ASN_LIBRARY=libasncodec.a
5LIBS += -lm
6CFLAGS += -DASN_CONVERTER_TITLE="OMA UserPlane Location Protocol decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=ULP_PDU -DASN_PDU_COLLECTION -I.
7ASN_CONVERTER_SOURCES := \
8 converter-example.c\
9 pdu_collection.c
Lev Walkin5aef2c52007-06-29 12:46:06 +000010
Lev Walkinad775912017-09-26 22:55:22 -070011all: maybe-wip-pause ULP-PDU.c $(TARGET)
Lev Walkin5aef2c52007-06-29 12:46:06 +000012
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 Walkin5aef2c52007-06-29 12:46:06 +000018
19.SUFFIXES:
20.SUFFIXES: .c .o
21
22.c.o:
23 $(CC) $(CFLAGS) -o $@ -c $<
24
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 Walkin5aef2c52007-06-29 12:46:06 +000028
29regen: regenerate-from-asn1-source
30
31regenerate-from-asn1-source:
Lev Walkin7c9e5de2007-06-29 15:21:12 +000032 ../../asn1c/asn1c -S ../../skeletons -pdu=ULP-PDU -pdu=SUPLINIT -fcompound-names -gen-PER ../ulp.asn1
Lev Walkin5aef2c52007-06-29 12:46:06 +000033
34
35ULP-PDU.c: ../sample.makefile.regen ../ulp.asn1
36 make regen-makefile
37 @touch ULP-PDU.c
38 make
39
40regen-makefile:
41 TITLE="OMA UserPlane Location Protocol decoder" \
Lev Walkin40b8a7a2017-10-08 22:36:29 -070042 ASN_CMDOPTS="-pdu=SUPLINIT -fcompound-names -gen-PER" \
43 ASN_MODULES="../ulp.asn1" \
44 ASN_PDU=ULP-PDU \
45 ASN_PROGRAM=ulp-dump \
Lev Walkin5aef2c52007-06-29 12:46:06 +000046 ../sample.makefile.regen
47
Lev Walkinad775912017-09-26 22:55:22 -070048check: ${TARGET} check-ber check-xer check-oer check-per
Lev Walkin5aef2c52007-06-29 12:46:06 +000049 @echo ================
50 @echo All tests passed
51 @echo ================
52
53check-ber:
54 @if test -f sample-ULP-PDU-1.[db]er ; then \
Lev Walkinad775912017-09-26 22:55:22 -070055 for f in sample-*-*.[db]er; do \
56 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000057 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -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 Walkin5aef2c52007-06-29 12:46:06 +000061 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
62 rm -f ./.tmp.[12].$$$$; \
63 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -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 Walkin5aef2c52007-06-29 12:46:06 +000066 done; done; fi
67
68check-xer:
69 @if test -f sample-ULP-PDU-1.xer ; then \
Lev Walkinad775912017-09-26 22:55:22 -070070 for f in sample-*-*.xer; do \
71 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000072 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -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 Walkin5aef2c52007-06-29 12:46:06 +000076 diff $$f ./.tmp.2.$$$$ || exit 4; \
77 rm -f ./.tmp.[12].$$$$; \
78 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -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; \
81 done; done; fi
82
83check-oer:
84 @if test -f sample-ULP-PDU-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; \
Lev Walkin5aef2c52007-06-29 12:46:06 +000096 done; done; fi
97
98check-per:
99 @if test -f sample-ULP-PDU-1-nopad.per ; then \
Lev Walkinad775912017-09-26 22:55:22 -0700100 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/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +0000102 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -0700103 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 Walkin5aef2c52007-06-29 12:46:06 +0000107 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
108 rm -f ./.tmp.[123].$$$$; \
109 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -0700110 ./${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 Walkin5aef2c52007-06-29 12:46:06 +0000112 done; done; fi
113 @if test -f sample-ULP-PDU-1.per ; then \
114 for f in sample-*-[1-9].per; do \
Lev Walkinad775912017-09-26 22:55:22 -0700115 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin5aef2c52007-06-29 12:46:06 +0000116 for b in 1 17 33 980 8192; do \
Lev Walkinad775912017-09-26 22:55:22 -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 Walkin5aef2c52007-06-29 12:46:06 +0000121 diff $$f ./.tmp.1.$$$$ || exit 6; \
122 rm -f ./.tmp.[12].$$$$; \
123 echo "Test junking $$f (please wait)..."; \
Lev Walkinad775912017-09-26 22:55:22 -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 Walkin5aef2c52007-06-29 12:46:06 +0000126 done; done; fi
127
Lev Walkinad775912017-09-26 22:55:22 -0700128maybe-wip-pause:
129 @if [ -f WIP ]; then cat WIP; sleep 2; fi
130
Lev Walkin5aef2c52007-06-29 12:46:06 +0000131distclean: 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