#
# $XORP$
#

# XXX: Linking needs to be fixed here before proceeding.
# XXX: NETSNMPCFLAGS should have been substituted from top level configure
# into Jamrules.

# These MIB modules would be built as static executables 
# in the Jam environment, which is not what we want, but it lets
# us capture the original Automake dependency graph.
#
# They could be rewritten as AgentX modules, which run as processes,
# rather than as shared libraries loaded into the system SNMP agent, thus
# side stepping various build issues with respect to shared libraries,
# and making the code more portable to Windows.
#

SubDir TOP mibs ;
SubIncludeOnce TOP libcomm ;
SubIncludeOnce TOP libxorp ;
SubIncludeOnce TOP libxipc ;
SubIncludeOnce TOP xrl targets ;
SubIncludeOnce TOP xrl interfaces ;
SubDir TOP mibs ;

# The rest of this file is conditional upon the user actually having
# requested that MIBS be built.
if $(BUILD_MIBS) {

 UNDEFINE_PKG_CFLAGS = 
	-UPACKAGE 
	-UPACKAGE_BUGREPORT
	-UPACKAGE_NAME
	-UPACKAGE_STRING 
	-UPACKAGE_TARNAME
	-UPACKAGE_VERSION
	;

 C++FLAGS += -I$(TOP)
	     -DNETSNMP_NO_INLINE
	     $(UNDEFINE_PKG_CFLAGS)
	     $(NETSNMPCFLAGS)
	     ;

 # XXX this needs to be corrected and substituted correctly.
 LINKLIBS += -L/usr/local/lib -lnetsnmp ;

 Library libnetsnmpxorp : xorpevents.cc ;
 # libraries upon which the above library depends.
 NETSNMPXORP_LIB_COMMON = libxipc libxorp libcomm ;

 Main bgp4_mib_1657 :
	 bgp4_mib_1657.cc
	 bgp4_mib_1657_bgp4pathattrtable.cc
	 bgp4_mib_1657_bgpidentifier.cc
	 bgp4_mib_1657_bgplocalas.cc
	 bgp4_mib_1657_bgppeertable.cc
	 bgp4_mib_1657_bgpversion.cc
	 bgp4_mib_xrl_target.cc
	 ;
 LinkLibraries bgp4_mib_1657 :
	libnetsnmpxorp
	libbgp4mibbase
	libbgpxif
 	$(NETSNMPXORP_LIB_COMMON)
	;

 Main ospf_mib_1850 :
	ospf_mib_1850.cc
	;
 LinkLibraries ospf_mib_1850 :
	libnetsnmpxorp
	$(NETSNMPXORP_LIB_COMMON)
	;

 Main xorp_if_mib_module :
	xorp_if_mib_module.cc
	xorp_if_mib_xrl_target.cc
	;
 LinkLibraries xorp_if_mib_module :
	libnetsnmpxorp
	$(NETSNMPXORP_LIB_COMMON)
	;

 if $(MAKE_CHECK) {
  Main test_xorpevents : test_xorpevents.cc ;
  LinkLibraries test_xorpevents :
	libfinder
	libnetsnmpxorp
	$(NETSNMPXORP_LIB_COMMON)
	;
 } # endif MAKE_CHECK

 #InstallBin $(TOP)/mibs : foo bar ... ;

} # endif BUILD_MIBS
