trican
asked on
Makefile
Hi,
I'm trying to reuse a makefile, unfortuneatly i'm not that familar with their structure and am utter perplexed. Hopefully someone will be able to lend a hand. The error message I'm getting is:
"No rule to make target "test.o" needed by test.x. STOP"
******makefile************ ***
TARGET_ARCH = cygwin
CC = g++
OPT = -O3
DEBUG =
CFLAGS = $(DEBUG) $(OPT) -fexceptions
MODULE = test
SRCS = test.cpp
OBJS = $(SRCS:.cpp=.o)
include ./Makefile.defs
****** makefile.defs***********
SYSTEMC = /cgydrive/c/SystemC/system c-2.0.1
INCDIR = -I. -I.. -I$(SYSTEMC)/include
LIBDIR = -L. -L.. -L$(SYSTEMC)/lib-$(TARGET_ ARCH)
LIBS = -lsystemc -lm $(EXTRA_LIBS)
EXE = $(MODULE).x
.SUFFIXES: .cc .cpp .o .x
$(EXE): $(OBJS) $(SYSTEMC)/lib-$(TARGET_AR CH)/libsys temc.a
$(CC) $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS) 2>&1 | c++filt
.cpp.o:
$(CC) $(CFLAGS) $(INCDIR) -c $<
.cc.o:
$(CC) $(CFLAGS) $(INCDIR) -c $<
clean::
rm -f $(OBJS) *~ $(EXE) core
ultraclean: clean
rm -f Makefile.deps
Makefile.deps:
# $(CC) $(CFLAGS) $(INCDIR) -M $(SRCS) >> Makefile.deps
#include Makefile.deps
I'm trying to reuse a makefile, unfortuneatly i'm not that familar with their structure and am utter perplexed. Hopefully someone will be able to lend a hand. The error message I'm getting is:
"No rule to make target "test.o" needed by test.x. STOP"
******makefile************
TARGET_ARCH = cygwin
CC = g++
OPT = -O3
DEBUG =
CFLAGS = $(DEBUG) $(OPT) -fexceptions
MODULE = test
SRCS = test.cpp
OBJS = $(SRCS:.cpp=.o)
include ./Makefile.defs
****** makefile.defs***********
SYSTEMC = /cgydrive/c/SystemC/system
INCDIR = -I. -I.. -I$(SYSTEMC)/include
LIBDIR = -L. -L.. -L$(SYSTEMC)/lib-$(TARGET_
LIBS = -lsystemc -lm $(EXTRA_LIBS)
EXE = $(MODULE).x
.SUFFIXES: .cc .cpp .o .x
$(EXE): $(OBJS) $(SYSTEMC)/lib-$(TARGET_AR
$(CC) $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS) 2>&1 | c++filt
.cpp.o:
$(CC) $(CFLAGS) $(INCDIR) -c $<
.cc.o:
$(CC) $(CFLAGS) $(INCDIR) -c $<
clean::
rm -f $(OBJS) *~ $(EXE) core
ultraclean: clean
rm -f Makefile.deps
Makefile.deps:
# $(CC) $(CFLAGS) $(INCDIR) -M $(SRCS) >> Makefile.deps
#include Makefile.deps
Hi trican,
You should check if you either have test.cc or test.cpp.
Cheers!
Stefan
You should check if you either have test.cc or test.cpp.
Cheers!
Stefan
ASKER
Stefan - the file exists - test.h & test.cpp
jkr - when i do that, i get a message about the library I've included - no rule to make target "/cgydrive/c .....", but this has already been compiled
confused :-(
jkr - when i do that, i get a message about the library I've included - no rule to make target "/cgydrive/c .....", but this has already been compiled
confused :-(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ouch indeed....
the library (systemc) contains its own makefiles etcso it seems to be getting more complicated by the second.
the library (systemc) contains its own makefiles etcso it seems to be getting more complicated by the second.
ASKER
ok, things are getting slightly better,
here now is the error message i'm getting:
g++ -O3 -Wall -I. -I.. -I/home/*****/systemc-2.0. 1/include -c -o src/Test.o src/Test.cpp
g++ -O3 -Wall -I. -I.. -I/home/****/systemc-2.0.1 /include -L. -L.. -L/home/*****/systemc-2.0. 1/lib-linu x -o test.exe src/Test.o -lsystemc -lm 2>&1 | c++filt
/home/******/systemc-2.0.1 /lib-linux /libsystem c.a(sc_mai n.o): In function `main':
sc_main.o(.text+0x1d): undefined reference to `sc_main'
collect2: ld returned 1 exit status
And this is the make file I'm using now.......
#Setup libraries etc
TARGET_ARCH = linux
SYSTEMC = /home/**********/systemc-2 .0.1
INCDIR = -I. -I.. -I$(SYSTEMC)/include
LIBDIR = -L. -L.. -L$(SYSTEMC)/lib-$(TARGET_ ARCH)
LIBS = -lsystemc -lm
#BME_1xPE makefile
CC = g++
OPT = -O3
DEBUG = -g
OTHER = -Wall
CFLAGS = $(OPT) $(OTHER)
#CFLAGS = $(DEBUG) $(OTHER) debug version
MODULE = test
EXE = $(MODULE).exe
SRCS:= src/Test.cpp
OBJS = $(SRCS:%.cpp=%.o)
#OBJS = $(SRCS:.cpp=.o) - when i use this it doesn't create the .o file
$(EXE) : $(OBJS) $(SYSTEMC)/lib-$(TARGET_AR CH)/libsys temc.a
$(CC) $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS) 2>&1 | c++filt
.cpp.o:
$(CC) $(CFLAGS) $(INCDIR) -c $<
#%.o : %.cpp
# $(CC) $(CFLAGS) $(INCDIR) -c -o $@ $<
# cleaning everything that can be automatically recreated with "make".
clean:
/bin/rm -f $(EXE) $(OBJS)
#dependancies
Test.o : include/test.h
here now is the error message i'm getting:
g++ -O3 -Wall -I. -I.. -I/home/*****/systemc-2.0.
g++ -O3 -Wall -I. -I.. -I/home/****/systemc-2.0.1
/home/******/systemc-2.0.1
sc_main.o(.text+0x1d): undefined reference to `sc_main'
collect2: ld returned 1 exit status
And this is the make file I'm using now.......
#Setup libraries etc
TARGET_ARCH = linux
SYSTEMC = /home/**********/systemc-2
INCDIR = -I. -I.. -I$(SYSTEMC)/include
LIBDIR = -L. -L.. -L$(SYSTEMC)/lib-$(TARGET_
LIBS = -lsystemc -lm
#BME_1xPE makefile
CC = g++
OPT = -O3
DEBUG = -g
OTHER = -Wall
CFLAGS = $(OPT) $(OTHER)
#CFLAGS = $(DEBUG) $(OTHER) debug version
MODULE = test
EXE = $(MODULE).exe
SRCS:= src/Test.cpp
OBJS = $(SRCS:%.cpp=%.o)
#OBJS = $(SRCS:.cpp=.o) - when i use this it doesn't create the .o file
$(EXE) : $(OBJS) $(SYSTEMC)/lib-$(TARGET_AR
$(CC) $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS) 2>&1 | c++filt
.cpp.o:
$(CC) $(CFLAGS) $(INCDIR) -c $<
#%.o : %.cpp
# $(CC) $(CFLAGS) $(INCDIR) -c -o $@ $<
# cleaning everything that can be automatically recreated with "make".
clean:
/bin/rm -f $(EXE) $(OBJS)
#dependancies
Test.o : include/test.h
ASKER
ok figured it out myself - neverthe less the pointers were helpful - so I'll still award the points to stefan73
incidentlyHow do you force the object files to be placed in a directory other than where the source file is located (just for tidyness)
incidentlyHow do you force the object files to be placed in a directory other than where the source file is located (just for tidyness)
OBJS = test.o