source: sources/src/Makefile @ 22

Last change on this file since 22 was 14, checked in by buchmann, 16 years ago

Add a missing cleaning

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