Our forums have moved! Please go to http://forums.accellera.org for the new forums. The forums you see here will remain open for browsing, but are no longer open to new posts.
View email archives for the history of this mailing list.
systemc-forum - Re: [systemc-forum] compiling systemc in linux..!!
- From: Alan Fitch <alan.fitch@xxxxxxxxxx>
- Date: Mon, 29 Jun 2009 16:35:54 +0100
- Cc: systemc-forum@xxxxxxxxxxxxxxxxx
- Send Email to firstname.lastname@example.org:
- Send new message
- Reply to this message
Muhammed Salman wrote:|
> Hello All,
> I am a new to system c and too linux to,the problem i am facing here is
> that that i cant compile and run my program of system c ,i have followed
> the install notes which comes with system c and eveything works well but
> when i want to compile my own program by using the instruction in user
> guide it doesnt helps me....as of it says that i have to modify makefile
> and makefile.defs ..i found these two files in example folders but the
> format of these files are totally different from what it is in userguide....
> any help would be welcomed..
> -Muhammad Salman
I've attached an example Makefile.defs and Makefile.
You can put them in the same directory as your source code.
You need to edit the path to your SystemC installation at the top of
Makefile.defs (the variable SYSTEMC).
P.S. the line in the Makefile
SRCS = $(wildcard *.cpp)
creates a list of all .cpp files in the directory where make runs.
Instead you might find it easier to just list your .cpp files, e.g.
SRCS = file1.cpp ../src/file2.cpp
and so on
MODULE = run
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:.cpp=.o)
## Variable that points to SystemC installation path
SYSTEMC = /apps/systemc-2.2.0
TLM = /apps/TLM-2005-04-08/tlm
## edit this to gccsparcOS5 for solaris
TARGET_ARCH = linux
CC = g++
OPT = -O0
DEBUG = -g
SYSDIR = -I$(SYSTEMC)/include -I$(TLM)
INCDIR = -I. -I.. $(SYSDIR)
LIBDIR = -L. -L.. -L$(SYSTEMC)/lib-$(TARGET_ARCH) -Xlinker -rpath -Xlinker
## Build with maximum gcc warning level
CFLAGS = -Wall -Wno-char-subscripts -Wno-return-type -Wno-deprecated $(DEBUG)
LIBS = -lstdc++ -lm $(EXTRA_LIBS) -lsystemc
EXE = $(MODULE).x
$(EXE): $(OBJS) $(SYSTEMC)/lib-$(TARGET_ARCH)/libsystemc.a
$(CC) $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS) 2>&1 | c++filt
## based on http://www.paulandlesley.org/gmake/autodep.html
%.o : %.cpp
$(CC) $(CFLAGS) $(INCDIR) -c -MMD -o $@ $<
@cp $*.d $*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
rm -f $*.d
-rm -f $(OBJS) *~ $(EXE) *.vcd *.wif *.isdb *.dmp *.P *.log