#
# Makefile for simple CiAO test programs
#

# default target 
default : all


# Root directory of CiAO
ROOT_DIR ?= ../../../../..
include $(ROOT_DIR)/make/standard.mk

APP     := Evaluation

# Compile and link the test sources
SRC_DIR := $(TESTS_DIR)/ciao/os/tp/$(APP)
EXTRA_AH_DIR := $(SRC_DIR)
OUT_DIR := $(SRC_DIR)


# Additional g++ Flags
CXXFLAGS += -g -O3 -finline -I$(CIAO_DIR) -fdata-sections -DBUILDELF
AGXXFLAGS := --keep_woven 

MODULES	:= architecture generate ciao compile gcc 


# include modules
ifneq "$(MODULES)" ""
    include $(patsubst %,$(MODULES_DIR)/%.mk,$(MODULES))
endif


# Additional g++ Flags that depend on the modules
# this one depends on the architecture-dependent CXX_PATH
LDFLAGS := -T $(OUT_DIR)/ldciao.x $(CXX_PATH)/../tricore/lib/ldscripts/elf32tricore.x


MODULES_CLEAN += app
MODULES_ALL   += app

all_app: $(GEN) $(APP).elf


clean_app:
	@find $(OUT_DIR) -name "*.o" -name "*.acc" -name "$(APP).elf" -delete
	
# process 'all' targets in every MODULE and generate object files
all: $(patsubst %,all_%,$(MODULES_ALL))  
	
# process 'clean' targets in every MODULE and generate object files
clean: $(patsubst %,clean_%,$(MODULES_CLEAN))
	
.PHONY: all clean all_app clean_app
	
