From 67b5017fa0546c38ca7ad765613b421514cc7d07 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Sun, 28 Sep 2008 00:12:42 -0400 Subject: [PATCH] more makefile cleaning --- src/Makefile | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3eb3e59..1ebf227 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ -LIBGL := -lGL -lGLU +LIBGL := -lGL -lGLU LIBSDL := `sdl-config --libs` -LIBS := ${LIBSDL} ${LIBGL} +LIBS := ${LIBSDL} ${LIBGL} OPTFLAGS := -O2 DBGFLAGS := -ggdb @@ -10,7 +10,9 @@ CXXFLAGS := -Wall -pedantic -ansi ${DBGFLAGS} VALFLAGS := --leak-check=full -TARGET := ../run_physics +WORKINGDIR := .. +TARGETNAME := run_physics +TARGET := ${WORKINGDIR}/${TARGETNAME} SRCS := # simply to keep every line below the same @@ -26,20 +28,12 @@ DIRS += graphics 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 @@ -74,6 +68,11 @@ ${OBJSDIR}%.o: %.cpp ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< +tags: ${SRCS} + ${Q1}echo "ctags: $@" + ${Q2}ctags $^ + + .PHONY: clean clean: ${Q1}echo "CLEAN: OBJS" @@ -98,9 +97,6 @@ gitcleanf: ${Q1}echo "git-clean: forced" ${Q2}cd ..; git clean -fxd -tags: ${SRCS} - ctags $^ - .PHONY: tar tar: ../physics.tar.bz2 @@ -112,20 +108,23 @@ 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} -- 2.10.2