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.
KMLM List
View email archives for the history of this mailing list.
|
|
|
|
systemc-forum - Re: [systemc-forum] compiling systemc in linux..!!
|
Message Thread:
Previous |
Next
|
- From: Alan Fitch <alan.fitch@xxxxxxxxxx>
- Date: Mon, 29 Jun 2009 16:35:54 +0100
- Cc: systemc-forum@xxxxxxxxxxxxxxxxx
- Send Email to systemc-forum@lists.systemc.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..
> Br
> -Muhammad Salman
>
>
Hi Muhammad,
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).
regards
Alan
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
--
Alan Fitch
http://www.doulos.com
EXTRACFLAGS =
EXTRA_LIBS =
MODULE = run
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:.cpp=.o)
include ./Makefile.defs
## 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
$(SYSTEMC)/lib-$(TARGET_ARCH)
## Build with maximum gcc warning level
CFLAGS = -Wall -Wno-char-subscripts -Wno-return-type -Wno-deprecated $(DEBUG)
$(OPT) $(EXTRACFLAGS)
LIBS = -lstdc++ -lm $(EXTRA_LIBS) -lsystemc
EXE = $(MODULE).x
.PHONY: clean
$(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
clean:
-rm -f $(OBJS) *~ $(EXE) *.vcd *.wif *.isdb *.dmp *.P *.log
-include $(SRCS:.cpp=.P)
|
|