# Makefile - makefile for target/src/debug/stacktrace
#
# Copyright (c) 2011 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
# --------------------
# 01b,30jun11,wzc  Porting stacktrace-1.0 into analysis.(RQ:WIND00061556)
# 01a,11mar11,flu  written.
#
# DESCRIPTION
# This is the top level Makefile for building the stacktrace component during
# GPP builds.
#
# Note that this file is a temporary work-waround and will be obsoleted when
# GPP build infratstructure is fixed to build components outside $TGT_DIR,
# for example components in $WIND_HOME/components.
#

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

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

DKMS = $(LIB_ROOT)/$(LIBDIRBASE)/dkm/analysis/stacktrace.so
STACKTRACE_OBJS = $(LIB_ROOT)/$(LIBDIRBASE)/objstacktrace/*.o

ifneq ($(wildcard $(WRVX_COMPBASE)/$(COMP_STACKTRACE)/Makefile),)

default:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_STACKTRACE) TOOL=$(_WRS_CONFIG_APP_TOOL) _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP) CPU=$(CPU) VSB_DIR=$(VSB_DIR) OPT=$(OPT)

clean:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_STACKTRACE) TOOL=$(_WRS_CONFIG_APP_TOOL) _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP) CPU=$(CPU) VSB_DIR=$(VSB_DIR) OPT=$(OPT) clean

rclean:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_STACKTRACE) TOOL=$(_WRS_CONFIG_APP_TOOL) _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP) CPU=$(CPU) VSB_DIR=$(VSB_DIR) OPT=$(OPT) rclean

man:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_STACKTRACE) TOOL=$(_WRS_CONFIG_APP_TOOL) _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP) CPU=$(CPU) VSB_DIR=$(VSB_DIR) OPT=$(OPT) man

synopsis:
	$(MAKE) -C $(WRVX_COMPBASE)/$(COMP_STACKTRACE) TOOL=$(_WRS_CONFIG_APP_TOOL) _VSB_CONFIG_ADDEDCFLAGS=$(__VSB_ADDEDCFLAGSAPP) CPU=$(CPU) VSB_DIR=$(VSB_DIR) OPT=$(OPT) synopsis


release: default
else
# the stacktrace component is not present - nothing to do
default:

clean:

rclean:

release:

endif
# rules that do nothing for stacktrace
precomp:

% :
	@echo nothing to be done for target $@

.PHONY: dkms

dkms: $(DKMS)

$(LIB_ROOT)/$(LIBDIRBASE)/dkm/analysis/stacktrace.so: $(STACKTRACE_OBJS)
	$(LD_PARTIAL) $^ -o $@

LOCAL_CLEAN += $(DKMS)