#
# Copyright (c) 1991 University College London
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# distribution and use acknowledge that the software was developed
# by the Department of Computer Science, University College London.
# The name of the University may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#

# Makefile for the SMI syntax library
#
# By George Pavlou


LIBS	=	libsmisntx.a
HFILES	=	SMI2-types.h SMI2-Sntx.h SMI2-Sntx.inc.h \
		ManagementExtension.h AdditionalInformation.h \
		AlarmStatus.h AlarmStatus.inc.h Replaceable.h Replaceable.inc.h \
		Null.h \
		Error.h SmiAsn.h SMI-types.h SmiSntx.h SmiAttr.h \
		Counter.h \
		CounterThld.h \
		Gauge.h \
		GaugeThld.h \
		TideMark.h \
		SimpleNameType.h \
		Bool.h Integer.h IntegerList.h Real.h RealList.h \
		OctetString.h String.h \
		IA5String.h GraphicString.h PrintableString.h \
		StringList.h \
		GraphicStringList.h IA5StringList.h PrintableStringList.h \
		ObjId.h ObjIdList.h \
		MgmtId.h AttributeId.h ObjectClass.h EventType.h \
		MgmtIdList.h AttributeIdList.h ObjectClassList.h \
		DName.h ObjectInstance.h ObjectInstanceList.h \
		Time.h \
		Scope.h Filter.h \
		Destination.h \
		AdministrativeState.h OperationalState.h UsageState.h \
		AvailabilityStatus.h LogFullAction.h

OFILES =	SMI2_tables.o SMI2-Sntx.o \
		Error.o SMI_tables.o SmiSntx.o \
		OctetString.o String.o \
		Counter.o \
		CounterThld.o \
		Gauge.o \
		GaugeThld.o \
		TideMark.o \
		SimpleNameType.o \
		Scope.o Filter.o \
		Destination.o \
		AvailabilityStatus.o LogFullAction.o
		
CLEAN2FILES =	SMI2_tables.c SMI2-types.h SMI2-Sntx.c SMI2-Sntx.h \
		ManagementExtension.h AdditionalInformation.h \
		AlarmStatus.h Replaceable.h Null.h SMI2.ph \
		Makefile.* *.gen *.log

CLEANFILES =	SMI_tables.c SMI-types.h $(CLEAN2FILES)

LLIBS	=	../../msap/llib-lmsap.ln \
		# $(ISODE)/lint/llib-ldsap.ln $(ISODE)/lint/llib-lisode.ln


all:		lib

lib:		$(LIBS)

glib:		lib

install:	install-h install-lib

clean:;		rm -f *.o SMI.ph *.a core $(CLEANFILES) *~

install-lib:	$(LIBS)
		@for i in $(LIBS); \
		    do (echo "cp $$i $(LIB)/$$i; ranlib $(LIB)/$$i"; \
			      cp $$i $(LIB)/$$i; ranlib $(LIB)/$$i); \
		    done

install-glib:	install-lib

install-h:	$(HFILES)
		@for i in $(HFILES); \
		    do (echo "cp $$i $(H)/$$i"; \
			      cp $$i $(H)/$$i); \
		    done

install-gh:	install-h


libsmisntx.a:	$(OFILES)
		ar ruv libsmisntx.a $(OFILES)
		ranlib libsmisntx.a


SMI2_tables.c SMI2-types.h \
SMI2-Sntx.c SMI2-Sntx.h \
ManagementExtension.h \
AdditionalInformation.h \
Replaceable.h Replaceable.inc.h Replaceable.inc.c \
AlarmStatus.h \
Null.h: 	Smi2.asn Smi2.attr
		$(ASN-CMPL) Smi2.asn Smi2.attr

SMI2_tables.o:	SMI2_tables.c SMI2-types.h

SMI2-Sntx.o:	SMI2-types.h SMI2-Sntx.h SMI2-Sntx.inc.h \
		AlarmStatus.inc.c \
		Replaceable.inc.c \
		Null.inc.c

SMI_tables.o:	SMI_tables.c SMI-types.h SmiAsn.h

SMI_tables.c SMI-types.h:	SmiAsn.py
		$(PEPSY) -i "SmiAsn.h" $(PFLAGS) SmiAsn.py
		sed 's/integer *integer/int  integer/; s/struct[	 ]*qbuf/char/; s/type_CMIP_AttributeId/MIDentifier/; s/type_CMIP_AttributeList/CMISParamListVal/; s/asn1\/IF-types\.h/IF-types\.h/; s/asn1\/SMI2-types\.h/SMI2-types\.h/; s/asn1\/CMIP-types\.h/CMIP-types\.h/' SMI-types.h > SMI-types.h.tmp
		mv SMI-types.h.tmp SMI-types.h

SmiSntx.o:	SmiAsn.h SMI-types.h SmiSntx.h

OctetString.o:	OctetString.h

String.o:	String.h

Counter.o:	Counter.h

Gauge.o:	Gauge.h

CounterThld.o:	CounterThld.h Counter.h

Gauge.o:	Gauge.h

GaugeThld.o:	GaugeThld.h Gauge.h

SimpleNameType.o:	SimpleNameType.h

TideMark.o:	TideMark.h Gauge.h

Scope.o:	Scope.h

Filter.o:	Filter.h

Destination.o:	Destination.h

AvailabilityStatus.o:	AvailabilityStatus.h

LogFullAction.o:	LogFullAction.h

lint:		SMI_tables.c SmiSntx.c Error.c
		lint $(LFLAGS) \
		SMI_tables.c SmiSntx.c Error.c $(LLIBS) \
		| grep -v "warning: possible pointer alignment problem"

