From 6b6a6f4331631bb4ef92a23c80e982f2a6b76109 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 25 Dec 2011 16:15:15 +0100 Subject: Makefile: simplified Makefile TOP should not be needed to set anymore Makefile.inc could be included before all other --- test/Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'test/Makefile') diff --git a/test/Makefile b/test/Makefile index e7281e96..cfb63f06 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,22 +1,23 @@ TARGET:=usdx-tests -TOP:=.. +include ../Makefile.inc -headers:=$(wildcard *.hpp) $(wildcard */*.hpp) -sources:=$(wildcard *.cpp) $(wildcard */*.cpp) - -include ${TOP}/Makefile.inc +headers+=$(wildcard *.hpp) $(wildcard */*.hpp) +sources+=$(wildcard *.cpp) $(wildcard */*.cpp) LDFLAGS+=-lcppunit CXXFLAGS-COVERAGE:=-fprofile-arcs -ftest-coverage LDFLAGS-COVERAGE:=-coverage TARGET-COVERAGE:=$(TARGET)-coverage -COVERAGE-DIR:=$(TOP)/coverage +COVERAGE-DIR:=$(TOP)coverage objects-coverage:=$(patsubst %,$(COVERAGE-DIR)/obj/test/%,$(sources:.cpp=.o)) coverage:=$(COVERAGE-DIR)/coverage.info.tmp $(COVERAGE-DIR)/coverage.info \ $(objects-coverage:.o=.gcda) $(objects-coverage:.o=.gcno) \ $(COVERAGE-DIR)/obj/ +# include the apropriate dir from main src tree +SRC_INC=$(addprefix -I$(TOP)src/,$(filter-out ..%,$(dir $<))) + ############################################################################## .PHONY: all clean run @@ -40,10 +41,10 @@ $(TARGET): $(objects) $(deps) $(CXX) $(LDFLAGS) -o $(TARGET) $(objects) %.o: %.cpp - $(CXX) $(CXXFLAGS) -MMD -c $< -o $@ + $(CXX) $(CXXFLAGS) $(SRC_INC) -MMD -c $< -o $@ %.d: %.cpp - $(CXX) $(CXXFLAGS) -MM -c $< -MF $@ + $(CXX) $(CXXFLAGS) $(SRC_INC) -MM -c $< -MF $@ ############################################################################## # build and execute tests with code coverage and build nice html pages @@ -73,5 +74,5 @@ $(TARGET-COVERAGE): $(objects-coverage) $(deps) $(COVERAGE-DIR)/obj/test/%.o: %.cpp @[ -d $(dir $@) ] || mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) $(CXXFLAGS-COVERAGE) -MMD -c $< -o $@ + $(CXX) $(CXXFLAGS) $(CXXFLAGS-COVERAGE) $(SRC_INC) -MMD -c $< -o $@ -- cgit v1.2.3