1 | # Authors : Rosière Mathieu |
---|
2 | # Modif. (yyyy/mm/dd) : 2005/04/04 |
---|
3 | # Creation (yyyy/mm/dd) : 2005/04/04 |
---|
4 | |
---|
5 | SIMULATOR = systemc |
---|
6 | |
---|
7 | #-------------------------------------- |
---|
8 | # Commands |
---|
9 | #-------------------------------------- |
---|
10 | RM = rm -fr |
---|
11 | ECHO = echo |
---|
12 | GTKWAVE = gtkwave |
---|
13 | TIME = time |
---|
14 | MKDIR = mkdir -p |
---|
15 | DATE = `date +%Y%m%d-%H%M%S` |
---|
16 | PID = $$$$ |
---|
17 | CXXFILT = c++filt |
---|
18 | CCACHE = |
---|
19 | |
---|
20 | #-------------------------------------- |
---|
21 | # Compilator |
---|
22 | #-------------------------------------- |
---|
23 | CXX = $(CCACHE) g++ |
---|
24 | #CXX = g++ -fprofile-arcs -ftest-coverage |
---|
25 | |
---|
26 | #DEBUG_LVL = DEBUG_NONE |
---|
27 | #DEBUG_LVL = DEBUG_INFO |
---|
28 | #DEBUG_LVL = DEBUG_STAT |
---|
29 | #DEBUG_LVL = DEBUG_TRACE |
---|
30 | #DEBUG_LVL = DEBUG_MAX |
---|
31 | #DEBUG_LVL = DEBUG_ALL |
---|
32 | |
---|
33 | DEBUG_TIME = |
---|
34 | #-DDEBUG_TIME_MIN=45000 -DDEBUG_TIME_MAX=50000 |
---|
35 | DEBUG = -g3 |
---|
36 | # -DDEBUG=$(DEBUG_LVL) $(DEBUG_TIME) |
---|
37 | # -DM_CPU_COUNT_CALL_GENMEALY |
---|
38 | |
---|
39 | STAT = |
---|
40 | #-DM_CPU_STAT |
---|
41 | |
---|
42 | OPT = -O3 |
---|
43 | |
---|
44 | OTHER_systemc = |
---|
45 | |
---|
46 | OTHER_systemcass = -DNONAME_RENAME \ |
---|
47 | -ansi \ |
---|
48 | -Wno-long-long \ |
---|
49 | -DCHECK_MULTIWRITING2REGISTER |
---|
50 | |
---|
51 | OTHER_SPECIFIC = $(OTHER_$(SIMULATOR)) |
---|
52 | |
---|
53 | OTHER_COMMON = -Wall \ |
---|
54 | -Wno-deprecated \ |
---|
55 | -Wno-non-template-friend \ |
---|
56 | -Wno-pmf-conversions \ |
---|
57 | -Wunused \ |
---|
58 | -DKANE \ |
---|
59 | -D$(SIMULATOR) |
---|
60 | |
---|
61 | # -Wfatal-errors \ |
---|
62 | |
---|
63 | # -pedantic \ |
---|
64 | # -Werror \ |
---|
65 | |
---|
66 | OTHER = $(OTHER_COMMON) $(OTHER_SPECIFIC) |
---|
67 | |
---|
68 | #-------------------------------------- |
---|
69 | # variable |
---|
70 | #-------------------------------------- |
---|
71 | REP_SRC = src |
---|
72 | |
---|
73 | REP_OBJ = obj |
---|
74 | REP_BIN = bin |
---|
75 | REP_INC = include |
---|
76 | |
---|
77 | # Directory to include |
---|
78 | INCDIR = -I. -I.. \ |
---|
79 | -I$(TOOLS)/$(SIMULATOR)/include \ |
---|
80 | -I$(IPS) \ |
---|
81 | -I$(REP_INC) \ |
---|
82 | -I$(M_CPU_CONFIGURATION_DIRECTORY) |
---|
83 | |
---|
84 | LIBDIR = -L. -L.. \ |
---|
85 | -L$(TOOLS)/$(SIMULATOR)/lib-$(TARGET_ARCH) \ |
---|
86 | -L$(TOOLS)/soclib/lib \ |
---|
87 | -L$(TOOLS)/or1k/lib |
---|
88 | |
---|
89 | LIBS = -lm -lsystemc -lsoclib -lbfd -liberty -ldl |
---|
90 | # target architecture |
---|
91 | TARGET_ARCH = linux |
---|
92 | |
---|
93 | MODULE = system |
---|
94 | EXE = $(REP_BIN)/$(MODULE)_$(ID) |
---|
95 | |
---|
96 | # source files |
---|
97 | MAIN = main_sc |
---|
98 | OBJS = $(patsubst $(REP_SRC)/%.cpp,$(REP_OBJ)/%_$(ID).o,$(wildcard $(REP_SRC)/*.cpp)) |
---|
99 | |
---|
100 | CXX_OPT = $(DEBUG) $(STAT) $(OPT) $(OTHER) $(INCDIR) |
---|
101 | LXX_OPT = $(DEBUG) $(STAT) $(OPT) $(OTHER) -rdynamic $(LIBDIR) |
---|
102 | |
---|
103 | #-------------------------------------- |
---|
104 | # Règles |
---|
105 | #-------------------------------------- |
---|
106 | .SUFFIXES : .cc .cpp .o |
---|
107 | |
---|
108 | # 2 règles : La première pour tester la présence de la date |
---|
109 | # La seconde pour générer l'executable |
---|
110 | |
---|
111 | all : id |
---|
112 | |
---|
113 | all2 : test_env $(EXE) |
---|
114 | |
---|
115 | # Test créer la variable d'environnement |
---|
116 | id : |
---|
117 | ifeq ($(origin M_CPU_CONFIGURATION_DIRECTORY), undefined) |
---|
118 | $(error "variable M_CPU_CONFIGURATION_DIRECTORY is undefined"); |
---|
119 | endif |
---|
120 | ifeq ($(origin M_CPU_CONFIGURATION_FILENAME), undefined) |
---|
121 | $(error "variable M_CPU_CONFIGURATION_FILENAME is undefined"); |
---|
122 | endif |
---|
123 | ifeq ($(origin ID), undefined) |
---|
124 | @make all2 ID=$(DATE)"-"$(PID) |
---|
125 | else |
---|
126 | @make all2 |
---|
127 | endif |
---|
128 | |
---|
129 | # Test des variables d'environnements |
---|
130 | test_env : $(M_CPU_CONFIGURATION_DIRECTORY)/$(M_CPU_CONFIGURATION_FILENAME) |
---|
131 | ifeq ($(origin IPS), undefined) |
---|
132 | $(error "variable IPS is undefined"); |
---|
133 | endif |
---|
134 | ifeq ($(origin TOOLS), undefined) |
---|
135 | $(error "variable TOOLS is undefined"); |
---|
136 | endif |
---|
137 | @$(ECHO) "$(ID) : Create directory" |
---|
138 | @$(MKDIR) $(REP_OBJ) $(REP_BIN) |
---|
139 | |
---|
140 | # Création du fichier exe |
---|
141 | |
---|
142 | $(EXE) : $(OBJS) |
---|
143 | @$(ECHO) "$(ID) : Compilation of execute" |
---|
144 | $(CXX) $(LXX_OPT) -o $@ $< $(LIBS) 2>&1 | $(CXXFILT) |
---|
145 | |
---|
146 | # Fichier objet |
---|
147 | $(REP_OBJ)/%_$(ID).o : $(REP_SRC)/%.cpp |
---|
148 | @$(ECHO) "$(ID) : Compilation of files $@" |
---|
149 | $(CXX) $(CXX_OPT) -o $@ -c $< 2>&1 | $(CXXFILT) |
---|
150 | |
---|
151 | # Maintenance |
---|
152 | clean : |
---|
153 | @$(ECHO) "Delete temporary files" |
---|
154 | @$(RM) $(REP_OBJ) *~ $(REP_SRC)/*~ $(REP_INC)/*~ *.trace tty* |
---|
155 | @$(RM) $(REP_BIN) |
---|