asn1c/examples/sample.source.1609.2/Makefile

136 lines
5.3 KiB
Makefile
Raw Normal View History

2017-09-27 05:55:22 +00:00
-include Makefile.am.libasncodec
2017-08-08 00:47:50 +00:00
TARGET = 1609-2-dump
2017-09-27 05:55:22 +00:00
ASN_LIBRARY=libasncodec.a
2017-09-13 05:40:15 +00:00
LIBS += -lm
2017-09-27 05:55:22 +00:00
CFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=Certificate -DASN_PDU_COLLECTION -I.
2017-10-01 02:31:54 +00:00
ASN_CONVERTER_SOURCES = \
2017-09-27 05:55:22 +00:00
converter-example.c\
pdu_collection.c
2017-08-08 00:47:50 +00:00
all: maybe-wip-pause Certificate.c $(TARGET)
2017-09-27 05:55:22 +00:00
$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
$(AR) rcs $@ $^
2017-08-08 00:47:50 +00:00
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
2017-09-27 05:55:22 +00:00
$(CC) $(CFLAGS) -o $@ -c $<
2017-08-08 00:47:50 +00:00
clean:
2017-09-27 05:55:22 +00:00
rm -f $(TARGET) $(ASN_LIBRARY)
rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
2017-08-08 00:47:50 +00:00
regen: regenerate-from-asn1-source
regenerate-from-asn1-source:
2017-09-05 05:34:50 +00:00
../../asn1c/asn1c -S ../../skeletons -pdu=Certificate -pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER ../IEEE-1609.2-2016.asn1
2017-08-08 00:47:50 +00:00
Certificate.c: ../sample.makefile.regen ../IEEE-1609.2-2016.asn1
make regen-makefile
@touch Certificate.c
make
regen-makefile:
TITLE="IEEE 1609.2-2016 decoder" \
2017-09-05 05:34:50 +00:00
ASN1CMDOPTS="-pdu=auto -pdu=Ieee1609Dot2Data -fcompound-names -gen-OER" \
2017-08-08 00:47:50 +00:00
ASN1MODULES="../IEEE-1609.2-2016.asn1" \
ASN1PDU=Certificate \
PROGNAME=1609-2-dump \
../sample.makefile.regen
2017-08-28 06:44:58 +00:00
check: ${TARGET} check-ber check-xer check-oer check-per
2017-08-08 00:47:50 +00:00
@echo ================
@echo All tests passed
@echo ================
check-ber:
@if test -f sample-Certificate-1.[db]er ; then \
2017-08-28 06:44:58 +00:00
for f in sample-*-*.[db]er; do \
2017-09-05 05:34:50 +00:00
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
2017-08-08 00:47:50 +00:00
for b in 1 17 33 980 8192; do \
2017-08-28 06:44:58 +00:00
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; \
2017-08-08 00:47:50 +00:00
diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \
2017-08-28 06:44:58 +00:00
./${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; \
2017-08-08 00:47:50 +00:00
done; done; fi
check-xer:
@if test -f sample-Certificate-1.xer ; then \
2017-08-28 06:44:58 +00:00
for f in sample-*-*.xer; do \
2017-09-05 05:34:50 +00:00
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
2017-08-08 00:47:50 +00:00
for b in 1 17 33 980 8192; do \
2017-08-28 06:44:58 +00:00
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; \
2017-08-08 00:47:50 +00:00
diff $$f ./.tmp.2.$$$$ || exit 4; \
rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \
2017-08-28 06:44:58 +00:00
./${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-Certificate-1.*oer ; then \
2017-08-31 08:57:04 +00:00
for f in sample-*-*.*oer; do \
2017-09-05 05:34:50 +00:00
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
2017-08-28 06:44:58 +00:00
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; \
2017-08-31 08:57:04 +00:00
./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
diff $$f ./.tmp.2.$$$$ || exit 4; \
2017-08-28 06:44:58 +00:00
rm -f ./.tmp.[12].$$$$; \
2017-08-31 08:57:04 +00:00
echo "Test junking $$f (please wait) ($$b) ..."; \
2017-08-28 06:44:58 +00:00
./${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; \
2017-08-08 00:47:50 +00:00
done; done; fi
check-per:
@if test -f sample-Certificate-1-nopad.per ; then \
2017-08-28 06:44:58 +00:00
for f in sample-*-[1-9]-nopad.per; do \
2017-09-05 05:34:50 +00:00
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
2017-08-08 00:47:50 +00:00
for b in 1 17 33 980 8192; do \
2017-08-28 06:44:58 +00:00
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; \
2017-08-08 00:47:50 +00:00
diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
rm -f ./.tmp.[123].$$$$; \
echo "Test junking $$f (please wait)..."; \
2017-08-28 06:44:58 +00:00
./${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; \
2017-08-08 00:47:50 +00:00
done; done; fi
@if test -f sample-Certificate-1.per ; then \
for f in sample-*-[1-9].per; do \
2017-09-05 05:34:50 +00:00
pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
2017-08-08 00:47:50 +00:00
for b in 1 17 33 980 8192; do \
2017-08-28 06:44:58 +00:00
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; \
2017-08-08 00:47:50 +00:00
diff $$f ./.tmp.1.$$$$ || exit 6; \
rm -f ./.tmp.[12].$$$$; \
echo "Test junking $$f (please wait)..."; \
2017-08-28 06:44:58 +00:00
./${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; \
2017-08-08 00:47:50 +00:00
done; done; fi
maybe-wip-pause:
2017-08-28 06:44:58 +00:00
@if [ -f WIP ]; then cat WIP; sleep 2; fi
2017-08-08 00:47:50 +00:00
distclean: clean
rm -f $(ASN_MODULE_SOURCES)
rm -f $(ASN_MODULE_HEADERS)
rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
2017-09-27 05:55:22 +00:00
rm -f Makefile.am.example