-LIBGL := -lGL -lGLU
+LIBGL := -lGL -lGLU
LIBSDL := `sdl-config --libs`
-LIBS := ${LIBSDL} ${LIBGL}
+LIBS := ${LIBSDL} ${LIBGL}
OPTFLAGS := -O2
DBGFLAGS := -ggdb
VALFLAGS := --leak-check=full
-TARGET := ../run_physics
+WORKINGDIR := ..
+TARGETNAME := run_physics
+TARGET := ${WORKINGDIR}/${TARGETNAME}
SRCS := # simply to keep every line below the same
include $(addsuffix /files.mk,${DIRS})
OBJSDIR := ../objs/
-OBJS := ${SRCS:.cpp=.o}
-OBJS := $(addprefix ${OBJSDIR},${OBJS})
+OBJS := ${SRCS:.cpp=.o}
+OBJS := $(addprefix ${OBJSDIR},${OBJS})
DEPSDIR := ../deps/
-DEPS := ${SRCS:.cpp=.d}
-DEPS := $(addprefix ${DEPSDIR},${DEPS})
-
-HRDS := ${SRCS:.cpp=.h}
-HRDS := $(filter-out main.h,$HRDS) # remove main.h
-HRDS += debug.h
-
-HRDS += graphics/colors.h
-
-TARS := ${SRCS} ${HRDS} Makefile
+DEPS := ${SRCS:.cpp=.d}
+DEPS := $(addprefix ${DEPSDIR},${DEPS})
VERBOSE := 0
${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<
+tags: ${SRCS}
+ ${Q1}echo "ctags: $@"
+ ${Q2}ctags $^
+
+
.PHONY: clean
clean:
${Q1}echo "CLEAN: OBJS"
${Q1}echo "git-clean: forced"
${Q2}cd ..; git clean -fxd
-tags: ${SRCS}
- ctags $^
-
.PHONY: tar
tar: ../physics.tar.bz2
.PHONY: run
run: all
- cd ..; ./run_physics
+ cd ${WORKINGDIR}; ./${TARGETNAME}
.PHONY: gdb
gdb: all
- gdb ${TARGET}
+ cd ${WORKINGDIR}; gdb ${TARGETNAME}
+
+.PHONY: cgdb
+cgdb: all
+ cd ${WORKINGDIR}; cgdb ${TARGETNAME}
.PHONY: val
val: all
- valgrind ${VALFLAGS} ${TARGET}
+ cd ${WORKINGDIR}; valgrind ${VALFLAGS} ${TARGETNAME}
.PHONY: prof
-prof: all
- ${TARGET}
- gprof -b ${TARGET} > prof
+prof: run
+ cd ${WORKINGDIR}; gprof -b ${TARGETNAME} > src/prof
kprof -f prof
-include ${DEPS}