#****************************************************************************
#
# Portions of this software Copyright (c) 2004-2010 Broadcom Corporation
#
#****************************************************************************
#
#  Filename:       makefile_brcm
#  Author:         T. Clack
#  Creation Date:  11/10/03
#
#****************************************************************************
#  Description:
#      The makefile for the libnetsnmpagent_[OS].a library.
#
#****************************************************************************

#####################################################################
# We are a 2.9.4 V2 sandbox
#####################################################################

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


#####################################################################
# Linux build
#####################################################################
DEFS_FILE =  ../../../../../../../cm_bsp_v2/bsp_common/os/stb_linux/makeinc/defs.bsp

#include $(DEFS_FILE)


EXTRA_INCLUDE += -I.
EXTRA_INCLUDE += -I/opt/toolchains/uclibc/include

AGT_LIB  = libnetsnmpagent_stblinux.a
 
SED             = sed
RANLIB          = /opt/toolchains/uclibc/bin/mipsel-linux-ranlib
LN_S            = ln -s
MY_AR = $(AR)
CFLAGS  +=  -DTARGETOS_stblinux -Dlinux
CC              = /opt/toolchains/uclibc/bin/mipsel-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)


