Hello,
I have the following makefile
Code:
# unrelevant definitions like CC, LDFLAGS etc.. removed
PRECALC=perl precalc.pl
OBJS=main.o joystick.o player.o level.o conf.o gobject.o objectfactory.o \
ginfo.o hplayer.o
all: $(RACE)
.SUFFIXES: .c .cpp .o
.c.o: %.c
$(CC) $< -E $(CFLAGS) | $(PRECALC) | $(CC) -x c -c - -o $@
.cpp.o: %.c
$(CXX) $< -E $(CXXFLAGS) | $(PRECALC) | $(CXX) -x c++ -c - -o $@
$(RACE): $(OBJS)
$(CXX) -o $(RACE) $^ $(LIBS) $(LIBSDIR) $(LDFLAGS);
clean:
rm -f *.o
rm -f $(RACE)
# Autogenerated list using gcc -E -MM
joystick.o: joystick.c joystick.h conf.h debug.h
conf.o: conf.c conf.h debug.h
objectfactory.o: objectfactory.cpp objectfactory.h debug.h \
objects/gobject.h conf.h debug.h objects/player.h ginfo.h \
objects/gobject.h conf.h objects/hplayer.h objects/player.h \
objects/gobject.h joystick.h
level.o: level.cpp level.h conf.h objects/gobject.h conf.h debug.h \
ginfo.h debug.h objectfactory.h objects/player.h ginfo.h \
objects/gobject.h
ginfo.o: ginfo.cpp ginfo.h objects/gobject.h conf.h debug.h
main.o: main.cpp joystick.h conf.h objects/player.h debug.h conf.h \
ginfo.h objects/gobject.h objects/gobject.h level.h ginfo.h debug.h
gobject.o: objects/gobject.cpp objects/gobject.h conf.h debug.h
player.o: objects/player.cpp objects/player.h debug.h conf.h ginfo.h \
objects/gobject.h objects/gobject.h level.h conf.h ginfo.h
hplayer.o: objects/hplayer.cpp objects/hplayer.h objects/player.h debug.h \
conf.h ginfo.h objects/gobject.h objects/gobject.h objects/gobject.h \
joystick.h conf.h
echo "Hello world"
Doing a "make hplayer.o" makes make printout "hello world", however doing a "make player.o" make prints out "make: Nothing to be done for `player.o'." similarly for any other file that depends on things in a subdirectory.
Why won't the objects that depend on subdirectories compile?
Thanks