diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2011-12-25 16:15:15 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-05 17:17:50 +0100 |
commit | 6b6a6f4331631bb4ef92a23c80e982f2a6b76109 (patch) | |
tree | 0c8c89218ba6135f2c59308af512d9fe3d7bde35 | |
parent | fb70fe4e1a04b6041a50da7e2e76200fb18de0f9 (diff) | |
download | usdx-6b6a6f4331631bb4ef92a23c80e982f2a6b76109.tar.gz usdx-6b6a6f4331631bb4ef92a23c80e982f2a6b76109.tar.xz usdx-6b6a6f4331631bb4ef92a23c80e982f2a6b76109.zip |
Makefile: simplified Makefile
TOP should not be needed to set anymore
Makefile.inc could be included before all other
Diffstat (limited to '')
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | Makefile.inc | 11 | ||||
-rw-r--r-- | test/Makefile | 19 |
3 files changed, 19 insertions, 19 deletions
@@ -1,10 +1,8 @@ TARGET:=usdx -TOP:=. +include Makefile.inc -headers:=$(wildcard ${TOP}/src/*.hpp) -sources:=$(wildcard ${TOP}/src/*.cpp) - -include ${TOP}/Makefile.inc +headers+=$(wildcard src/*.hpp) +sources+=$(wildcard src/*.cpp) ############################################################################## diff --git a/Makefile.inc b/Makefile.inc index bc56d6d9..661da8b8 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1,10 +1,11 @@ # -*- mode: makefile -*- +TOP:=$(dir $(lastword $(MAKEFILE_LIST))) -headers+=$(wildcard $(TOP)/src/*/*.hpp) $(wildcard $(TOP)/src/*/*/*.hpp) -sources+=$(wildcard $(TOP)/src/*/*.cpp) $(wildcard $(TOP)/src/*/*/*.cpp) +headers+=$(wildcard $(TOP)src/*/*.hpp) $(wildcard $(TOP)src/*/*/*.hpp) +sources+=$(wildcard $(TOP)src/*/*.cpp) $(wildcard $(TOP)src/*/*/*.cpp) -deps:=$(sources:.cpp=.d) -objects:=$(sources:.cpp=.o) +deps=$(sources:.cpp=.d) +objects=$(sources:.cpp=.o) # APPS PKG_CONFIG:=pkg-config @@ -13,7 +14,7 @@ LOG4CPP_CONFIG:=log4cpp-config # CFLAGS PEDENTIC:=-Wall -Werror DEBUG:=-g -INC_PATH:=-I$(TOP)/src +INC_PATH:=-I$(TOP)src/ FTGL_CFLAGS:=$(shell $(PKG_CONFIG) ftgl --cflags) # LDFLAGS 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 $@ |