#****************************************************************************
#
# 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 libnetsnmphelpers_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
HLP_LIB  = libnetsnmphelpers_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          = /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 #######################################



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

HLP_OBJS  = all_helpers.o multiplexer.o read_only.o 
HLP_OBJS += bulk_to_next.o instance.o scalar.o 
HLP_OBJS += watcher.o null.o debug_handler.o  
HLP_OBJS += old_api.o serialize.o table_array.o 
HLP_OBJS += table_iterator.o table_data.o table_dataset.o 
HLP_OBJS += table.o mode_end_call.o 





EXTRA_INCLUDE += -I$(NETSNMP_INC_DIR)
EXTRA_INCLUDE += -I../..


$(HLP_LIB) : $(HLP_OBJS)
#	echo objs $(HLP_OBJS)
#	echo lib  $(HLP_LIB)
	$(MY_AR) cru $(HLP_LIB) $?
	$(RANLIB) $(HLP_LIB)
        
	cp $(HLP_LIB) $(NETSNMP_LIB_DIR)/$(HLP_LIB)


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

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

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




