Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 1 | -include Makefile.am.libasncodec |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 2 | |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 3 | TARGET = ulp-dump |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 4 | ASN_LIBRARY=libasncodec.a |
| 5 | LIBS += -lm |
| 6 | CFLAGS += -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. |
| 7 | ASN_CONVERTER_SOURCES := \ |
| 8 | converter-example.c\ |
| 9 | pdu_collection.c |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 10 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 11 | all: maybe-wip-pause ULP-PDU.c $(TARGET) |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 18 | |
| 19 | .SUFFIXES: |
| 20 | .SUFFIXES: .c .o |
| 21 | |
| 22 | .c.o: |
| 23 | $(CC) $(CFLAGS) -o $@ -c $< |
| 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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 28 | |
| 29 | regen: regenerate-from-asn1-source |
| 30 | |
| 31 | regenerate-from-asn1-source: |
Lev Walkin | 7c9e5de | 2007-06-29 15:21:12 +0000 | [diff] [blame] | 32 | ../../asn1c/asn1c -S ../../skeletons -pdu=ULP-PDU -pdu=SUPLINIT -fcompound-names -gen-PER ../ulp.asn1 |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 33 | |
| 34 | |
| 35 | ULP-PDU.c: ../sample.makefile.regen ../ulp.asn1 |
| 36 | make regen-makefile |
| 37 | @touch ULP-PDU.c |
| 38 | make |
| 39 | |
| 40 | regen-makefile: |
| 41 | TITLE="OMA UserPlane Location Protocol decoder" \ |
Lev Walkin | 40b8a7a | 2017-10-08 22:36:29 -0700 | [diff] [blame] | 42 | ASN_CMDOPTS="-pdu=SUPLINIT -fcompound-names -gen-PER" \ |
| 43 | ASN_MODULES="../ulp.asn1" \ |
| 44 | ASN_PDU=ULP-PDU \ |
| 45 | ASN_PROGRAM=ulp-dump \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 46 | ../sample.makefile.regen |
| 47 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 48 | check: ${TARGET} check-ber check-xer check-oer check-per |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 49 | @echo ================ |
| 50 | @echo All tests passed |
| 51 | @echo ================ |
| 52 | |
| 53 | check-ber: |
| 54 | @if test -f sample-ULP-PDU-1.[db]er ; then \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 55 | for f in sample-*-*.[db]er; do \ |
| 56 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 57 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 61 | diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ |
| 62 | rm -f ./.tmp.[12].$$$$; \ |
| 63 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 66 | done; done; fi |
| 67 | |
| 68 | check-xer: |
| 69 | @if test -f sample-ULP-PDU-1.xer ; then \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 70 | for f in sample-*-*.xer; do \ |
| 71 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 72 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 76 | diff $$f ./.tmp.2.$$$$ || exit 4; \ |
| 77 | rm -f ./.tmp.[12].$$$$; \ |
| 78 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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-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 Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 96 | done; done; fi |
| 97 | |
| 98 | check-per: |
| 99 | @if test -f sample-ULP-PDU-1-nopad.per ; then \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 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/"`; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 102 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 107 | diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ |
| 108 | rm -f ./.tmp.[123].$$$$; \ |
| 109 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 112 | done; done; fi |
| 113 | @if test -f sample-ULP-PDU-1.per ; then \ |
| 114 | for f in sample-*-[1-9].per; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 115 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 116 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 121 | diff $$f ./.tmp.1.$$$$ || exit 6; \ |
| 122 | rm -f ./.tmp.[12].$$$$; \ |
| 123 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -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 | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 126 | done; done; fi |
| 127 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 128 | maybe-wip-pause: |
| 129 | @if [ -f WIP ]; then cat WIP; sleep 2; fi |
| 130 | |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 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 |