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