source: trunk/Platforms/Generic/Makefile@ 81

Last change on this file since 81 was 81, checked in by rosiere, 18 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1# Authors : Rosière Mathieu
2# Modif. (yyyy/mm/dd) : 2005/04/04
3# Creation (yyyy/mm/dd) : 2005/04/04
4
5SIMULATOR = systemc
6
7#--------------------------------------
8# Commands
9#--------------------------------------
10RM = rm -fr
11ECHO = echo
12GTKWAVE = gtkwave
13TIME = time
14MKDIR = mkdir -p
15DATE = `date +%Y%m%d-%H%M%S`
16PID = $$$$
17CXXFILT = c++filt
18CCACHE =
19
20#--------------------------------------
21# Compilator
22#--------------------------------------
23CXX = $(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
33DEBUG_TIME =
34#-DDEBUG_TIME_MIN=45000 -DDEBUG_TIME_MAX=50000
35DEBUG = -g3
36# -DDEBUG=$(DEBUG_LVL) $(DEBUG_TIME)
37# -DM_CPU_COUNT_CALL_GENMEALY
38
39STAT =
40#-DM_CPU_STAT
41
42OPT = -O3
43
44OTHER_systemc =
45
46OTHER_systemcass = -DNONAME_RENAME \
47 -ansi \
48 -Wno-long-long \
49 -DCHECK_MULTIWRITING2REGISTER
50
51OTHER_SPECIFIC = $(OTHER_$(SIMULATOR))
52
53OTHER_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
66OTHER = $(OTHER_COMMON) $(OTHER_SPECIFIC)
67
68#--------------------------------------
69# variable
70#--------------------------------------
71REP_SRC = src
72
73REP_OBJ = obj
74REP_BIN = bin
75REP_INC = include
76
77# Directory to include
78INCDIR = -I. -I.. \
79 -I$(TOOLS)/$(SIMULATOR)/include \
80 -I$(IPS) \
81 -I$(REP_INC) \
82 -I$(M_CPU_CONFIGURATION_DIRECTORY)
83
84LIBDIR = -L. -L.. \
85 -L$(TOOLS)/$(SIMULATOR)/lib-$(TARGET_ARCH) \
86 -L$(TOOLS)/soclib/lib \
87 -L$(TOOLS)/or1k/lib
88
89LIBS = -lm -lsystemc -lsoclib -lbfd -liberty -ldl
90# target architecture
91TARGET_ARCH = linux
92
93MODULE = system
94EXE = $(REP_BIN)/$(MODULE)_$(ID)
95
96# source files
97MAIN = main_sc
98OBJS = $(patsubst $(REP_SRC)/%.cpp,$(REP_OBJ)/%_$(ID).o,$(wildcard $(REP_SRC)/*.cpp))
99
100CXX_OPT = $(DEBUG) $(STAT) $(OPT) $(OTHER) $(INCDIR)
101LXX_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
111all : id
112
113all2 : test_env $(EXE)
114
115# Test créer la variable d'environnement
116id :
117ifeq ($(origin M_CPU_CONFIGURATION_DIRECTORY), undefined)
118 $(error "variable M_CPU_CONFIGURATION_DIRECTORY is undefined");
119endif
120ifeq ($(origin M_CPU_CONFIGURATION_FILENAME), undefined)
121 $(error "variable M_CPU_CONFIGURATION_FILENAME is undefined");
122endif
123ifeq ($(origin ID), undefined)
124 @make all2 ID=$(DATE)"-"$(PID)
125else
126 @make all2
127endif
128
129# Test des variables d'environnements
130test_env : $(M_CPU_CONFIGURATION_DIRECTORY)/$(M_CPU_CONFIGURATION_FILENAME)
131ifeq ($(origin IPS), undefined)
132 $(error "variable IPS is undefined");
133endif
134ifeq ($(origin TOOLS), undefined)
135 $(error "variable TOOLS is undefined");
136endif
137 @\
138 $(ECHO) "$(ID) : Create directory"; \
139 $(MKDIR) $(REP_OBJ) $(REP_BIN);
140
141# Création du fichier exe
142
143$(EXE) : $(OBJS)
144 @\
145 $(ECHO) "$(ID) : Compilation of execute"; \
146 $(CXX) $(LXX_OPT) -o $@ $< $(LIBS) 2>&1 | $(CXXFILT);
147
148# Fichier objet
149$(REP_OBJ)/%_$(ID).o : $(REP_SRC)/%.cpp
150 @\
151 $(ECHO) "$(ID) : Compilation of files $@"; \
152 $(CXX) $(CXX_OPT) -o $@ -c $< 2>&1 | $(CXXFILT);
153
154# Maintenance
155clean :
156 @\
157 $(ECHO) "Delete temporary files"; \
158 $(RM) $(REP_OBJ) *~ $(REP_SRC)/*~ $(REP_INC)/*~ *.trace tty*; \
159 $(RM) $(REP_BIN);
Note: See TracBrowser for help on using the repository browser.