# Makefile - makefile for target/src/test/wtxtcl
#
# Copyright (c) 1996, 1998-2004, 2007-2013 Wind River Systems, Inc.
#
# The right to copy, distribute, modify or otherwise make use of this software
# may be licensed only pursuant to the terms of an applicable Wind River license
# agreement.
#
# modification history
# --------------------
# 01x,14jan13,v_r  Added C++/TLS test module (CQID Fix WIND00400546).
#		   Removed obsolete cplusMunch.out mention in LOCAL_CLEAN.
# 01w,15oct12,rlp  CQID: Fix WIND00341831. Added capabilities object module.
# 01v,11may12,v_r  Skip building the loader section overflow object on ARM
#                  (CQID Fix WIND00349550).
# 01u,24apr12,v_r  Added regression test for ELF section overflow
#                  (CQID Fix WIND00346737).
# 01t,05jan11,rlp  Disabled ICC inlining to avoid issue with icc optimization
#                  (CQ:WIND00247950).
# 01s,23jul09,v_r  Added build property checking test to the build (req
#                  CQ:WIND00117257).
# 01r,31jul08,hbh  Removed echo of archive command as it is not executed.
# 01q,19aug08,mze  TOOL changes
# 01p,13mar08,v_r  Added MIPS prebuilt binaries for req CQ:WIND00090099 new
#		   tests.
# 01o,06feb08,hbh  Added cplusTest.out in clean rules.
# 01n,05jun07,v_r  Added prebuilt SDA test module.
# 01m,11may07,dbt  Disable SDA support for DKMs.
# 01l,18feb04,p_b  added rtpSymFind
# 01k,07nov03,c_c  Unified build rules with WIN32 hosts.
# 01j,07jun02,agf  add LONGCALL flag
# 01j,14jun02,jn   Add 'local-struct=0' option for diab
# 01i,24jul01,r_s  diab specific rules added
# 01h,22nov00,rec  added cplusMunch.o to LOCAL_CLEAN
# 01h,18oct00,sn   cleaned up to use .out make rule for cplusTest.cpp
# 01g,19jan99,dra  added use of LD_PARTIAL_FLAGS and CFLAGS
# 01g,25mar98,p_b  Fixed SPR #26045 : changed munch by $(MUNCH)
# 01f,17jul98,p_b  added objSampleWtxtclTest8.c
# 01e,14may98,p_b  Replace test?.o by objSampleWtxtclTest?.o
# 01d,22apr98,p_b  added hostCache
# 01c,15feb98,p_b  added test7
# 01b,06nov96,jmp  replaced CC_OPTIM_TARGET by CC_OPTIM.
# 01a,15jul96,yp   created from 01i of MakeSkel
#
# DESCRIPTION
# This file contains the makefile rules for building the test library
#
#*/

TGT_DIR=$(WIND_BASE)/target

ICC_INLINE_DISABLE= TRUE

DOC_FILES =

LIBNAME=lib$(CPU)$(TOOL_SPECIFIC_DIR)test.a
LIBDIRNAME=test/obj$(CPU)$(TOOL_SPECIFIC_DIR)test

EXCLUDE_SUBDIRS = rtpsample

EXTRA_DEFINE	= $(LONGCALL)
SDA_DISABLE	= TRUE

OBJS_TEST= funcCallTest.o objSampleWtxtclTest1.o objSampleWtxtclTest2.o\
           objSampleWtxtclTest3.o objSampleWtxtclTest4.o objSampleWtxtclTest5.o\
           objSampleWtxtclTest6.o objSampleWtxtclTest7.o objSampleWtxtclTest8.o\
           gopher.o symbol.o cplusTest.o absolute.o listTest.o hostCache.o\
	   rtpSymFind.o loaderModuleTagsTest.o capabilities.o cplusTls.out

ifneq ($(findstring diab,$(TOOL)),diab)
# Build the section overflow module for GNU only: Diab errors out when the
# section count goes over 65536. 
ifneq ($(findstring ARM,$(CPU)),ARM)
# Same thing for ARM (to be investigated). 
# Note how we test against $CPU and not VX_CPU_FAMILY. The latter requires
# rules.library to be sourced, something we cannot do at that point ($OBJS must
# be fully set before rules.library is sourced).
OBJS_TEST += loaderSectionOverflow.o
endif
endif

OBJS=$(OBJS_TEST)

include $(TGT_DIR)/h/make/rules.library

# The 'local-struct=0' flag for Diab turns off an optimization which results
# in all uninitialized static data going in the data section.  We turn that
# off here since we need bss symbols for some of the tests.

ifeq  ($(findstring gnu,$(TOOL)),gnu)
CC_OPTIM = -fstrength-reduce -fno-builtin
else
ifeq ($(findstring diab,$(TOOL)),diab)
CC_OPTIM = -XO
CFLAGS  += -Xlocal-struct=0
endif
endif

PREBUILT_MODULES = $(LIBDIR)/nullSizeModule.o $(LIBDIR)/unknownFormat.o

ifeq ($(VX_CPU_FAMILY), ppc)
ARCH_PREBUILT = $(LIBDIR)/loaderSDATestModule.o
endif

ifeq ($(VX_CPU_FAMILY), mips)
ARCH_PREBUILT = $(LIBDIR)/loaderMIPSI2sfdiab.o $(LIBDIR)/loaderMIPSI2sfgnu.o\
		$(LIBDIR)/loaderMIPSI32diab.o $(LIBDIR)/loaderMIPSI32gnu.o\
		$(LIBDIR)/loaderMIPSI32R2diab.o $(LIBDIR)/loaderMIPSI32R2gnu.o\
		$(LIBDIR)/loaderMIPSI3diab.o $(LIBDIR)/loaderMIPSI3gnu.o\
		$(LIBDIR)/loaderMIPSI64diab.o $(LIBDIR)/loaderMIPSI64gnu.o\
		$(LIBDIR)/loaderMIPSI64R2diab.o $(LIBDIR)/loaderMIPSI64R2gnu.o\
		$(LIBDIR)/loaderMIPSI2sfdiable.o    \
		$(LIBDIR)/loaderMIPSI2sfgnule.o	    \
		$(LIBDIR)/loaderMIPSI32diable.o $(LIBDIR)/loaderMIPSI32gnule.o\
		$(LIBDIR)/loaderMIPSI32R2diable.o   \
		$(LIBDIR)/loaderMIPSI32R2gnule.o    \
		$(LIBDIR)/loaderMIPSI3diable.o $(LIBDIR)/loaderMIPSI3gnule.o\
		$(LIBDIR)/loaderMIPSI64diable.o $(LIBDIR)/loaderMIPSI64gnule.o\
		$(LIBDIR)/loaderMIPSI64R2diable.o   \
		$(LIBDIR)/loaderMIPSI64R2gnule.o
endif

LOCAL_CLEAN = $(LIBDIR)/cplus.o $(LIBDIR)/cplusTest.out $(LIBDIR)/cplusTls.out\
	      $(PREBUILT_MODULES) $(ARCH_PREBUILT)

lib:$(LIBDIR)/cplus.o $(PREBUILT_MODULES) $(ARCH_PREBUILT)

$(LIBDIR)/cplus.o : $(LIBDIR)/cplusTest.out
	$(CP) $< $@

# Prebuilts do not need prerequisites since they are checked-in.
# Architecture-specific prebuilts reside in their own directory, named after
# their VX_CPU_FAMILY.

$(PREBUILT_MODULES):
	$(CP) $(subst $(LIBDIR)/,,$@) $(LIBDIR)

$(ARCH_PREBUILT):
	$(CP) $(subst $(LIBDIR)/,$(VX_CPU_FAMILY)/,$@) $(LIBDIR)
	
# The normal end when using makeLibrary is to create a lib, but here, we 
# don't need lib creation. The following settings prevent lib creation.
AR=true
RANLIB=true

