#
# $XORP: xorp/mibs/Jamfile,v 1.4 2007/04/20 07:17:43 pavlin Exp $
#

# XXX: Currently NETSNMPCFLAGS here is hard-coded. This is because in
# the Automake build, the Net-SNMP specific configure steps happen here
# rather than top-level such that mibs may be libtool-ized as a separate
# autotools package.
# You will need to manually hack this file to set NETSNMPCFLAGS appropriately
# for your system until this is resolved.
#
# XXX: The MIB modules should be rewritten as AgentX modules, which run as
# processes, # rather than as shared libraries loaded into the system SNMP
# agent. This would allow us to avoid the build issues we have with respect
# to shared libraries and portability.
#

SubDir TOP mibs ;
SubIncludeOnce TOP libxorp ;
SubIncludeOnce TOP libcomm ;
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) {

 #NETSNMPCFLAGS = -DINET6 -O2 -fno-strict-aliasing -Dfreebsd6 -DAPPLLIB_EXP=/usr/local/lib/perl5/5.8.8/BSDPAN -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include -I/usr/local/lib/perl5/5.8.8/mach/CORE ;
 NETSNMPCFLAGS = -DINET6 -O2 -fno-strict-aliasing -Dfreebsd6 -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include ;

 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 These may need site-local changes.
 SUBDIRC++FLAGS += $(NETSNMPCFLAGS) ;
 LINKLIBS += -L/usr/local/lib -lnetsnmp ;

 # XXX this doesn't do the right thing...
 ZSharedLibrary libnetsnmpxorp.so : xorpevents.cc ;

 # libraries upon which the above library depends.
 NETSNMPXORP_LIB_COMMON = libxipc libcomm libxorp ;

 ZSharedLibrary 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
	 ;
 ZLinkSharedLibraries bgp4_mib_1657
	libnetsnmpxorp
	;
 LinkLibraries bgp4_mib_1657 :
	libbgp4mibbase
	libbgpxif
 	$(NETSNMPXORP_LIB_COMMON)
	;

 ZSharedLibrary ospf_mib_1850 :
	ospf_mib_1850.cc
	;
 ZLinkSharedLibraries ospf_mib_1850
	libnetsnmpxorp
	;
 LinkLibraries ospf_mib_1850 :
	$(NETSNMPXORP_LIB_COMMON)
	;

 ZSharedLibrary xorp_if_mib_module :
	xorp_if_mib_module.cc
	xorp_if_mib_xrl_target.cc
	;
 ZLinkSharedLibraries xorp_if_mib_module
	libnetsnmpxorp
	;
 LinkLibraries xorp_if_mib_module :
	$(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
