# Makefile - makefile for target/src/scopetools
#
# modification history
# --------------------
# 01b,15jul09,???  Modify for Requirement WIND119168
# 01a,26mar06,c_c   created.
#
# DESCRIPTION
# This file contains the makefile rules for building the architecture-specific
# patch libraries
#
#*/

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

LIB_BASE_NAME   = patch

EXTRA_INCLUDE	=	-I$(TOOLS_SRC_ROOT)/rtilib/include/share \
	-I$(TOOLS_SRC_ROOT)/rtilib/include/vx \
	-I$(TOOLS_SRC_ROOT)/scopeutils/include/vx
DOC_FILES=	

# We need to filter out any small data enabling switches, since the DKM loader
# doesn't support them yet.  This is normally done in common_rules.mk, but
# since we need to include defs.library earlier, we also need to define this
# earlier.
SDA_DISABLE = true

# defs.library to pull in automatic definition of the VX_CPU_FAMILY, based on
# the value of CPU.
include $(TGT_DIR)/h/make/defs.library

ifeq ($(VX_CPU_FAMILY),)
$(error VX_CPU_FAMILY undefined!)
endif

ifeq ($(VX_CPU_FAMILY),cf)
ST_ARCH = mcf
endif

ifeq ($(VX_CPU_FAMILY),pentium)
ST_ARCH = i86
endif

ifeq ($(VX_CPU_FAMILY),simlinux)
$(warning patch hasn\'t been ported to support $(VX_CPU_FAMILY) yet.)
ST_ARCH = i86
endif

ifeq ($(VX_CPU_FAMILY),simpc)
$(warning patch hasn\'t been ported to support $(VX_CPU_FAMILY) yet.)
ST_ARCH = i86
endif


ifeq ($(ST_ARCH),)
ST_ARCH = $(VX_CPU_FAMILY)
endif

ifeq ($(ENABLE_HEADER_GENERATION),1)
INDIRECT_SOURCES = patch_$(ST_ARCH).c $(ST_ARCH)Trap.s
else
INDIRECT_SOURCES = patch_$(ST_ARCH).c $(ST_ARCH)Trap.S
endif

OBJS=	patch_$(ST_ARCH).o $(ST_ARCH)Trap.o 

HEADERS = patch_i86.c patch_ppc.c patch_mips.c patch_mcf.c patch_arm.c \
	patch_sh.c shTrap.s ppcTrap.s i86Trap.s mipsTrap.s mcfTrap.s armTrap.s

include $(TOOLS_SRC_ROOT)/make/common_rules.mk


ifneq (x86-win32,$(WIND_HOST_TYPE))
patch_% :
	ln -s $* $@

%Trap.s :
	ln -s $*Trap.S $@
else
ifeq ($(ENABLE_HEADER_GENERATION),1)
patch_% :
	cp $* $@

%Trap.s :
	cp $*Trap.S $@
endif
endif

# end of scopeutils/patch/arch
