Rekursives make mit getrenntem Object-Verzeichnis

TOPLEVEL = .
SUBDIRS = \
    obj

all : all_sub Aufgabe9

include $(TOPLEVEL)/Makefile.inc

STATIC_LIBRARY = obj/lib.a \
                 obj/planet/lib.a

Aufgabe9 : $(STATIC_LIBRARY)
	$(CC) -o $@ obj/main.o $(STATIC_LIBRARY) $(LDFLAGS)
CC       = g++
AR       = ar
CFLAGS   = `sdl-config --cflags` -I/usr/glew/include -I$(TOPLEVEL)/include -D_REENTRANT -Wall -std=gnu++0x
LDFLAGS  = `sdl-config --libs` -L/usr/glew/lib -lopengl32 -lglu32 -lglew32 -lSDL_ttf
OBJECT   = $(SOURCES:%.cxx=%.o)

# CFLAGS  = -IC:\MinGW\msys\1.0\libsdl\include\SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -I$(TOPLEVEL)/include -D_REENTRANT -Wall
# LDFLAGS = -LC:\MinGW\msys\1.0\libsdl\lib -lmingw32 -lSDLmain -lSDL -mwindows -lopengl32 -lglu32 -lSDL_ttf

all_sub:
	if test "$(SUBDIRS)" != ""; then \
		for subdir in $(SUBDIRS); do \
			(cd $$subdir; make all); \
		done; \
	fi;

clean: clean_sub
	rm -f *.o *.a $(CLEANFILES)

clean_sub:
	if test "$(SUBDIRS)" != ""; then \
		for subdir in $(SUBDIRS); do \
			(cd $$subdir; make clean); \
		done; \
	fi;

$(LIBRARY): $(OBJECT)
	$(AR) rcu $(LIBRARY) $(OBJECT)
#	$(AR) rcs $(LIBRARY) $(OBJECT)

%.o: $(TOPLEVEL)/$(CURRENT)/%.cxx
	$(CC) -c $(CFLAGS) $<

.SILENT: all_sub clean_sub
CURRENT  = src
TOPLEVEL = ..
LIBRARY  = lib.a

SUBDIRS = \
    planet

SOURCES = \
	main.cxx \
	GLSL.cxx \
	textfile.cxx \
	Vector.cxx \
	Matrix.cxx \
	Keyboard.cxx \
	Settings.cxx \
	Game.cxx \
	Camera.cxx \
	Light.cxx \
	Texture.cxx \
	TextureFactory.cxx \
	World.cxx \
	text.cxx \
	Debug.cxx \
	3ds.cxx \
	Ship.cxx \
	Shot.cxx \
	Billboard.cxx \
	Explosion.cxx \
	DisplayList.cxx

include $(TOPLEVEL)/Makefile.inc

all: all_sub $(LIBRARY)
CURRENT  = src/planet
TOPLEVEL = ../..
LIBRARY  = lib.a

SUBDIRS = 

SOURCES = \
	Planet.cxx \
	Ring.cxx \
	Sun.cxx \
	Earth.cxx \
	EarthMoon.cxx \
	Jupiter.cxx \
	Mars.cxx \
	Mercury.cxx \
	Neptun.cxx \
	Pluto.cxx \
	Saturn.cxx \
	Saturnring.cxx \
	Uranus.cxx \
	Venus.cxx

include $(TOPLEVEL)/Makefile.inc

all: all_sub $(LIBRARY)

Leave a Reply

Your email address will not be published. Required fields are marked *