# Makefile - makefile for rtilib/vxlibs/float
#
# modification history
# --------------------
# 01d,05mar10,flu   Modified the code for diab compilation (CQ:WIND00146073)
# 01c,12feb10,d_l   added ARMARCH7.
# 01b,04aug09,flu   added ARMARCH6.
# 01a,17nov08,pca   created.
#
# DESCRIPTION
# Makefile rules for building the libfp.so DKM
#
#*/

TGT_DIR=$(WIND_BASE)/target
TOOLS_SRC_ROOT = ../../..

# list of CPU values which require libfp.so
ifeq ($(findstring gnu,$(TOOL)),gnu)
LIBFP_ARCHES = SIMSPARCSOLARIS XSCALE ARMARCH6 ARMARCH5 ARMARCH4 ARMARCH7
else
LIBFP_ARCHES = 
endif

XSCALE.files := _x_gnu__udivsi3.o _x_gnu__umodsi3.o _x_gnu__divsi3.o _x_gnu__modsi3.o \
	_x_gnu__dvmd_tls.o
XSCALE.dir := objgcc

ARMARCH7.files := $(XSCALE.files)
ARMARCH7.dir := $(XSCALE.dir)

ARMARCH6.files := $(XSCALE.files)
ARMARCH6.dir := $(XSCALE.dir)

ARMARCH5.files := $(XSCALE.files)
ARMARCH5.dir := $(XSCALE.dir)

ARMARCH4.files := $(XSCALE.files)
ARMARCH4.dir := $(XSCALE.dir)


SIMSPARCSOLARIS.files := intMathALib.o
SIMSPARCSOLARIS.dir := objarch

include $(TOOLS_SRC_ROOT)/make/common_rules.mk


# the common root of the objects we'll need
COMMON_OBJ_PATH = $(LIB_ROOT)/$(VX_CPU_FAMILY)$(ARCH_OPTION_SUFFIX)/$(CPU)$(CPU_OPTION_SUFFIX)/$(TOOL_COMMON_DIR)$(LIB_DIR_TAG)$(MINOR_OPTION_SUFFIX)

# an expansion, applying COMMON_OBJ_PATH/CPU.dir to every entry in CPU.files
LIBFP_OBJS = $(foreach obj, $($(CPU).files), $(COMMON_OBJ_PATH)/$($(CPU).dir)/$(obj))


# Add libfp.so as a target only for the necessary CPUs
ifneq (,$(findstring $(CPU), $(LIBFP_ARCHES)))
Default: $(LIB_ROOT)/$(DKMDIRBASE) $(LIB_ROOT)/$(DKMDIRBASE)/libfp.so
endif


$(LIB_ROOT)/$(DKMDIRBASE)/libfp.so: $(LIBFP_OBJS)
	$(LD_PARTIAL) $^ -o $@


LOCAL_CLEAN += $(LIB_ROOT)/$(DKMDIRBASE)/libfp.so

# end of rtilib/vxlibs/float
