#****************************************************************************
#
# Portions of this software Copyright (c) 2007-2010 Broadcom Corporation
#
#****************************************************************************
#
#  Filename:       makefile_linux
#  Author:         Maurice Turcotte
#  Creation Date:  08/05/07
#
#****************************************************************************
#  Description:
#      The makefile for the libnetsnmpagent_Linux.a library.
#
#****************************************************************************

#####################################################################
# We are a BFC sandbox
#####################################################################

TOP_DIR   = ../../../../../..
LIB_SUPPORT_DIR = $(TOP_DIR)/LibSupport
NETSNMP_INC_DIR = $(LIB_SUPPORT_DIR)/NetSnmp/NetSnmp/include
NETSNMP_LIB_DIR = $(LIB_SUPPORT_DIR)/NetSnmp/NetSnmp


#####################################################################
# Linux build
#####################################################################
DEFS_FILE =  ../../../../../../../Bfc/linux/makeinc/defs.bsp

include $(DEFS_FILE)


EXTRA_INCLUDE += -I.
#EXTRA_INCLUDE += -I/projects/bfc/work/karthikb/bfc_linux/mips-linux-2.6.12-uclibc/include
#EXTRA_INCLUDE += -I/opt/toolchains/crosstools_sf-linux-2.6.12.0_gcc-3.4.6-20_uclibc-0.9.28-20050817-20070131/mips-linux-uclibc/include
EXTRA_INCLUDE += -I/projects/settops/toolchain/07092007/mips-linux-2.6.12-uclibc/include

AGT_LIB  = libnetsnmpagent_Linux.a
 
SED             = sed
TOOLCHAIN_BIN   = /projects/settops/toolchain/07092007/mips-linux-2.6.12-uclibc/bin
#RANLIB          = /projects/bfc/work/karthikb/bfc_linux/mips-linux-2.6.12-uclibc/bin/mips-linux-ranlib
#RANLIB          = /opt/toolchains/crosstools_sf-linux-2.6.12.0_gcc-3.4.6-20_uclibc-0.9.28-20050817-20070131/bin/mips-linux-ranlib
RANLIB          = /projects/settops/toolchain/07092007/mips-linux-2.6.12-uclibc/bin/mips-linux-ranlib

LN_S            = ln -s
MY_AR = $(TOOLCHAIN_BIN)/mips-linux-ar
CFLAGS  +=  -DTARGETOS_Linux -Dlinux
CC              = /projects/settops/toolchain/07092007/mips-linux-2.6.12-uclibc/bin/mips-linux-gcc

## end of Linux specific stuff #######################################


#AGT_OBJS = $(subst .c,.o, $(wildcard *.c))

AGT_OBJS  =  snmp_agent.o snmp_vars.o agent_registry.o 
AGT_OBJS +=  agent_index.o agent_trap.o agent_handler.o 
AGT_OBJS +=  mib_modules.o
#AGT_OBJS +=  agent_read_config.o kernel.o



EXTRA_INCLUDE += -I$(NETSNMP_INC_DIR)
EXTRA_INCLUDE += -Imibgroup


COPTS = 
EXTRA_DEFINE  += $(COPTS)


$(AGT_LIB) : $(AGT_OBJS)
	echo objs $(AGT_OBJS)
	echo lib  $(AGT_LIB)
	$(MY_AR) cru $(AGT_LIB) $?
	$(RANLIB) $(AGT_LIB)
        
	cp $(AGT_LIB) $(NETSNMP_LIB_DIR)/$(AGT_LIB)

%.o : %.s
	@ $(RM) $@
	$(CC) $(CFLAGS_AS) -c -o $@ $< 

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

clean:
	- $(RM) $(AGT_LIB)
	- $(RM) *.o
	- $(RM) $(NETSNMP_LIB_DIR)/$(AGT_LIB)


