# Makefile - makefile for target/src/offset
#
# Copyright (c) 2003-2009 Wind River Systems Inc., Alameda, CA.
#
# modification history
# --------------------
# 02o,15oct10,pee  WIND00210572
# 02n,11dec09,mze  clean the private offsetMacrosP.h
# 02m,20may09,pee  adding variant support for interface
# 02l,04may09,pee  Making offsets.h private/offsetMacrosP.h.
# 02k,28apr09,pee  temp workaround to avoid conflict with OPT
# 02j,24apr09,pee  Moving nm from script to Makefile.
# 02i,06mar09,pee  auto generation of offset header.
# 02h,30nov05,jb   Adding ARM 920 Variant
# 02g,20sep05,pch  add support for building a single CPU_VARIANT
# 02f,31mar04,pes  Add defs.pal for MIPS builds.
# 02e,11mar04,dat  Adding defs.pal
# 02d,03mar04,dat  New offsets.c file, chg to build arch variants
# 02c,21oct03,p_b  archive in arch now
# 02b,09sep,p_b/dbt   created
#
# DESCRIPTION
# This file contains the makefile rules to build the offsets module that
# has the absolute symbols used by the host side debugger tools.
#
 
TGT_DIR=$(WIND_BASE)/target

DOC_FILES=

OBJS_COMMON=    offsets.o

LIB_BASE_NAMES=arch

OBJS_arch = $(OBJS_COMMON)

include $(TGT_DIR)/h/make/defs.singleCpuVariant
include $(TGT_DIR)/h/make/defs.library

ifeq ($(VX_CPU_FAMILY),ppc)
  include $(TGT_DIR)/h/make/defs.pal
endif
ifeq ($(VX_CPU_FAMILY),mips)
  include $(TGT_DIR)/h/make/defs.pal
endif
ifeq ($(VX_CPU_FAMILY),arm)
  include $(TGT_DIR)/h/make/defs.pal
endif

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

ifdef LIBDIR_arch

interface : $(VSB_PRIVATE_INCLUDE_DIR)/offsetMacrosP.h
ifdef CPU_VARIANT_MAKE_INTERFACE
ifneq ($(NO_RECURSE), TRUE)
	$(CPU_VARIANT_MAKE_INTERFACE)
endif
endif

clean_interface :
	-$(RM) $(VSB_PRIVATE_INCLUDE_DIR)/offsetMacrosP.h $(LIBDIR_arch)/offsets.nm
ifdef CPU_VARIANT_MAKE_CLEAN_INTERFACE
ifneq ($(NO_RECURSE), TRUE)
	$(CPU_VARIANT_MAKE_CLEAN_INTERFACE)
endif

endif

#temp dependency. Needs to be fixed in the rules.
$(LIBDIR_arch)/offsets.o : |  $(LIBDIR_arch)

# this should be defined in a generic rule
$(LIBDIR_arch)/offsets.nm : $(LIBDIR_arch)/offsets.o
	$(NM) $< > $@

$(VSB_PRIVATE_INCLUDE_DIR)/offsetMacrosP.h : $(LIBDIR_arch)/offsets.nm | $(VSB_PRIVATE_INCLUDE_DIR)
	$(TCL) offsetsGen.tcl -a $(VX_CPU_FAMILY) -f $< -o $@

else

interface :
	@echo skipping

endif
