From 630fa680c584077b5bf6ae00b382683b1b1f3cf2 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Sun, 24 May 2009 14:11:23 -0400 Subject: [PATCH] cleaned up how dir.mk files work --- Makefile | 20 ++++++++++++-------- src/dir.mk | 7 +++---- src/locks/dir.mk | 10 ++++++++-- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 5b362b3..ac3d9dc 100644 --- a/Makefile +++ b/Makefile @@ -109,12 +109,22 @@ else endif -# include all of the dir.mk -DIRS := # := start +# cause the fancy $${@D} directory rules to work out +.SECONDEXPANSION: + +.PHONY: all +all: ${TARGET} + + +# lists populated by dir.mk files in subdirectories SRCS := # := start +DIRS := # := start OBJS := # := start DEPS := # := start + DIRMK := dir.mk + +# include all of the dir.mk files in src include ${SRCSDIR}${DIRMK} @@ -127,9 +137,6 @@ BLDDIRS += ${DEPSBLDDIRS} BLDDIRS += ${WORKINGDIR} -.PHONY: all -all: ${TARGET} - INSTALL := install # HACK install @@ -147,9 +154,6 @@ uninstall: rm /usr/lib/${LINKERNAME} rm /usr/lib/${SONAME} -# cause the fancy $${@D} directory rules to work out -.SECONDEXPANSION: - # how to link the main target ${TARGETTMP}: ${OBJS} | $${@D} ${Q1}${PRNTFMT} "${CXX}" "$@" diff --git a/src/dir.mk b/src/dir.mk index b03257c..6f0b4e0 100644 --- a/src/dir.mk +++ b/src/dir.mk @@ -1,13 +1,12 @@ -NEWSRCS := # insure blank +NEWSRCS := # := start; empty NEWSRCS += Vector2.cpp NEWSRCS += mathw.cpp NEWSRCS += debug.cpp NEWSRCS += Timer.cpp NEWSRCS += Ticks.cpp -NEWDIRS := # insure blank - +NEWDIRS := # := start; empty NEWDIRS += locks/ # Post dir setup @@ -22,7 +21,7 @@ NEWDEPS := ${NEWSRCS:.cpp=.d} # Append to lists SRCS += ${NEWSRCS} -DIRS += ${NEWDIRS} +DIRS += ${CURDIR} OBJS += $(addprefix ${OBJSDIR},${NEWOBJS}) DEPS += $(addprefix ${DEPSDIR},${NEWDEPS}) diff --git a/src/locks/dir.mk b/src/locks/dir.mk index 7a6068d..0c0b1e6 100644 --- a/src/locks/dir.mk +++ b/src/locks/dir.mk @@ -1,19 +1,25 @@ -NEWSRCS := # insure blank +NEWSRCS := # := start; empty NEWSRCS += Autolock.cpp NEWSRCS += Lock.cpp +NEWDIRS := # := start; empty # Post dir setup -CURDIR := locks/ +CURDIR := locks/ NEWSRCS := $(addprefix ${CURDIR},${NEWSRCS}) +NEWDIRS := $(addprefix ${CURDIR},${NEWDIRS}) NEWOBJS := ${NEWSRCS:.cpp=.o} NEWDEPS := ${NEWSRCS:.cpp=.d} # Append to lists SRCS += ${NEWSRCS} +DIRS += ${CURDIR} OBJS += $(addprefix ${OBJSDIR},${NEWOBJS}) DEPS += $(addprefix ${DEPSDIR},${NEWDEPS}) + + +include $(addprefix ${SRCSDIR},$(addsuffix ${DIRMK},${NEWDIRS})) -- 2.10.2