From 869b3330e97cabcbf9b63867d3833ac163841f9b Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Sat, 15 Nov 2008 22:08:47 -0500 Subject: [PATCH] cleaning of the Makefile --- src/Makefile | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Makefile b/src/Makefile index ec5ce8e..b9dc85d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,14 +7,12 @@ OPTFLAGS := -O2 DBGFLAGS := -ggdb PRFFLAGS := ${DBGFLAGS} -pg MYFLAGS := -Wall -pedantic -ansi -CXXFLAGS := ${MYFLAGS} ${DBGFLAGS} VALFLAGS := --leak-check=full +CXXFLAGS := ${MYFLAGS} ${DBGFLAGS} CXX := g++ -SRCS := # := start - DIRS := # := start DIRS += ./ DIRS += Entities/ @@ -24,8 +22,11 @@ DIRS += config/ DIRS += input/ DIRS += graphics/ +SRCS := # := start include $(addsuffix /files.mk,${DIRS}) +WORKINGDIR := ../bin/ + OBJSDIR := ../objs/ OBJS := ${SRCS:.cpp=.o} OBJS := $(addprefix ${OBJSDIR},${OBJS}) @@ -34,22 +35,21 @@ DEPSDIR := ../deps/ DEPS := ${SRCS:.cpp=.d} DEPS := $(addprefix ${DEPSDIR},${DEPS}) -WORKINGDIR := ../bin/ +CFGDIRNAME := configs/ +SRCCFGDIR := ../${CFGDIRNAME} +DSTCFGDIR := ${WORKINGDIR}${CFGDIRNAME} + +CFGS := # := start +CFGS += keys.cfg +CFGS := $(addprefix ${DSTCFGDIR},${CFGS}) + TARGETNAME := run_physics TARGETTMP := ${OBJSDIR}${TARGETNAME} TARGET := ${WORKINGDIR}${TARGETNAME} -CONFIGDIRNAME := configs/ -CONFIGDIR := ../${CONFIGDIRNAME} -CONFIGDEST := ${WORKINGDIR}${CONFIGDIRNAME} - -CONFIGS := # := start -CONFIGS += keys.cfg -CONFIGS := $(addprefix ${CONFIGDEST},${CONFIGS}) - DEPSBLDDIRS := $(addprefix ${DEPSDIR},${DIRS}) OBJSBLDDIRS := $(addprefix ${OBJSDIR},${DIRS}) -BLDDIRS := ${OBJSBLDDIRS} ${DEPSBLDDIRS} ${WORKINGDIR} ${CONFIGDEST} +BLDDIRS := ${OBJSBLDDIRS} ${DEPSBLDDIRS} ${WORKINGDIR} ${DSTCFGDIR} VERBOSE := 0 @@ -67,36 +67,36 @@ else endif .PHONY: all -all: ${TARGET} ${CONFIGS} +all: ${TARGET} ${CFGS} -# rule to copy the config files into the working directory -${CONFIGDEST}%.cfg: ${CONFIGDIR}%.cfg | ${CONFIGDEST} ${WORKINGDIR} - ${Q1}echo "cp: $@" - ${Q2}cp $< $@ +# how to link the main target +${TARGETTMP}: ${OBJS} + ${Q1}echo "${CXX}: $@" + ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS} # rule to copy tmp target to working directory ${TARGET}: ${TARGETTMP} | ${WORKINGDIR} ${Q1}echo "cp: $@" ${Q2}cp $< $@ -# how to link the main target -${TARGETTMP}: ${OBJS} - ${Q1}echo "${CXX}: $@" - ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS} - # how to make a directory ${BLDDIRS}: ${Q2}mkdir -p $@ +# rule to make an object file from a .cpp +${OBJSDIR}%.o: %.cpp | ${OBJSBLDDIRS} + ${Q1}echo "${CXX}: $@" + ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< + # rule to make a depend file from a .cpp ${DEPSDIR}%.d: %.cpp | ${DEPSBLDDIRS} ${Q1}echo "DEP: $@" ${Q2}${CXX} -MM ${CXXFLAGS} $< | sed 's,\(^.*\):,${OBJSDIR}\1 $@:,' > $@ -# rule to make an object file from a .cpp -${OBJSDIR}%.o: %.cpp | ${OBJSBLDDIRS} - ${Q1}echo "${CXX}: $@" - ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< +# rule to copy the config files into the working directory +${DSTCFGDIR}%.cfg: ${SRCCFGDIR}%.cfg | ${DSTCFGDIR} + ${Q1}echo "cp: $@" + ${Q2}cp $< $@ tags: ${SRCS} -- 2.10.2