ASN_MODULE_SOURCES=	\
	Uint3.c	\
	Uint8.c	\
	Uint16.c	\
	Uint32.c	\
	Uint64.c	\
	SequenceOfUint8.c	\
	SequenceOfUint16.c	\
	Opaque.c	\
	HashedId32.c	\
	HashedId10.c	\
	HashedId8.c	\
	HashedId4.c	\
	HashedId3.c	\
	Time32.c	\
	Time64.c	\
	ValidityPeriod.c	\
	Duration.c	\
	GeographicRegion.c	\
	CircularRegion.c	\
	RectangularRegion.c	\
	SequenceOfRectangularRegion.c	\
	PolygonalRegion.c	\
	TwoDLocation.c	\
	IdentifiedRegion.c	\
	SequenceOfIdentifiedRegion.c	\
	CountryOnly.c	\
	CountryAndRegions.c	\
	CountryAndSubregions.c	\
	RegionAndSubregions.c	\
	SequenceOfRegionAndSubregions.c	\
	ThreeDLocation.c	\
	Latitude.c	\
	Longitude.c	\
	Elevation.c	\
	NinetyDegreeInt.c	\
	KnownLatitude.c	\
	UnknownLatitude.c	\
	OneEightyDegreeInt.c	\
	KnownLongitude.c	\
	UnknownLongitude.c	\
	ElevInt.c	\
	Signature.c	\
	EcdsaP256Signature.c	\
	EccP256CurvePoint.c	\
	SymmAlgorithm.c	\
	HashAlgorithm.c	\
	EciesP256EncryptedKey.c	\
	EncryptionKey.c	\
	PublicEncryptionKey.c	\
	BasePublicEncryptionKey.c	\
	PublicVerificationKey.c	\
	SymmetricEncryptionKey.c	\
	PsidSsp.c	\
	SequenceOfPsidSsp.c	\
	Psid.c	\
	SequenceOfPsid.c	\
	ServiceSpecificPermissions.c	\
	PsidSspRange.c	\
	SequenceOfPsidSspRange.c	\
	SspRange.c	\
	SequenceOfOctetString.c	\
	SubjectAssurance.c	\
	CrlSeries.c	\
	IValue.c	\
	Hostname.c	\
	LinkageValue.c	\
	GroupLinkageValue.c	\
	LaId.c	\
	LinkageSeed.c	\
	SignedDataPayload.c	\
	Ieee1609Dot2Data.c	\
	Ieee1609Dot2Content.c	\
	SignedData.c	\
	SignerIdentifier.c	\
	ToBeSignedData.c	\
	HashedData.c	\
	HeaderInfo.c	\
	MissingCrlIdentifier.c	\
	Countersignature.c	\
	EncryptedData.c	\
	RecipientInfo.c	\
	SequenceOfRecipientInfo.c	\
	PreSharedKeyRecipientInfo.c	\
	SymmRecipientInfo.c	\
	PKRecipientInfo.c	\
	EncryptedDataEncryptionKey.c	\
	SymmetricCiphertext.c	\
	AesCcmCiphertext.c	\
	Certificate.c	\
	SequenceOfCertificate.c	\
	CertificateBase.c	\
	CertificateType.c	\
	ImplicitCertificate.c	\
	ExplicitCertificate.c	\
	IssuerIdentifier.c	\
	ToBeSignedCertificate.c	\
	CertificateId.c	\
	LinkageData.c	\
	EndEntityType.c	\
	PsidGroupPermissions.c	\
	SequenceOfPsidGroupPermissions.c	\
	SubjectPermissions.c	\
	VerificationKeyIndicator.c

ASN_MODULE_HEADERS=	\
	Uint3.h	\
	Uint8.h	\
	Uint16.h	\
	Uint32.h	\
	Uint64.h	\
	SequenceOfUint8.h	\
	SequenceOfUint16.h	\
	Opaque.h	\
	HashedId32.h	\
	HashedId10.h	\
	HashedId8.h	\
	HashedId4.h	\
	HashedId3.h	\
	Time32.h	\
	Time64.h	\
	ValidityPeriod.h	\
	Duration.h	\
	GeographicRegion.h	\
	CircularRegion.h	\
	RectangularRegion.h	\
	SequenceOfRectangularRegion.h	\
	PolygonalRegion.h	\
	TwoDLocation.h	\
	IdentifiedRegion.h	\
	SequenceOfIdentifiedRegion.h	\
	CountryOnly.h	\
	CountryAndRegions.h	\
	CountryAndSubregions.h	\
	RegionAndSubregions.h	\
	SequenceOfRegionAndSubregions.h	\
	ThreeDLocation.h	\
	Latitude.h	\
	Longitude.h	\
	Elevation.h	\
	NinetyDegreeInt.h	\
	KnownLatitude.h	\
	UnknownLatitude.h	\
	OneEightyDegreeInt.h	\
	KnownLongitude.h	\
	UnknownLongitude.h	\
	ElevInt.h	\
	Signature.h	\
	EcdsaP256Signature.h	\
	EccP256CurvePoint.h	\
	SymmAlgorithm.h	\
	HashAlgorithm.h	\
	EciesP256EncryptedKey.h	\
	EncryptionKey.h	\
	PublicEncryptionKey.h	\
	BasePublicEncryptionKey.h	\
	PublicVerificationKey.h	\
	SymmetricEncryptionKey.h	\
	PsidSsp.h	\
	SequenceOfPsidSsp.h	\
	Psid.h	\
	SequenceOfPsid.h	\
	ServiceSpecificPermissions.h	\
	PsidSspRange.h	\
	SequenceOfPsidSspRange.h	\
	SspRange.h	\
	SequenceOfOctetString.h	\
	SubjectAssurance.h	\
	CrlSeries.h	\
	IValue.h	\
	Hostname.h	\
	LinkageValue.h	\
	GroupLinkageValue.h	\
	LaId.h	\
	LinkageSeed.h	\
	SignedDataPayload.h	\
	Ieee1609Dot2Data.h	\
	Ieee1609Dot2Content.h	\
	SignedData.h	\
	SignerIdentifier.h	\
	ToBeSignedData.h	\
	HashedData.h	\
	HeaderInfo.h	\
	MissingCrlIdentifier.h	\
	Countersignature.h	\
	EncryptedData.h	\
	RecipientInfo.h	\
	SequenceOfRecipientInfo.h	\
	PreSharedKeyRecipientInfo.h	\
	SymmRecipientInfo.h	\
	PKRecipientInfo.h	\
	EncryptedDataEncryptionKey.h	\
	SymmetricCiphertext.h	\
	AesCcmCiphertext.h	\
	Certificate.h	\
	SequenceOfCertificate.h	\
	CertificateBase.h	\
	CertificateType.h	\
	ImplicitCertificate.h	\
	ExplicitCertificate.h	\
	IssuerIdentifier.h	\
	ToBeSignedCertificate.h	\
	CertificateId.h	\
	LinkageData.h	\
	EndEntityType.h	\
	PsidGroupPermissions.h	\
	SequenceOfPsidGroupPermissions.h	\
	SubjectPermissions.h	\
	VerificationKeyIndicator.h

ASN_MODULE_HEADERS+=OPEN_TYPE.h
ASN_MODULE_SOURCES+=OPEN_TYPE.c
ASN_MODULE_HEADERS+=constr_CHOICE.h
ASN_MODULE_HEADERS+=UTF8String.h
ASN_MODULE_HEADERS+=BOOLEAN.h
ASN_MODULE_SOURCES+=BOOLEAN.c
ASN_MODULE_HEADERS+=INTEGER.h
ASN_MODULE_HEADERS+=NativeEnumerated.h
ASN_MODULE_SOURCES+=INTEGER.c
ASN_MODULE_HEADERS+=NULL.h
ASN_MODULE_SOURCES+=NULL.c
ASN_MODULE_SOURCES+=NativeEnumerated.c
ASN_MODULE_HEADERS+=NativeInteger.h
ASN_MODULE_SOURCES+=NativeInteger.c
ASN_MODULE_SOURCES+=UTF8String.c
ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h
ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c
ASN_MODULE_HEADERS+=asn_SET_OF.h
ASN_MODULE_SOURCES+=asn_SET_OF.c
ASN_MODULE_SOURCES+=constr_CHOICE.c
ASN_MODULE_HEADERS+=constr_SEQUENCE.h
ASN_MODULE_SOURCES+=constr_SEQUENCE.c
ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h
ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c
ASN_MODULE_HEADERS+=constr_SET_OF.h
ASN_MODULE_SOURCES+=constr_SET_OF.c
ASN_MODULE_HEADERS+=asn_application.h
ASN_MODULE_HEADERS+=asn_ioc.h
ASN_MODULE_HEADERS+=asn_system.h
ASN_MODULE_HEADERS+=asn_codecs.h
ASN_MODULE_HEADERS+=asn_internal.h
ASN_MODULE_HEADERS+=asn_bit_data.h
ASN_MODULE_SOURCES+=asn_bit_data.c
ASN_MODULE_HEADERS+=OCTET_STRING.h
ASN_MODULE_SOURCES+=OCTET_STRING.c
ASN_MODULE_HEADERS+=BIT_STRING.h
ASN_MODULE_SOURCES+=BIT_STRING.c
ASN_MODULE_SOURCES+=asn_codecs_prim.c
ASN_MODULE_HEADERS+=asn_codecs_prim.h
ASN_MODULE_HEADERS+=ber_tlv_length.h
ASN_MODULE_SOURCES+=ber_tlv_length.c
ASN_MODULE_HEADERS+=ber_tlv_tag.h
ASN_MODULE_SOURCES+=ber_tlv_tag.c
ASN_MODULE_HEADERS+=ber_decoder.h
ASN_MODULE_SOURCES+=ber_decoder.c
ASN_MODULE_HEADERS+=der_encoder.h
ASN_MODULE_SOURCES+=der_encoder.c
ASN_MODULE_HEADERS+=constr_TYPE.h
ASN_MODULE_SOURCES+=constr_TYPE.c
ASN_MODULE_HEADERS+=constraints.h
ASN_MODULE_SOURCES+=constraints.c
ASN_MODULE_HEADERS+=xer_support.h
ASN_MODULE_SOURCES+=xer_support.c
ASN_MODULE_HEADERS+=xer_decoder.h
ASN_MODULE_SOURCES+=xer_decoder.c
ASN_MODULE_HEADERS+=xer_encoder.h
ASN_MODULE_SOURCES+=xer_encoder.c
ASN_MODULE_HEADERS+=per_support.h
ASN_MODULE_SOURCES+=per_support.c
ASN_MODULE_HEADERS+=per_decoder.h
ASN_MODULE_SOURCES+=per_decoder.c
ASN_MODULE_HEADERS+=per_encoder.h
ASN_MODULE_SOURCES+=per_encoder.c
ASN_MODULE_HEADERS+=per_opentype.h
ASN_MODULE_SOURCES+=per_opentype.c
ASN_CONVERTER_SOURCES+=converter-sample.c
ASN_MODULE_HEADERS+=oer_decoder.h
ASN_MODULE_SOURCES+=oer_decoder.c
ASN_MODULE_HEADERS+=oer_encoder.h
ASN_MODULE_SOURCES+=oer_encoder.c
ASN_MODULE_HEADERS+=oer_support.h
ASN_MODULE_SOURCES+=oer_support.c
ASN_MODULE_SOURCES+=OPEN_TYPE_oer.c
ASN_MODULE_SOURCES+=INTEGER_oer.c
ASN_MODULE_SOURCES+=OCTET_STRING_oer.c
ASN_MODULE_SOURCES+=NativeInteger_oer.c
ASN_MODULE_SOURCES+=NativeEnumerated_oer.c
ASN_MODULE_SOURCES+=constr_SEQUENCE_oer.c
ASN_MODULE_SOURCES+=constr_CHOICE_oer.c
ASN_MODULE_SOURCES+=constr_SET_OF_oer.c
ASN_MODULE_SOURCES+=BIT_STRING_oer.c
ASN_CONVERTER_SOURCES+=pdu_collection.c


lib_LTLIBRARIES=libsomething.la
libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS)

# This file may be used as an input for make(3)
# Remove the lines below to convert it into a pure .am file
TARGET = 1609-2-dump
CPPFLAGS += -DASN_CONVERTER_TITLE="IEEE 1609.2-2016 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE  -DASN_DISABLE_PER_SUPPORT -DPDU=Certificate -DASN_PDU_COLLECTION -I.
OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}

all: maybe-wip-pause Certificate.c $(TARGET)

$(TARGET): ${OBJS}
	$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)

.SUFFIXES:
.SUFFIXES: .c .o

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

clean:
	rm -f $(TARGET)
	rm -f $(OBJS)

regen: regenerate-from-asn1-source

regenerate-from-asn1-source:
	../../asn1c/asn1c -S ../../skeletons -pdu=Certificate -pdu=auto -fcompound-names -gen-OER ../IEEE-1609.2-2016.asn1


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" \
	ASN1CMDOPTS="-pdu=auto -fcompound-names -gen-OER" \
	ASN1MODULES="../IEEE-1609.2-2016.asn1" \
	ASN1PDU=Certificate \
	PROGNAME=1609-2-dump \
	CPPFLAGS="" \
	../sample.makefile.regen

check: ${TARGET} check-ber check-xer check-oer check-per
	@echo ================
	@echo All tests passed
	@echo ================

check-ber:
	@if test -f sample-Certificate-1.[db]er ; then \
	for f in sample-*-*.[db]er; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[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 -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${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; \
	done; done; fi

check-xer:
	@if test -f sample-Certificate-1.xer ; then \
	for f in sample-*-*.xer; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \
	for b in 1 17 33 980 8192; do \
	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; \
	diff $$f ./.tmp.2.$$$$ || exit 4; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${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 \
	for f in sample-*-*.{c,}oer; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[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 -ioer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${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; \
	done; done; fi

check-per:
	@if test -f sample-Certificate-1-nopad.per ; then \
	for f in sample-*-[1-9]-nopad.per; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \
	for b in 1 17 33 980 8192; do \
	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; \
	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
	rm -f ./.tmp.[123].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${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; \
	done; done; fi
	@if test -f sample-Certificate-1.per ; then \
	for f in sample-*-[1-9].per; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \
	for b in 1 17 33 980 8192; do \
	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; \
	diff $$f ./.tmp.1.$$$$ || exit 6; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${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; \
	done; done; fi

maybe-wip-pause:
	@if [ -f WIP ]; then cat WIP; sleep 2; fi

distclean: clean
	rm -f $(ASN_MODULE_SOURCES)
	rm -f $(ASN_MODULE_HEADERS)
	rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
	rm -f Makefile.am.sample
