1 | include $(MORPHEO_TOPLEVEL)/Makefile.tools |
---|
2 | include $(MORPHEO_TOPLEVEL)/IPs/systemC/processor/Morpheo/Behavioural/Makefile.flags |
---|
3 | |
---|
4 | #-----[ Directory ]---------------------------------------- |
---|
5 | DIR_TST = selftest |
---|
6 | DIR_INC = include |
---|
7 | DIR_SRC = src |
---|
8 | DIR_OBJ = obj |
---|
9 | DIR_BIN = bin |
---|
10 | |
---|
11 | #-----[ Compilation ]-------------------------------------- |
---|
12 | INCDIR = $(SYSTEMC_INCDIR_$(SIMULATOR)) \ |
---|
13 | -I$(DIR_INC) \ |
---|
14 | -I../processor/Morpheo |
---|
15 | |
---|
16 | LIBDIR = $(SYSTEMC_LIBDIR_$(SIMULATOR)) |
---|
17 | |
---|
18 | LIBNAME = $(SYSTEMC_LIBNAME_$(SIMULATOR)) \ |
---|
19 | -lbfd |
---|
20 | |
---|
21 | FLAGS = $(SYSTEMC_CFLAGS_$(SIMULATOR)) |
---|
22 | |
---|
23 | MORPHEO_CC_FLAGS = $(MORPHEO_FLAGS) $(CC_FLAGS) $(INCDIR) |
---|
24 | MORPHEO_CXX_FLAGS = $(MORPHEO_FLAGS) $(CXX_FLAGS) $(FLAGS) $(INCDIR) |
---|
25 | MORPHEO_L_FLAGS = $(MORPHEO_FLAGS) $(CXX_FLAGS) $(FLAGS) $(LIBDIR) |
---|
26 | |
---|
27 | #-----[ Variable ]----------------------------------------- |
---|
28 | |
---|
29 | ENTITY = `$(BASENAME) $$PWD` |
---|
30 | |
---|
31 | OBJECTS = $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.cpp)) \ |
---|
32 | $(patsubst $(DIR_SRC)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.c)) |
---|
33 | OBJECTS_BIN = $(patsubst $(DIR_TST)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_TST)/*.cpp)) |
---|
34 | |
---|
35 | HEADERS = $(wildcard $(DIR_INC)/*.h) |
---|
36 | |
---|
37 | EXE = $(DIR_BIN)/soft.x |
---|
38 | |
---|
39 | EXEC_PREFIX = |
---|
40 | #$(VALGRIND) |
---|
41 | |
---|
42 | #-----[ Rules ]-------------------------------------------- |
---|
43 | |
---|
44 | .PRECIOUS : $(DIR_OBJ)/%.o $(DIR_BIN)/%.x |
---|
45 | |
---|
46 | test_env : |
---|
47 | @\ |
---|
48 | $(ECHO) "-------------------| $(ENTITY)" |
---|
49 | |
---|
50 | $(DIR_OBJ)/%.o : $(DIR_SRC)/%.cpp $(HEADERS) |
---|
51 | @\ |
---|
52 | $(ECHO) "Compilation : $*";\ |
---|
53 | $(CXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<; |
---|
54 | |
---|
55 | $(DIR_OBJ)/%.o : $(DIR_SRC)/%.c $(HEADERS) |
---|
56 | @\ |
---|
57 | $(ECHO) "Compilation : $*";\ |
---|
58 | $(CC) $(MORPHEO_CC_FLAGS) -c -o $@ $<; |
---|
59 | |
---|
60 | $(DIR_OBJ)/%.o : $(DIR_TST)/%.cpp $(HEADERS) |
---|
61 | @\ |
---|
62 | $(ECHO) "Compilation : $*";\ |
---|
63 | $(CXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<; |
---|
64 | |
---|
65 | $(DIR_BIN)/%.x : $(OBJECTS_DEPS) $(OBJECTS) $(OBJECTS_BIN) |
---|
66 | \ |
---|
67 | $(ECHO) "Compilation : $*";\ |
---|
68 | $(CXX) $(MORPHEO_L_FLAGS) -o $@ $^ $(LIBNAME); |
---|
69 | |
---|
70 | $(DIR_OBJ) : |
---|
71 | @\ |
---|
72 | $(ECHO) "Create directory : $@";\ |
---|
73 | $(MKDIR) $@ |
---|
74 | |
---|
75 | $(DIR_BIN) : |
---|
76 | @\ |
---|
77 | $(ECHO) "Create directory : $@";\ |
---|
78 | $(MKDIR) $@ |
---|
79 | |
---|
80 | |
---|
81 | exe : all |
---|
82 | @\ |
---|
83 | export SYSTEMC=$(SYSTEMC_$(SIMULATOR)) ; $(EXEC_PREFIX) ./$(EXE) $(SYSTEMC_EXEC_PARAMS_$(SIMULATOR)) |
---|
84 | |
---|
85 | |
---|
86 | all_environment : test_env $(DIR_OBJ) $(DIR_BIN) |
---|
87 | @\ |
---|
88 | $(MAKE) $(EXE) |
---|
89 | |
---|
90 | environment_clean : |
---|
91 | @\ |
---|
92 | $(ECHO) "Delete temporary files in directory "$(PWD);\ |
---|
93 | $(RM) *~ \ |
---|
94 | $(DIR_OBJ) \ |
---|
95 | $(DIR_BIN) \ |
---|
96 | $(DIR_TST)/*~ \ |
---|
97 | $(DIR_SRC)/*~ \ |
---|
98 | $(DIR_INC)/*~ \ |
---|
99 | *.dot \ |
---|
100 | *.txt; |
---|
101 | |
---|
102 | environment_help : |
---|
103 | @\ |
---|
104 | $(ECHO) " -----[ Environment ]------------------------------";\ |
---|
105 | $(ECHO) "";\ |
---|
106 | $(ECHO) " * test_env : test if environnment's variable is set";\ |
---|
107 | $(ECHO) " * all_environment : generate object";\ |
---|
108 | $(ECHO) ""; |
---|