Makefile 5.19 KB
Newer Older
Lev Walkin's avatar
Lev Walkin committed
1
-include Makefile.am.libasncodec
Lev Walkin's avatar
TAP3  
Lev Walkin committed
2 3

TARGET = tap3dump
Lev Walkin's avatar
Lev Walkin committed
4 5 6 7 8 9 10
ASN_LIBRARY=libasncodec.a
LIBS += -lm
CFLAGS += -DASN_CONVERTER_TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=DataInterChange -I.
ASN_CONVERTER_SOURCES := \
	converter-example.c

all: maybe-wip-pause DataInterChange.c $(TARGET)
Lev Walkin's avatar
TAP3  
Lev Walkin committed
11

Lev Walkin's avatar
Lev Walkin committed
12 13
$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
	$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
Lev Walkin's avatar
TAP3  
Lev Walkin committed
14

Lev Walkin's avatar
Lev Walkin committed
15 16
$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
	$(AR) rcs $@ $^
Lev Walkin's avatar
TAP3  
Lev Walkin committed
17 18 19 20 21 22 23 24

.SUFFIXES:
.SUFFIXES: .c .o

.c.o:
	$(CC) $(CFLAGS) -o $@ -c $<

clean:
Lev Walkin's avatar
Lev Walkin committed
25 26
	rm -f $(TARGET) $(ASN_LIBRARY)
	rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
Lev Walkin's avatar
TAP3  
Lev Walkin committed
27 28 29 30

regen: regenerate-from-asn1-source

regenerate-from-asn1-source:
Lev Walkin's avatar
Lev Walkin committed
31
	../../asn1c/asn1c -S ../../skeletons -pdu=DataInterChange ../tap3.asn1
Lev Walkin's avatar
TAP3  
Lev Walkin committed
32 33


Lev Walkin's avatar
Lev Walkin committed
34
DataInterChange.c: ../sample.makefile.regen ../tap3.asn1
Lev Walkin's avatar
Lev Walkin committed
35 36 37 38 39
	make regen-makefile
	@touch DataInterChange.c
	make

regen-makefile:
40
	TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" \
Lev Walkin's avatar
Lev Walkin committed
41 42 43 44
	ASN_CMDOPTS="" \
	ASN_MODULES="../tap3.asn1" \
	ASN_PDU=DataInterChange \
	ASN_PROGRAM=tap3dump \
Lev Walkin's avatar
Lev Walkin committed
45
	../sample.makefile.regen
Lev Walkin's avatar
TAP3  
Lev Walkin committed
46

Lev Walkin's avatar
Lev Walkin committed
47
check: ${TARGET} check-ber check-xer check-oer check-per
Lev Walkin's avatar
Lev Walkin committed
48 49 50 51 52
	@echo ================
	@echo All tests passed
	@echo ================

check-ber:
Lev Walkin's avatar
Lev Walkin committed
53
	@if test -f sample-DataInterChange-1.[db]er ; then \
Lev Walkin's avatar
Lev Walkin committed
54 55
	for f in sample-*-*.[db]er; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
56
	for b in 1 17 33 980 8192; do \
Lev Walkin's avatar
Lev Walkin committed
57 58 59
	echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin's avatar
Lev Walkin committed
60
	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
Lev Walkin's avatar
Lev Walkin committed
61
	rm -f ./.tmp.[12].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
62
	echo "Test junking $$f (please wait)..."; \
Lev Walkin's avatar
Lev Walkin committed
63 64
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
Lev Walkin's avatar
Lev Walkin committed
65
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
66 67

check-xer:
Lev Walkin's avatar
Lev Walkin committed
68
	@if test -f sample-DataInterChange-1.xer ; then \
Lev Walkin's avatar
Lev Walkin committed
69 70
	for f in sample-*-*.xer; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
71
	for b in 1 17 33 980 8192; do \
Lev Walkin's avatar
Lev Walkin committed
72 73 74
	echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin's avatar
Lev Walkin committed
75
	diff $$f ./.tmp.2.$$$$ || exit 4; \
Lev Walkin's avatar
Lev Walkin committed
76
	rm -f ./.tmp.[12].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
77
	echo "Test junking $$f (please wait)..."; \
Lev Walkin's avatar
Lev Walkin committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
	done; done; fi

check-oer:
	@if test -f sample-DataInterChange-1.*oer ; then \
	for f in sample-*-*.*oer; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
	for b in 1 17 33 980 8192; do \
	echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
	diff $$f ./.tmp.2.$$$$ || exit 4; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait) ($$b) ..."; \
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
Lev Walkin's avatar
Lev Walkin committed
95
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
96 97

check-per:
Lev Walkin's avatar
Lev Walkin committed
98
	@if test -f sample-DataInterChange-1-nopad.per ; then \
Lev Walkin's avatar
Lev Walkin committed
99 100
	for f in sample-*-[1-9]-nopad.per; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
101
	for b in 1 17 33 980 8192; do \
Lev Walkin's avatar
Lev Walkin committed
102 103 104 105
	echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
	./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
Lev Walkin's avatar
Lev Walkin committed
106
	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
Lev Walkin's avatar
Lev Walkin committed
107
	rm -f ./.tmp.[123].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
108
	echo "Test junking $$f (please wait)..."; \
Lev Walkin's avatar
Lev Walkin committed
109 110
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
Lev Walkin's avatar
Lev Walkin committed
111
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
112 113
	@if test -f sample-DataInterChange-1.per ; then \
	for f in sample-*-[1-9].per; do \
Lev Walkin's avatar
Lev Walkin committed
114
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
115
	for b in 1 17 33 980 8192; do \
Lev Walkin's avatar
Lev Walkin committed
116 117 118 119
	echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
	./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
Lev Walkin's avatar
Lev Walkin committed
120
	diff $$f ./.tmp.1.$$$$ || exit 6; \
Lev Walkin's avatar
Lev Walkin committed
121
	rm -f ./.tmp.[12].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
122
	echo "Test junking $$f (please wait)..."; \
Lev Walkin's avatar
Lev Walkin committed
123 124
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
Lev Walkin's avatar
Lev Walkin committed
125
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
126

Lev Walkin's avatar
Lev Walkin committed
127 128 129
maybe-wip-pause:
	@if [ -f WIP ]; then cat WIP; sleep 2; fi

Lev Walkin's avatar
TAP3  
Lev Walkin committed
130
distclean: clean
131 132
	rm -f $(ASN_MODULE_SOURCES)
	rm -f $(ASN_MODULE_HEADERS)
133
	rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
Lev Walkin's avatar
Lev Walkin committed
134
	rm -f Makefile.am.example