INC_PATH=$(ROOT_PATH)
LIB_PATH=$(ROOT_PATH)/ext

#system
SYSTEM=SDL

#compiler
CC = g++
#linker
LD = g++

CFLAGS = -pipe -Wall -ggdb -pg -I$(INC_PATH) -I$(LIB_PATH) -DSYSTEM=$(SYSTEM) `sdl-config --cflags`
LDFLAGS = -pg `sdl-config --libs` -lm -lGL -lGLU -lSDL_image

OBJS = ${SRCS:.cpp=.o}

################################
# functions for all makefiles
################################

all: subdirs objects

.cpp.o: 
	$(CC) $(CFLAGS) -c $<

objects: $(OBJS)

dep:
	@for i in $(SUBDIRS); do\
        cd $$i && $(MAKE) dep; \
		cd ..; \
    done
	makedepend -f- -- $(CFLAGS) -- $(SRCS) 2>/dev/null > .depend

subdirs:
	@for i in $(SUBDIRS); do\
        cd $$i && $(MAKE); \
		cd ..; \
    done

clean: localclean
	rm -f *.o
	@for i in $(SUBDIRS); do\
        cd $$i && $(MAKE) clean; \
		cd ..; \
    done

depclean: 
	rm -f .depend
	@for i in $(SUBDIRS); do\
        cd $$i && $(MAKE) clean; \
		cd ..; \
    done


