###############################################################################
#file   Makefile
# -- Intel Copyright Notice --
# 
# Copyright (c) 2002-2008 Intel Corporation All Rights Reserved.
# 
# The source code contained or described herein and all documents
# related to the source code ("Material") are owned by Intel Corporation
# or its suppliers or licensors.  Title to the Material remains with
# Intel Corporation or its suppliers and licensors. The software is licensed under 
# IXA SDK license.
# 
# The Material is protected by worldwide copyright and trade secret laws
# and treaty provisions. No part of the Material may be used, copied,
# reproduced, modified, published, uploaded, posted, transmitted,
# distributed, or disclosed in any way except in accordance with the
# applicable license agreement .
# 
# No license under any patent, copyright, trade secret or other
# intellectual property right is granted to or conferred upon you by
# disclosure or delivery of the Materials, either expressly, by
# implication, inducement, estoppel, except in accordance with the
# applicable license agreement.
# 
# Unless otherwise agreed by Intel in writing, you may not remove or
# alter this notice or any other notice embedded in Materials by Intel
# or Intel's suppliers or licensors in any way.
# 
# For further details, please see the file README.TXT distributed with
# this software.
# 
# -- End Intel Copyright Notice --
# 
###############################################################################

APP_PATH = ./codelets/dspApp
PLUGIN_PATH = ./plugin

# Other commands
#########################################################################
# The TCL shell
TCL := wtxtcl

# A command for printing trace messages in the makefile.
MAKEFILE_TRACE := @echo $(ECHO_QUOTE)--- Makefile: $(ECHO_QUOTE) # Use this setting to enable messages
#MAKEFILE_TRACE = @\#  # Use this setting to disable messages

#########################################################################
# Build platform specific macros
#
# These are : CMD_SEP : the string we use to seperate multiple
# 			commands on a single line.
#             ECHO_QUOTE : to print leading whitespace with the unix
#                       shells' echo command, we need quotes.
#	      ECHO_BLANKLINE : The command to print an empty line.
#             RM : unconditionally delete file(s)
#########################################################################
# Unix settings
CMD_SEP := ;
ECHO_QUOTE := " # " this comment is here to fix emacs syntax highlighting
SAFE_QUOTE := '# ' this comment is here to fix emacs syntax highlighting
ECHO_BLANKLINE := @echo
RM := rm -f
CP := cp


################################################################
#Building dspApp executable
################################################################
.PHONY: app app_clean

app:
	$(MAKEFILE_TRACE) Building App executable IxDspCodeletApp
	$(MAKE) -C $(APP_PATH)
	$(CP) $(APP_PATH)/IxDspCodeletApp $(ADS_BASE_DIR)/lib

app_clean:
	$(MAKEFILE_TRACE) Cleaning generated files for App
	$(MAKE) -C $(APP_PATH) clean


################################################################
#Building plugin module
################################################################
.PHONY: plug plug_clean

plug:
	$(MAKEFILE_TRACE) Building plugin module
	$(MAKE) -C $(PLUGIN_PATH)
	$(CP) $(PLUGIN_PATH)/libplug_rhel50.a $(ADS_BASE_DIR)/lib/libplug.a

plug_clean:
	$(MAKEFILE_TRACE) Cleaning generated files for Plugin
	$(MAKE) -C $(PLUGIN_PATH) clean

lib_clean:
	$(MAKEFILE_TRACE) Cleaning generated files in lib directory
	rm $(ADS_BASE_DIR)/lib/IxDspCodeletApp $(ADS_BASE_DIR)/lib/libplug.a
################################################################
#Building/cleaning all the components
################################################################
.PHONY: all clean

all: plug app

clean: plug_clean app_clean lib_clean
