у меня есть Makefile такого содержания:
LIBS = -L/usr/lib -lSDL
ADDLIBS = -lSDL_image -lSDL_ttf -lSDL_mixer
IDIR = -I. -I./src/
CC = g++ -g
NAME = Game
SHELL = /bin/sh
#vpath %.o obj
#VPATH = obj
all: main.o ceventmanager.o cgui.o edit.o label.o button.o animation.o sound.o font.o map.o player.o image.o mysdl.o
$(CC) -o Game $^ $(IDIR) $(LIBS) $(ADDLIBS)
main.o: src/main.cpp
$(CC) -c src/main.cpp -o obj/main.o $(IDIR) $(LIBS) $(ADDLIBS)
ceventmanager.o: src/cEventManager.cpp src/cEventManager.h
$(CC) -c src/cEventManager.cpp -o obj/ceventmanager.o $(IDIR) $(LIBS)
cgui.o: label.o button.o edit.o src/gui/cGui.cpp src/gui/cGui.h
$(CC) -c src/gui/cGui.cpp -o obj/cgui.o $(IDIR) $(LIBS)
label.o: image.o src/gui/cLabel.cpp src/gui/cLabel.h
$(CC) -c src/gui/cLabel.cpp -o obj/label.o $(IDIR) $(LIBS)
image.o: src/image.cpp src/image.h
$(CC) -c src/image.cpp -o obj/image.o $(IDIR) $(LIBS)
button.o: label.o src/gui/cButton.cpp src/gui/cButton.h
$(CC) -c src/gui/cButton.cpp -o obj/button.o $(IDIR) $(LIBS)
edit.o: label.o src/gui/cEdit.cpp src/gui/cEdit.h
$(CC) -c src/gui/cEdit.cpp -o obj/edit.o $(IDIR) $(LIBS)
mysdl.o: src/mysdl.cpp src/mysdl.h
$(CC) -c src/mysdl.cpp -o obj/mysdl.o $(IDIR) $(LIBS)
font.o: src/font.cpp src/font.h
$(CC) -c src/font.cpp -o obj/font.o $(IDIR) $(LIBS)
sound.o: src/sound.cpp src/sound.h
$(CC) -c src/sound.cpp -o obj/sound.o $(IDIR) $(LIBS)
animation.o: src/animation.cpp src/animation.h
$(CC) -c src/animation.cpp -o obj/animation.o $(IDIR) $(LIBS)
map.o: src/map.cpp src/map.h
$(CC) -c src/map.cpp -o obj/map.o $(IDIR) $(LIBS)
player.o: src/player.cpp src/player.h
$(CC) -c src/player.cpp -o obj/player.o $(IDIR) $(LIBS)
clean:
rm -rf obj/*.o src/*~ *~ Game