1 | # /*------------------------------------------------------------\ |
---|
2 | # | | |
---|
3 | # | Tool : systemcass | |
---|
4 | # | | |
---|
5 | # | File : Makefile | |
---|
6 | # | | |
---|
7 | # | Author : | |
---|
8 | # | | |
---|
9 | # | Date : 08_07_2004 | |
---|
10 | # | | |
---|
11 | # \------------------------------------------------------------*/ |
---|
12 | ifndef SYSTEMC |
---|
13 | $(error SYSTEMC is not defined. This variable should be set to SystemCASS \ |
---|
14 | directory when SYSTEMCASS variable is not set.) |
---|
15 | endif |
---|
16 | ifndef SYSTEMCASS |
---|
17 | $(error SYSTEMCASS is not defined. This variable has to be defined to install \ |
---|
18 | SystemCASS and to run any system built with.) |
---|
19 | endif |
---|
20 | #ifndef SOCVIEW |
---|
21 | #$(error SOCVIEW is not defined.) |
---|
22 | #endif |
---|
23 | ################################# |
---|
24 | # |
---|
25 | # SYSTEMC |
---|
26 | # |
---|
27 | ################################# |
---|
28 | |
---|
29 | TARGET_ARCH =$(shell ./guess_os.sh) |
---|
30 | TARGET_OS =${TARGET_ARCH} |
---|
31 | TARGET_PLATFORM =$(shell uname -p)# -i doesn't work on MACOSX |
---|
32 | TARGET_KERNEL =$(shell uname -s | tr '[A-Z]' '[a-z]') |
---|
33 | |
---|
34 | include Options.def |
---|
35 | |
---|
36 | ################################## |
---|
37 | #### DIRECTORIES |
---|
38 | ################################## |
---|
39 | #CURRENT_DIR = $(shell pwd) |
---|
40 | #SYSTEMCASS_INSTALLDIR = ${CURRENT_DIR}/${TARGET_PLATFORM}-${TARGET_OS} |
---|
41 | SYSTEMCASS_INSTALLDIR = ${SYSTEMCASS} |
---|
42 | SYSTEMCASS_INCLUDEDIR = ${SYSTEMCASS_INSTALLDIR}/include |
---|
43 | SYSTEMCASS_LIBDIR = ${SYSTEMCASS_INSTALLDIR}/lib |
---|
44 | SYSTEMCASS_DOCDIR = ${SYSTEMCASS_INSTALLDIR}/docs |
---|
45 | |
---|
46 | INSTALLDIR_OK = $(shell (test -d ${SYSTEMCASS_INSTALLDIR}/) ; echo $$?) |
---|
47 | ifneq (${INSTALLDIR_OK},0) |
---|
48 | $(shell (mkdir ${SYSTEMCASS_INSTALLDIR}/)) |
---|
49 | endif |
---|
50 | |
---|
51 | INCLUDEDIR_OK = $(shell (test -d ${SYSTEMCASS_INCLUDEDIR}/) ; echo $$?) |
---|
52 | ifneq (${INCLUDEDIR_OK},0) |
---|
53 | $(shell (mkdir ${SYSTEMCASS_INCLUDEDIR})) |
---|
54 | endif |
---|
55 | |
---|
56 | DOCDIR_OK = $(shell (test -d ${SYSTEMCASS_DOCDIR}/) ; echo $$?) |
---|
57 | ifneq (${DOCDIR_OK},0) |
---|
58 | $(shell (mkdir ${SYSTEMCASS_DOCDIR})) |
---|
59 | endif |
---|
60 | |
---|
61 | ################################## |
---|
62 | #### FLAGS |
---|
63 | ################################## |
---|
64 | #SYSTEMC = /users/outil/systemc/systemcass/systemcass/latest |
---|
65 | #SYSTEMCASS = $(SYSTEMC)/latest |
---|
66 | #ALLIANCE = /asim/alliance |
---|
67 | |
---|
68 | PROF_ARG = -pg # gcc |
---|
69 | #PROF_ARG = -qp # icc |
---|
70 | OPT = -O2 -DCFLAGS="\"-O2 \"" $(NETLIST_DEBUGGING) $(SCHEDULING_OPTIONS) $(OTHERS) |
---|
71 | DEBUG = -g -DCFLAGS="\"-g \"" $(NETLIST_DEBUGGING-d) $(SCHEDULING_OPTIONS-d) $(OTHERS-d) -Wunused -Werror |
---|
72 | PROF = -O2 ${PROF_ARG} -DCFLAGS="\"-O2 ${PROF_ARG} \"" $(NETLIST_DEBUGGING) $(SCHEDULING_OPTIONS) $(OTHERS) |
---|
73 | |
---|
74 | #-Wall disable using icc instead of g++ |
---|
75 | |
---|
76 | #CXX = g++ |
---|
77 | #CXX = icc -w1 |
---|
78 | CFLAGS = -I./internal_include \ |
---|
79 | -I${SYSTEMCASS_INCLUDEDIR} \ |
---|
80 | -I${ALLIANCE}/include \ |
---|
81 | -ansi \ |
---|
82 | -pedantic \ |
---|
83 | -Wno-long-long \ |
---|
84 | -D${TARGET_PLATFORM} \ |
---|
85 | -D${TARGET_KERNEL} \ |
---|
86 | -Wunused-function # to clean up the code \ |
---|
87 | |
---|
88 | #-D${TARGET_ARCH} # disabled because that macro name gets error messages |
---|
89 | |
---|
90 | LDFLAGS = -L. \ |
---|
91 | -L${SYSTEMCASS}/lib-${TARGET_PLATFORM}-${TARGET_OS} \ |
---|
92 | -L${ALLIANCE}/lib \ |
---|
93 | |
---|
94 | ################################## |
---|
95 | ## DOCUMENTATION |
---|
96 | ################################## |
---|
97 | |
---|
98 | FIGURES = figures/SystemeType.fig \ |
---|
99 | figures/Automate.fig |
---|
100 | |
---|
101 | tex_files = SystemCASS.tex |
---|
102 | pdf_files = $(tex_files:.tex=.pdf) |
---|
103 | ps_files = $(tex_files:.tex=.ps) |
---|
104 | eps_figures = $(FIGURES:.fig=.eps) |
---|
105 | dvi_files = $(tex_files:.tex=.dvi) |
---|
106 | log_files = $(tex_files:.tex=.log) |
---|
107 | aux_files = $(tex_files:.tex=.aux) |
---|
108 | out_files = $(tex_files:.tex=.out) |
---|
109 | blg_files = $(tex_files:.tex=.blg) |
---|
110 | bbl_files = $(tex_files:.tex=.bbl) |
---|
111 | |
---|
112 | DOCS = \ |
---|
113 | ${SYSTEMCASS_DOCDIR}/SystemCASS.ps \ |
---|
114 | ${SYSTEMCASS_DOCDIR}/SystemCASS.pdf \ |
---|
115 | ${SYSTEMCASS_DOCDIR}/How-to-Use.txt |
---|
116 | |
---|
117 | ################################## |
---|
118 | ## OBJECTS |
---|
119 | ################################## |
---|
120 | OBJECTS = \ |
---|
121 | alias.o \ |
---|
122 | bit2string.o \ |
---|
123 | dump_dot.o \ |
---|
124 | dump_used_env.o \ |
---|
125 | dump_used_options.o \ |
---|
126 | entity.o \ |
---|
127 | gen_code.o \ |
---|
128 | global_functions.o \ |
---|
129 | graph.o \ |
---|
130 | graph_cass.o \ |
---|
131 | graph_signals.o \ |
---|
132 | hex2string.o \ |
---|
133 | methodprocess_dependency.o \ |
---|
134 | module_hierarchy.o \ |
---|
135 | module_hierarchy2dot.o \ |
---|
136 | mouchard_scheduling.o \ |
---|
137 | port_dependency.o \ |
---|
138 | process_dependency.o \ |
---|
139 | sc_clock.o \ |
---|
140 | sc_event.o \ |
---|
141 | sc_event_finder.o \ |
---|
142 | sc_interface.o \ |
---|
143 | sc_logic.o \ |
---|
144 | sc_main.o \ |
---|
145 | sc_module.o \ |
---|
146 | sc_numrep.o \ |
---|
147 | sc_object.o \ |
---|
148 | sc_pat_trace.o \ |
---|
149 | sc_port.o \ |
---|
150 | sc_sensitive.o \ |
---|
151 | sc_time.o \ |
---|
152 | sc_trace.o \ |
---|
153 | sc_uint_subref_r.o \ |
---|
154 | sc_vcd_trace.o \ |
---|
155 | sc_ver.o \ |
---|
156 | schedulers.o \ |
---|
157 | serialization.o \ |
---|
158 | signal_dependency.o \ |
---|
159 | simplify_string.o \ |
---|
160 | |
---|
161 | |
---|
162 | OBJECTS-d = $(OBJECTS:.o=-d.o) |
---|
163 | OBJECTS-prof= $(OBJECTS:.o=-prof.o) |
---|
164 | |
---|
165 | ################################## |
---|
166 | ## LIBRARIES |
---|
167 | ################################## |
---|
168 | SYSTEMCASS_LIB = ${SYSTEMCASS_LIBDIR}/libsystemc_$(firstword $(CXX)).a |
---|
169 | SYSTEMCASS-d_LIB = ${SYSTEMCASS_LIBDIR}/libsystemc_$(firstword $(CXX))-d.a |
---|
170 | SYSTEMCASS-prof_LIB = ${SYSTEMCASS_LIBDIR}/libsystemc_$(firstword $(CXX))-prof.a |
---|
171 | |
---|
172 | ## PAT trace output is enable when ALLIANCE is defined |
---|
173 | EXT_TMP_DIR = $(if ${ALLIANCE}, \ |
---|
174 | libPgn.temp \ |
---|
175 | libMut.temp \ |
---|
176 | libPpt.temp \ |
---|
177 | libPat.temp \ |
---|
178 | ) |
---|
179 | |
---|
180 | EXT_OBJ = $(EXT_TMP_DIR:.temp=.temp/*.o) |
---|
181 | |
---|
182 | ################################## |
---|
183 | ## SOURCES |
---|
184 | ################################## |
---|
185 | LINKS = $(OBJECTS-d:.o=.cc) $(OBJECTS-prof:.o=.cc) |
---|
186 | |
---|
187 | EXTERNAL_INCLUDES = \ |
---|
188 | ${SYSTEMCASS_INCLUDEDIR}/systemc.h \ |
---|
189 | ${SYSTEMCASS_INCLUDEDIR}/sc_fwd.h\ |
---|
190 | ${SYSTEMCASS_INCLUDEDIR}/global_functions.h \ |
---|
191 | ${SYSTEMCASS_INCLUDEDIR}/serialization_ext.h \ |
---|
192 | ${SYSTEMCASS_INCLUDEDIR}/sc_time.h \ |
---|
193 | ${SYSTEMCASS_INCLUDEDIR}/sc_nbdefs.h \ |
---|
194 | ${SYSTEMCASS_INCLUDEDIR}/sc_ver_ext.h\ |
---|
195 | ${SYSTEMCASS_INCLUDEDIR}/systemcass_version_ext.h\ |
---|
196 | ${SYSTEMCASS_INCLUDEDIR}/sc_module_ext.h \ |
---|
197 | ${SYSTEMCASS_INCLUDEDIR}/module_hierarchy_ext.h \ |
---|
198 | ${SYSTEMCASS_INCLUDEDIR}/sc_module_name.h \ |
---|
199 | ${SYSTEMCASS_INCLUDEDIR}/internal_ext.h \ |
---|
200 | ${SYSTEMCASS_INCLUDEDIR}/casc.h \ |
---|
201 | ${SYSTEMCASS_INCLUDEDIR}/fsm_rules.h \ |
---|
202 | ${SYSTEMCASS_INCLUDEDIR}/sc_object.h \ |
---|
203 | ${SYSTEMCASS_INCLUDEDIR}/sc_sensitive.h \ |
---|
204 | ${SYSTEMCASS_INCLUDEDIR}/sc_event.h \ |
---|
205 | ${SYSTEMCASS_INCLUDEDIR}/sc_interface.h \ |
---|
206 | ${SYSTEMCASS_INCLUDEDIR}/sc_port_ext.h \ |
---|
207 | ${SYSTEMCASS_INCLUDEDIR}/sc_event_finder.h \ |
---|
208 | ${SYSTEMCASS_INCLUDEDIR}/port_dependency_ext.h \ |
---|
209 | ${SYSTEMCASS_INCLUDEDIR}/sc_signal.h \ |
---|
210 | ${SYSTEMCASS_INCLUDEDIR}/sc_clock_ext.h \ |
---|
211 | ${SYSTEMCASS_INCLUDEDIR}/sc_unit.h \ |
---|
212 | ${SYSTEMCASS_INCLUDEDIR}/sc_bit.h \ |
---|
213 | ${SYSTEMCASS_INCLUDEDIR}/sc_logic.h \ |
---|
214 | ${SYSTEMCASS_INCLUDEDIR}/sc_bv.h \ |
---|
215 | ${SYSTEMCASS_INCLUDEDIR}/sc_unsigned.h \ |
---|
216 | ${SYSTEMCASS_INCLUDEDIR}/sc_signed.h \ |
---|
217 | ${SYSTEMCASS_INCLUDEDIR}/sc_uint.h \ |
---|
218 | ${SYSTEMCASS_INCLUDEDIR}/sc_numrep.h \ |
---|
219 | ${SYSTEMCASS_INCLUDEDIR}/sc_string.h \ |
---|
220 | ${SYSTEMCASS_INCLUDEDIR}/sc_int.h \ |
---|
221 | ${SYSTEMCASS_INCLUDEDIR}/sc_lv.h \ |
---|
222 | ${SYSTEMCASS_INCLUDEDIR}/sc_biguint.h \ |
---|
223 | ${SYSTEMCASS_INCLUDEDIR}/sc_bigint.h \ |
---|
224 | ${SYSTEMCASS_INCLUDEDIR}/sc_trace_ext.h \ |
---|
225 | ${SYSTEMCASS_INCLUDEDIR}/alias.h \ |
---|
226 | ${SYSTEMCASS_INCLUDEDIR}/sc_localvar.h \ |
---|
227 | ${SYSTEMCASS_INCLUDEDIR}/sc_vcd_trace.h \ |
---|
228 | ${SYSTEMCASS_INCLUDEDIR}/sc_pat_trace.h \ |
---|
229 | ${SYSTEMCASS_INCLUDEDIR}/endianness.h \ |
---|
230 | ${SYSTEMCASS_INCLUDEDIR}/data_field.h \ |
---|
231 | |
---|
232 | ################################## |
---|
233 | ## RULES |
---|
234 | ################################## |
---|
235 | .SECONDARY: |
---|
236 | .PHONY: help figures debug opt prof docs path all clean realclean |
---|
237 | |
---|
238 | ########## |
---|
239 | #### RULES |
---|
240 | help : |
---|
241 | @echo "rules Description" |
---|
242 | @echo "--------- ------------------------------" |
---|
243 | @echo "debug Create debug library" |
---|
244 | @echo "opt Create optimized library" |
---|
245 | @echo "prof Create a library for profiling" |
---|
246 | @echo "docs Create PDF documentation" |
---|
247 | @echo "path Print the path to libraries, documentation..." |
---|
248 | @echo "all Create all the libraries and documentation files" |
---|
249 | @echo "clean Delete temporary files" |
---|
250 | @echo "realclean Delete libraries, documentation files and temporary files." |
---|
251 | |
---|
252 | #@echo "nolib Compile only source files and don't generate any library" => this rules is not possible because we need to overwrite external includes |
---|
253 | |
---|
254 | path : |
---|
255 | @echo "debug library : ${SYSTEMCASS_LIB}" |
---|
256 | @echo "optimized library : ${SYSTEMCASS-d_LIB}" |
---|
257 | @echo "profiling library : ${SYSTEMCASS-prof_LIB}" |
---|
258 | @echo "PDF documentation : ${SYSTEMCASS_DOCDIR}" |
---|
259 | |
---|
260 | all : debug opt prof |
---|
261 | @echo Type make docs |
---|
262 | |
---|
263 | opt : ${EXTERNAL_INCLUDES} systemc |
---|
264 | |
---|
265 | debug : ${EXTERNAL_INCLUDES} systemc-d |
---|
266 | |
---|
267 | prof : ${EXTERNAL_INCLUDES} systemc-prof |
---|
268 | |
---|
269 | cvs : recent_changes |
---|
270 | gvim recent_changes & |
---|
271 | cvs ci |
---|
272 | |
---|
273 | mark : |
---|
274 | make clean |
---|
275 | echo -n '#define SYSTEMC_VERSION "SystemCASS : ' > systemcass_version_ext.h |
---|
276 | date | head -c 28 >> systemcass_version_ext.h |
---|
277 | echo '"' >> systemcass_version_ext.h |
---|
278 | |
---|
279 | recent_changes : ${SYSTEMCASS_LIB} ${SYSTEMCASS-d_LIB} mark |
---|
280 | -cvs diff > recent_changes |
---|
281 | |
---|
282 | docs : ${DOCS} |
---|
283 | |
---|
284 | includes : ${EXTERNAL_INCLUDES} |
---|
285 | |
---|
286 | ########################### |
---|
287 | #### EXPORTING FILES |
---|
288 | ${SYSTEMCASS_INCLUDEDIR}/%.h: %.h |
---|
289 | cp $*.h ${SYSTEMCASS_INCLUDEDIR}/$*.h |
---|
290 | |
---|
291 | ${SYSTEMCASS_DOCDIR}/%.pdf: %.pdf |
---|
292 | cp $*.pdf ${SYSTEMCASS_DOCDIR}/$*.pdf |
---|
293 | |
---|
294 | ${SYSTEMCASS_DOCDIR}/%.ps: %.ps |
---|
295 | cp $*.ps ${SYSTEMCASS_DOCDIR}/$*.ps |
---|
296 | |
---|
297 | ${SYSTEMCASS_DOCDIR}/%.txt: %.txt |
---|
298 | cp $*.txt ${SYSTEMCASS_DOCDIR}/$*.txt |
---|
299 | |
---|
300 | ######################## |
---|
301 | #### COMPILING & LINKING |
---|
302 | systemc: ${SYSTEMCASS_LIB} |
---|
303 | |
---|
304 | systemc-d: ${SYSTEMCASS-d_LIB} |
---|
305 | |
---|
306 | systemc-prof: ${SYSTEMCASS-prof_LIB} |
---|
307 | |
---|
308 | ${SYSTEMCASS_LIB} : $(OBJECTS) ${EXT_OBJ} |
---|
309 | mkdir -p ${SYSTEMCASS_LIBDIR} |
---|
310 | ar -rv ${SYSTEMCASS_LIB} $(OBJECTS) $(EXT_OBJ) |
---|
311 | ranlib ${SYSTEMCASS_LIB} |
---|
312 | |
---|
313 | ${SYSTEMCASS-d_LIB}: $(OBJECTS-d) ${EXT_OBJ} |
---|
314 | mkdir -p ${SYSTEMCASS_LIBDIR} |
---|
315 | ar -rv ${SYSTEMCASS-d_LIB} $(OBJECTS-d) $(EXT_OBJ) |
---|
316 | ranlib ${SYSTEMCASS-d_LIB} |
---|
317 | |
---|
318 | ${SYSTEMCASS-prof_LIB}: $(OBJECTS-prof) ${EXT_OBJ} |
---|
319 | mkdir -p ${SYSTEMCASS_LIBDIR} |
---|
320 | ar -rv ${SYSTEMCASS-prof_LIB} $(OBJECTS-prof) $(EXT_OBJ) |
---|
321 | ranlib ${SYSTEMCASS-prof_LIB} |
---|
322 | |
---|
323 | %-d.cc : %.cc |
---|
324 | ln -s $*.cc $*-d.cc |
---|
325 | |
---|
326 | %-prof.cc : %.cc |
---|
327 | ln -s $*.cc $*-prof.cc |
---|
328 | |
---|
329 | %-d.o : %-d.cc |
---|
330 | $(CXX) $(CFLAGS) -MM $*-d.cc >> Makefile.deps |
---|
331 | $(CXX) $(CFLAGS) $(DEBUG) -c $< -o $@ |
---|
332 | |
---|
333 | %-prof.o : %-prof.cc |
---|
334 | $(CXX) $(CFLAGS) -MM $*-prof.cc >> Makefile.deps |
---|
335 | $(CXX) $(CFLAGS) $(PROF) -c $< -o $@ |
---|
336 | |
---|
337 | %.o : %.cc |
---|
338 | $(CXX) $(CFLAGS) -MM $*.cc >> Makefile.deps |
---|
339 | $(CXX) $(CFLAGS) $(OPT) -c $< -o $@ |
---|
340 | |
---|
341 | lib%.temp/*.o : ${ALLIANCE}/lib/lib%.a |
---|
342 | (mkdir lib$*.temp ; cd lib$*.temp ; ar -x ${ALLIANCE}/lib/lib$*.a) |
---|
343 | |
---|
344 | guess_endianness.x : guess_endianness.cc |
---|
345 | ${CXX} -o guess_endianness.x guess_endianness.cc |
---|
346 | |
---|
347 | ${SYSTEMCASS_INCLUDEDIR}/endianness.h : guess_endianness.x |
---|
348 | ./guess_endianness.x > ${SYSTEMCASS_INCLUDEDIR}/endianness.h |
---|
349 | |
---|
350 | include Makefile.deps |
---|
351 | |
---|
352 | ################## |
---|
353 | #### DOCUMENTATION |
---|
354 | %.dvi : %.tex |
---|
355 | |
---|
356 | %.pdf : %.ps |
---|
357 | ps2pdf $*.ps |
---|
358 | |
---|
359 | %.ps: %.dvi |
---|
360 | dvips -o $*.ps $*.dvi |
---|
361 | %.dvi %.bbl : %.tex %.bib $(eps_figures) |
---|
362 | latex $*.tex |
---|
363 | bibtex $* |
---|
364 | latex $*.tex |
---|
365 | latex $*.tex |
---|
366 | |
---|
367 | figures : $(eps_figures) |
---|
368 | @echo OK |
---|
369 | |
---|
370 | %.eps : %.fig |
---|
371 | fig2dev -L eps $*.fig $*.eps |
---|
372 | |
---|
373 | ################## |
---|
374 | #### CLEANING |
---|
375 | clean : |
---|
376 | echo > Makefile.deps |
---|
377 | rm -f *~ |
---|
378 | rm -f $(OBJECTS) |
---|
379 | rm -f $(OBJECTS-d) |
---|
380 | rm -f $(OBJECTS-prof) |
---|
381 | rm -rf $(EXT_TMP_DIR) |
---|
382 | -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null |
---|
383 | rm -f $(eps_figures) |
---|
384 | rm -f $(dvi_files) $(log_files) |
---|
385 | rm -f $(out_files) $(aux_files) $(blg_files) $(bbl_files) |
---|
386 | rm -f $(pdf_files) $(ps_files) |
---|
387 | |
---|
388 | realclean: clean |
---|
389 | rm -f ${EXTERNAL_INCLUDES} |
---|
390 | rm -rf ${SYSTEMCASS_LIBDIR} |
---|
391 | rm -f ${SYSTEMCASS_LIB} ${SYSTEMCASS-d_LIB} ${SYSTEMCASS-prof_LIB} |
---|
392 | #rm -f $(DOCS) # DONT do it. ${DOCS} includes txt files... |
---|