ASN_MODULE_SOURCES=	\
	InterchangedObject.c	\
	RootClass.c	\
	GroupClass.c	\
	StandardIdentifier.c	\
	GroupItem.c	\
	ApplicationClass.c	\
	DefaultAttribute.c	\
	FontBody.c	\
	SceneClass.c	\
	SceneCoordinateSystem.c	\
	AspectRatio.c	\
	NextScene.c	\
	IngredientClass.c	\
	ContentBody.c	\
	ReferencedContent.c	\
	LinkClass.c	\
	LinkCondition.c	\
	EventType.c	\
	EventData.c	\
	ProgramClass.c	\
	ResidentProgramClass.c	\
	RemoteProgramClass.c	\
	InterchangedProgramClass.c	\
	PaletteClass.c	\
	FontClass.c	\
	CursorShapeClass.c	\
	VariableClass.c	\
	OriginalValue.c	\
	BooleanVariableClass.c	\
	IntegerVariableClass.c	\
	OctetStringVariableClass.c	\
	ObjectRefVariableClass.c	\
	ContentRefVariableClass.c	\
	PresentableClass.c	\
	TokenManagerClass.c	\
	Movement.c	\
	TokenGroupClass.c	\
	TokenGroupItem.c	\
	ActionSlot.c	\
	ListGroupClass.c	\
	VisibleClass.c	\
	OriginalBoxSize.c	\
	BitmapClass.c	\
	LineArtClass.c	\
	RectangleClass.c	\
	DynamicLineArtClass.c	\
	TextClass.c	\
	Justification.c	\
	LineOrientation.c	\
	StartCorner.c	\
	StreamClass.c	\
	StreamComponent.c	\
	Storage.c	\
	AudioClass.c	\
	VideoClass.c	\
	Termination.c	\
	RTGraphicsClass.c	\
	InteractibleClass.c	\
	SliderClass.c	\
	Orientation.c	\
	SliderStyle.c	\
	EntryFieldClass.c	\
	InputType.c	\
	HyperTextClass.c	\
	ButtonClass.c	\
	HotspotClass.c	\
	PushButtonClass.c	\
	SwitchButtonClass.c	\
	ButtonStyle.c	\
	ActionClass.c	\
	ElementaryAction.c	\
	Add.c	\
	AddItem.c	\
	Append.c	\
	Call.c	\
	CallActionSlot.c	\
	Clone.c	\
	CloseConnection.c	\
	DelItem.c	\
	DeselectItem.c	\
	Divide.c	\
	DrawArc.c	\
	DrawLine.c	\
	DrawOval.c	\
	DrawPolygon.c	\
	DrawPolyline.c	\
	DrawRectangle.c	\
	DrawSector.c	\
	Fork.c	\
	GetAvailabilityStatus.c	\
	GetBoxSize.c	\
	GetCellItem.c	\
	GetCursorPosition.c	\
	GetEngineSupport.c	\
	GetEntryPoint.c	\
	GetFillColour.c	\
	GetFirstItem.c	\
	GetHighlightStatus.c	\
	GetInteractionStatus.c	\
	GetItemStatus.c	\
	GetLabel.c	\
	GetLastAnchorFired.c	\
	GetLineColour.c	\
	GetLineStyle.c	\
	GetLineWidth.c	\
	GetListItem.c	\
	GetListSize.c	\
	GetOverwriteMode.c	\
	GetPortion.c	\
	GetPosition.c	\
	GetRunningStatus.c	\
	GetSelectionStatus.c	\
	GetSliderValue.c	\
	GetTextContent.c	\
	GetTextData.c	\
	GetTokenPosition.c	\
	GetVolume.c	\
	Modulo.c	\
	Move.c	\
	MoveTo.c	\
	Multiply.c	\
	OpenConnection.c	\
	PutBefore.c	\
	PutBehind.c	\
	ReadPersistent.c	\
	ScaleBitmap.c	\
	ScaleVideo.c	\
	ScrollItems.c	\
	SelectItem.c	\
	SendEvent.c	\
	SetBoxSize.c	\
	SetCachePriority.c	\
	SetCounterEndPosition.c	\
	SetCounterPosition.c	\
	SetCounterTrigger.c	\
	SetCursorPosition.c	\
	SetCursorShape.c	\
	SetData.c	\
	SetEntryPoint.c	\
	SetFillColour.c	\
	SetFirstItem.c	\
	SetFontRef.c	\
	SetHighlightStatus.c	\
	SetInteractionStatus.c	\
	SetLabel.c	\
	SetLineColour.c	\
	SetLineStyle.c	\
	SetLineWidth.c	\
	SetOverwriteMode.c	\
	SetPaletteRef.c	\
	SetPortion.c	\
	SetPosition.c	\
	SetSliderValue.c	\
	SetSpeed.c	\
	SetTimer.c	\
	NewTimer.c	\
	SetTransparency.c	\
	SetVariable.c	\
	SetVolume.c	\
	Step.c	\
	StorePersistent.c	\
	Subtract.c	\
	TestVariable.c	\
	ToggleItem.c	\
	TransitionTo.c	\
	ConnectionTagOrNull.c	\
	ComparisonValue.c	\
	EmulatedEventData.c	\
	NewColour.c	\
	NewContent.c	\
	NewFont.c	\
	NewReferencedContent.c	\
	NewContentSize.c	\
	NewVariableValue.c	\
	Parameter.c	\
	Point.c	\
	Rational.c	\
	ObjectReference.c	\
	ExternalReference.c	\
	IndirectReference.c	\
	ContentReference.c	\
	GenericObjectReference.c	\
	GenericContentReference.c	\
	GenericInteger.c	\
	GenericBoolean.c	\
	GenericOctetString.c	\
	Colour.c	\
	XYPosition.c	\
	OctetString.c

ASN_MODULE_HEADERS=	\
	InterchangedObject.h	\
	RootClass.h	\
	GroupClass.h	\
	StandardIdentifier.h	\
	GroupItem.h	\
	ApplicationClass.h	\
	DefaultAttribute.h	\
	FontBody.h	\
	SceneClass.h	\
	SceneCoordinateSystem.h	\
	AspectRatio.h	\
	NextScene.h	\
	IngredientClass.h	\
	ContentBody.h	\
	ReferencedContent.h	\
	LinkClass.h	\
	LinkCondition.h	\
	EventType.h	\
	EventData.h	\
	ProgramClass.h	\
	ResidentProgramClass.h	\
	RemoteProgramClass.h	\
	InterchangedProgramClass.h	\
	PaletteClass.h	\
	FontClass.h	\
	CursorShapeClass.h	\
	VariableClass.h	\
	OriginalValue.h	\
	BooleanVariableClass.h	\
	IntegerVariableClass.h	\
	OctetStringVariableClass.h	\
	ObjectRefVariableClass.h	\
	ContentRefVariableClass.h	\
	PresentableClass.h	\
	TokenManagerClass.h	\
	Movement.h	\
	TokenGroupClass.h	\
	TokenGroupItem.h	\
	ActionSlot.h	\
	ListGroupClass.h	\
	VisibleClass.h	\
	OriginalBoxSize.h	\
	BitmapClass.h	\
	LineArtClass.h	\
	RectangleClass.h	\
	DynamicLineArtClass.h	\
	TextClass.h	\
	Justification.h	\
	LineOrientation.h	\
	StartCorner.h	\
	StreamClass.h	\
	StreamComponent.h	\
	Storage.h	\
	AudioClass.h	\
	VideoClass.h	\
	Termination.h	\
	RTGraphicsClass.h	\
	InteractibleClass.h	\
	SliderClass.h	\
	Orientation.h	\
	SliderStyle.h	\
	EntryFieldClass.h	\
	InputType.h	\
	HyperTextClass.h	\
	ButtonClass.h	\
	HotspotClass.h	\
	PushButtonClass.h	\
	SwitchButtonClass.h	\
	ButtonStyle.h	\
	ActionClass.h	\
	ElementaryAction.h	\
	Add.h	\
	AddItem.h	\
	Append.h	\
	Call.h	\
	CallActionSlot.h	\
	Clone.h	\
	CloseConnection.h	\
	DelItem.h	\
	DeselectItem.h	\
	Divide.h	\
	DrawArc.h	\
	DrawLine.h	\
	DrawOval.h	\
	DrawPolygon.h	\
	DrawPolyline.h	\
	DrawRectangle.h	\
	DrawSector.h	\
	Fork.h	\
	GetAvailabilityStatus.h	\
	GetBoxSize.h	\
	GetCellItem.h	\
	GetCursorPosition.h	\
	GetEngineSupport.h	\
	GetEntryPoint.h	\
	GetFillColour.h	\
	GetFirstItem.h	\
	GetHighlightStatus.h	\
	GetInteractionStatus.h	\
	GetItemStatus.h	\
	GetLabel.h	\
	GetLastAnchorFired.h	\
	GetLineColour.h	\
	GetLineStyle.h	\
	GetLineWidth.h	\
	GetListItem.h	\
	GetListSize.h	\
	GetOverwriteMode.h	\
	GetPortion.h	\
	GetPosition.h	\
	GetRunningStatus.h	\
	GetSelectionStatus.h	\
	GetSliderValue.h	\
	GetTextContent.h	\
	GetTextData.h	\
	GetTokenPosition.h	\
	GetVolume.h	\
	Modulo.h	\
	Move.h	\
	MoveTo.h	\
	Multiply.h	\
	OpenConnection.h	\
	PutBefore.h	\
	PutBehind.h	\
	ReadPersistent.h	\
	ScaleBitmap.h	\
	ScaleVideo.h	\
	ScrollItems.h	\
	SelectItem.h	\
	SendEvent.h	\
	SetBoxSize.h	\
	SetCachePriority.h	\
	SetCounterEndPosition.h	\
	SetCounterPosition.h	\
	SetCounterTrigger.h	\
	SetCursorPosition.h	\
	SetCursorShape.h	\
	SetData.h	\
	SetEntryPoint.h	\
	SetFillColour.h	\
	SetFirstItem.h	\
	SetFontRef.h	\
	SetHighlightStatus.h	\
	SetInteractionStatus.h	\
	SetLabel.h	\
	SetLineColour.h	\
	SetLineStyle.h	\
	SetLineWidth.h	\
	SetOverwriteMode.h	\
	SetPaletteRef.h	\
	SetPortion.h	\
	SetPosition.h	\
	SetSliderValue.h	\
	SetSpeed.h	\
	SetTimer.h	\
	NewTimer.h	\
	SetTransparency.h	\
	SetVariable.h	\
	SetVolume.h	\
	Step.h	\
	StorePersistent.h	\
	Subtract.h	\
	TestVariable.h	\
	ToggleItem.h	\
	TransitionTo.h	\
	ConnectionTagOrNull.h	\
	ComparisonValue.h	\
	EmulatedEventData.h	\
	NewColour.h	\
	NewContent.h	\
	NewFont.h	\
	NewReferencedContent.h	\
	NewContentSize.h	\
	NewVariableValue.h	\
	Parameter.h	\
	Point.h	\
	Rational.h	\
	ObjectReference.h	\
	ExternalReference.h	\
	IndirectReference.h	\
	ContentReference.h	\
	GenericObjectReference.h	\
	GenericContentReference.h	\
	GenericInteger.h	\
	GenericBoolean.h	\
	GenericOctetString.h	\
	Colour.h	\
	XYPosition.h	\
	OctetString.h

ASN_MODULE_HEADERS+=ANY.h
ASN_MODULE_SOURCES+=ANY.c
ASN_MODULE_HEADERS+=BOOLEAN.h
ASN_MODULE_SOURCES+=BOOLEAN.c
ASN_MODULE_HEADERS+=ENUMERATED.h
ASN_MODULE_SOURCES+=ENUMERATED.c
ASN_MODULE_HEADERS+=INTEGER.h
ASN_MODULE_HEADERS+=NativeEnumerated.h
ASN_MODULE_HEADERS+=IA5String.h
ASN_MODULE_SOURCES+=IA5String.c
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_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_HEADERS+=constr_CHOICE.h
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_HEADERS+=constr_SET.h
ASN_MODULE_SOURCES+=constr_SET.c
ASN_MODULE_SOURCES+=constr_SET_OF.c
ASN_MODULE_HEADERS+=asn_application.h
ASN_MODULE_HEADERS+=asn_system.h
ASN_MODULE_HEADERS+=asn_codecs.h
ASN_MODULE_HEADERS+=asn_internal.h
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_CONVERTER_SOURCES+=converter-sample.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 = mheg5dump
CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -DPDU=InterchangedObject -I.
OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}

all: InterchangedObject.c $(TARGET)

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

.SUFFIXES:
.SUFFIXES: .c .o

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

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

regen: regenerate-from-asn1-source

regenerate-from-asn1-source:
	../../asn1c/asn1c -S ../../skeletons -pdu=InterchangedObject -fcompound-names ../ISO13522-MHEG-5.asn


InterchangedObject.c: ../sample.makefile.regen ../ISO13522-MHEG-5.asn
	make regen-makefile
	@touch InterchangedObject.c
	make

regen-makefile:
	ASN1CMDOPTS="-fcompound-names" \
	ASN1MODULES="../ISO13522-MHEG-5.asn" \
	ASN1PDU=InterchangedObject \
	PROGNAME=mheg5dump \
	../sample.makefile.regen

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

check-ber:
	@if test -f sample-InterchangedObject-1.[db]er ; then \
	for f in sample-InterchangedObject-*.[db]er; do \
	for b in 1 17 33 980 8192; do \
	echo "Recoding $$f into XER and back ($$b)..."; \
	./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 2; \
	./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 2; \
	done; done; fi

check-xer:
	@if test -f sample-InterchangedObject-1.xer ; then \
	for f in sample-InterchangedObject-*.xer; do \
	for b in 1 17 33 980 8192; do \
	echo "Recoding $$f into DER and back ($$b)..."; \
	./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
	diff $$f ./.tmp.2.$$$$ || exit 2; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 2; \
	./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 2; \
	done; done; fi

check-per:
	@if test -f sample-InterchangedObject-1.per ; then \
	for f in sample-InterchangedObject-[1-9].per; do \
	for b in 1 17 33 980 8192; do \
	echo "Recoding $$f into DER into XER and back ($$b)..."; \
	./${TARGET} -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
	./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \
	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \
	rm -f ./.tmp.[123].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 2; \
	./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 2; \
	done; done; fi
	@if test -f sample-InterchangedObject-1-padded.per ; then \
	for f in sample-*-[1-9]-padded.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 byte-padded $$f into DER into XER and back ($$b)..."; \
	./${TARGET} -b $$b -per-padded -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
	./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \
	diff $$f ./.tmp.1.$$$$ || exit 2; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait)..."; \
	./${TARGET} -J0.0001 -n 1000 -b $$b -per-padded -iper -onull $$f || exit 2; \
	./${TARGET} -J0.001 -n 1000 -b $$b -per-padded -iper -onull $$f || exit 2; \
	done; done; 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