1 | # |
---|
2 | # $Id: Makefile.Common 143 2010-09-02 14:33:08Z rosiere $ |
---|
3 | # |
---|
4 | # [ Description ] |
---|
5 | # |
---|
6 | # Makefile |
---|
7 | # |
---|
8 | |
---|
9 | ifeq ($(origin MORPHEO_TOPLEVEL), undefined) |
---|
10 | $(error "variable MORPHEO_TOPLEVEL is undefined"); |
---|
11 | else |
---|
12 | include $(MORPHEO_TOPLEVEL)/Makefile.tools |
---|
13 | endif |
---|
14 | ifeq ($(origin MORPHEO_PREFIX), undefined) |
---|
15 | $(error "variable MORPHEO_PREFIX is undefined"); |
---|
16 | endif |
---|
17 | ifeq ($(origin MORPHEO_TMP), undefined) |
---|
18 | $(error "variable MORPHEO_TMP is undefined"); |
---|
19 | endif |
---|
20 | ifeq ($(origin MORPHEO_SCRIPT), undefined) |
---|
21 | $(error "variable MORPHEO_SCRIPT is undefined"); |
---|
22 | endif |
---|
23 | ifeq ($(origin DIR_MORPHEO), undefined) |
---|
24 | $(error "variable DIR_MORPHEO is undefined"); |
---|
25 | endif |
---|
26 | |
---|
27 | #-----[ Directory ]---------------------------------------- |
---|
28 | DIR_TMP = $(MORPHEO_TMP) |
---|
29 | DIR_INC = include |
---|
30 | DIR_SRC = src |
---|
31 | DIR_OBJ = $(DIR_TMP)/obj/$(MORPHEO_TYPE) |
---|
32 | DIR_LIB = $(MORPHEO_PREFIX)/lib/$(MORPHEO_TYPE) |
---|
33 | DIR_SCRIPT = $(MORPHEO_SCRIPT) |
---|
34 | |
---|
35 | #-----[ Compilation ]-------------------------------------- |
---|
36 | INCDIR = $(SYSTEMC_INCDIR_$(SIMULATOR_SYSTEMC)) \ |
---|
37 | -I. \ |
---|
38 | -I$(DIR_MORPHEO) |
---|
39 | |
---|
40 | LIBDIR = -L$(DIR_LIB) \ |
---|
41 | $(SYSTEMC_LIBDIR_$(SIMULATOR_SYSTEMC)) |
---|
42 | # $(OR1K_LIBDIR) |
---|
43 | |
---|
44 | FLAGS_COMMON = $(SYSTEMC_CFLAGS_$(SIMULATOR_SYSTEMC)) \ |
---|
45 | $(CXX_FLAGS) |
---|
46 | |
---|
47 | CFLAGS = $(MORPHEO_FLAGS) $(FLAGS_COMMON) $(INCDIR) |
---|
48 | LFLAGS = $(MORPHEO_FLAGS) $(FLAGS_COMMON) $(LIBDIR) |
---|
49 | |
---|
50 | #-----[ Variable ]----------------------------------------- |
---|
51 | PREFIX_OBJ = $(ENTITY)_ |
---|
52 | #OBJECTS_COMMON = $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.cpp)) |
---|
53 | SOURCES = $(wildcard $(DIR_SRC)/*.cpp) |
---|
54 | OBJECTS_COMMON = $(addprefix $(DIR_OBJ)/$(PREFIX_OBJ), $(addsuffix .o, $(basename $(notdir $(SOURCES))))) |
---|
55 | |
---|
56 | HEADERS = $(wildcard $(DIR_INC)/*.h) |
---|
57 | |
---|
58 | #-----[ Rules ]-------------------------------------------- |
---|
59 | .PRECIOUS : $(DIR_OBJ)/$(PREFIX_OBJ)%.o |
---|
60 | |
---|
61 | test_env : |
---|
62 | @$(ECHO) "-------------------| $(ENTITY)" |
---|
63 | |
---|
64 | $(DIR_OBJ)/$(PREFIX_OBJ)%.o : $(DIR_SRC)/%.cpp $(HEADERS) |
---|
65 | @\ |
---|
66 | $(ECHO) "Compilation : $*";\ |
---|
67 | $(SYSTEMC_CXX_$(SIMULATOR_SYSTEMC)) $(CFLAGS) -c -o $@ $<; |
---|
68 | |
---|
69 | $(DIR_OBJ) : |
---|
70 | @\ |
---|
71 | $(ECHO) "Create directory : $@";\ |
---|
72 | $(MKDIR) $@ |
---|
73 | |
---|
74 | common_clean : |
---|
75 | @\ |
---|
76 | $(ECHO) "Delete temporary files in directory $(PWD)";\ |
---|
77 | $(RM) $(OBJECTS_COMMON) \ |
---|
78 | *~ \ |
---|
79 | $(DIR_SRC)/*~ \ |
---|
80 | $(DIR_INC)/*~; |
---|
81 | |
---|
82 | common_clean_all : common_clean |
---|
83 | @\ |
---|
84 | $(RM) $(DIR_OBJ) |
---|
85 | |
---|
86 | common_help : |
---|
87 | @\ |
---|
88 | $(ECHO) " -----[ Common ]-------------------------------------";\ |
---|
89 | $(ECHO) "";\ |
---|
90 | $(ECHO) " * test_env : test if environnment's variable is set";\ |
---|
91 | $(ECHO) ""; |
---|