#
# 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 OSI Management Information Services
#
# By Kevin McCarthy, November 1993

.py.o:;

.py.c:;

PROXY-syntaxes-H= 	PrxAlarmSntx-types.h PrxACCSntx-types.h \
			PrxIIMCSntx-types.h PrxIIMCSntx-classes.h PrxIIMCSntx-syntax.h PrxIIMCSntx-utils.h \
			PrxSV1Sntx-types.h AccessControlEnforcement.h AccessControlInfo.h \
			NullRDN.h PollPeriod.h RetryLimit.h \
			IQASntx.h Library.h

PROXY-syntaxes-O= 	PrxAlarmSntx_tables.o PrxACCSntx_tables.o \
			PrxIIMCSntx_tables.o PrxSV1Sntx_tables.o \
			PrxIIMCSntx-classes.o PrxIIMCSntx-syntax.o PrxIIMCSntx-utils.o \
			IQASntx.o Library.o

HFILES	=		$(PROXY-syntaxes-H) \
			proxySystem.h proxySystem.inc.h cmipsnmpProxy.h cmipsnmpProxy.inc.h cmipsnmpProxy.inc.hcl \
			cmipsnmpProxyAgent.h cmipsnmpProxyAgent.inc.h cmipsnmpProxyAgent.inc.hcl  \
			SetSupportedMIBs.h \
			snmpSecurityParameter.h snmpSecurityParameter.inc.h \
			remoteSystem.h SnmpImageMO.h SnmpImageAccess.h  \
			SnmpImageMOClassInfo.h SnmpRMIBAgent.h SnmpRMIBerrors.h ProxyKS.h


GHFILES =		$(PROXY-syntaxes-H)

OFILES	=		proxySystem.o cmipsnmpProxy.o cmipsnmpProxyAgent.o SetSupportedMIBs.o \
			snmpSecurityParameter.o \
			remoteSystem.o SnmpImageMO.o SnmpImageAccess.o \
			SnmpImageMOClassInfo.o ClassInfoParse.o SnmpRMIBAgent.o  ProxyKS.o

CLEANFILES =		PrxACCSntx_tables.* PrxACCSntx-types.h PrxSV1Sntx_tables.* PrxSV1Sntx-types.h \
			PrxAlarmSntx_tables.* PrxAlarmSntx-types.h \
			proxySystem.h proxySystem.cc cmipsnmpProxy.h cmipsnmpProxy.cc \
			cmipsnmpProxyAgent.h cmipsnmpProxyAgent.cc \
			snmpSecurityParameter.h snmpSecurityParameter.cc \
			gdmo.log oidtable.tmp Makefile.mo

GPROXY-libs =		libiqasyntaxes.a libiqamib.a

PROXY-libs =		$(GPROXY-libs)

all:			lib

lib:			$(PROXY-libs)

glib:			$(GPROXY-libs)

syntax:			$(PROXY-syntax-O)
	
install:		install-h install-lib

clean:;			rm -f *.o *.a core *_pure_*.a $(CLEANFILES)

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

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

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

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


ClassInfoParse.o:	SnmpImageMOClassInfo.h SnmpImageMO.h SnmpImageMOClassInfo.h SnmpImageAccess.h

ProxyKS.o:		cmipsnmpProxy.h cmipsnmpProxyAgent.h ProxyKS.h PrxAlarmSntx-types.h \
			IQASntx.h SnmpImageMOClassInfo.h

SnmpImageAccess.o:	SnmpImageAccess.h SnmpImageMO.h SnmpImageMOClassInfo.h IQASntx.h \
			SnmpRMIBAgent.h cmipsnmpProxyAgent.h SnmpRMIBerrors.h

SnmpImageMO.o:		SnmpImageMO.h SnmpImageAccess.h PrxIIMCSntx-classes.h IQASntx.h \
			SnmpRMIBAgent.h cmipsnmpProxyAgent.h SnmpImageMOClassInfo.h SnmpRMIBerrors.h

SnmpImageMOClassInfo.o: SnmpImageMOClassInfo.h SnmpImageMO.h

SnmpRMIBAgent.o:	SnmpRMIBAgent.h SnmpImageAccess.h SnmpRMIBAgent.h cmipsnmpProxyAgent.h \
			SnmpRMIBerrors.h SnmpImageMOClassInfo.h

cmipsnmpProxyAgent.o:	cmipsnmpProxyAgent.h cmipsnmpProxyAgent.inc.h cmipsnmpProxyAgent.inc.hcl cmipsnmpProxyAgent.inc.cc \
			remoteSystem.h SnmpImageAccess.h SnmpRMIBAgent.h

cmipsnmpProxy.o:	cmipsnmpProxy.h cmipsnmpProxy.inc.h cmipsnmpProxy.inc.hcl cmipsnmpProxy.inc.cc

snmpSecurityParameter.o: snmpSecurityParameter.h snmpSecurityParameter.inc.h snmpSecurityParameter.inc.cc

proxySystem.o: 		proxySystem.h proxySystem.inc.h proxySystem.inc.cc

remoteSystem.o: 	remoteSystem.h SnmpRMIBAgent.h SnmpImageAccess.h SnmpImageMOClassInfo.h

proxySystem.h proxySystem.cc snmpSecurityParameter.h snmpSecurityParameter.cc \
cmipsnmpProxy.h cmipsnmpProxy.cc cmipsnmpProxyAgent.h cmipsnmpProxyAgent.cc :  MIB.gdmo
			(GDMODIR=$(ETC)/gdmodir; export GDMODIR; $(GDMO) MIB.gdmo)


libiqamib.a:		$(OFILES)
			ar ruv $@ $(OFILES)
			ranlib $@

# ASN.1..

libiqasyntaxes.a:	$(PROXY-syntaxes-O)
			ar ruv $@ $(PROXY-syntaxes-O)
			ranlib $@

PrxSV1Sntx_tables.o : PrxSV1Sntx_tables.c PrxSV1Sntx-types.h

PrxSV1Sntx_tables.c PrxSV1Sntx-types.h: PrxSV1Sntx.py
			$(PEPSY) $(PFLAGS) PrxSV1Sntx.py

PrxACCSntx_tables.o : PrxACCSntx_tables.c PrxACCSntx-types.h

PrxACCSntx_tables.c PrxACCSntx-types.h: PrxACCSntx.py
			$(PEPSY) $(PFLAGS) PrxACCSntx.py

PrxIIMCSntx_tables.o : PrxIIMCSntx_tables.c PrxIIMCSntx-types.h

PrxIIMCSntx_tables.c PrxIIMCSntx-types.h: PrxIIMCSntx.py
			$(PEPSY) $(PFLAGS) PrxIIMCSntx.py

PrxAlarmSntx_tables.o :	PrxAlarmSntx_tables.c PrxAlarmSntx-types.h

PrxAlarmSntx-types.h PrxAlarmSntx_tables.c : PrxAlarmSntx.py
			$(PEPSY) $(PFLAGS) PrxAlarmSntx.py
			sed 's/asn1\/IF-types\.h/IF-types\.h/; s/asn1\/PrxIIMCSntx-types\.h/PrxIIMCSntx-types\.h/' PrxAlarmSntx-types.h > PrxAlarmSntx-types.h.tmp
			mv PrxAlarmSntx-types.h.tmp PrxAlarmSntx-types.h


IQASntx.o:		IQASntx.h PrxACCSntx-types.h PrxIIMCSntx-syntax.h PrxIIMCSntx-utils.h \
			PrxSV1Sntx-types.h PrxAlarmSntx-types.h
