diff --git a/Makefile.conf b/Makefile.conf index ad57f57..bdb0226 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -7,16 +7,18 @@ HERE:=$(dir $(lastword $(MAKEFILE_LIST))) TARGET=libpEpAdapter.a +# Build config # Defaults DEBUG=1 PREFIX?=$(HOME) -ENGINE_LIB_PATH=$(PREFIX)/lib -ENGINE_INC_PATH=$(PREFIX)/include -CXXFLAGS+=-std=c++14 -fPIC +# Overrides +-include $(HERE)local.conf -# Build target -BUILD_FOR:=$(shell uname) +# Constants +CXXFLAGS+=-std=c++11 -fPIC +CXXFLAGS+=-I$(PREFIX)/include +LDFLAGS+=-L$(PREFIX)/lib ifneq (,$(findstring g++,$(CXX))) CXXFLAGS+=-fdiagnostics-color=always @@ -24,27 +26,12 @@ else ifneq (,$(findstring clang,$(CXX))) CXXFLAGS+=-fcolor-diagnostics endif - -######### Overrides ######### --include $(HERE)local.conf - ifeq ($(DEBUG),1) CXXFLAGS+=-g -O0 else CXXFLAGS+=-DNDEBUG=1 -O3 endif -# Add -L Prefixes to LIB/INC paths, -# if not already explicitly set in local.conf -ifndef ENGINE_LIB - ENGINE_LIB=-L$(ENGINE_LIB_PATH) -endif -ifndef ENGINE_INC - ENGINE_INC=-I$(ENGINE_INC_PATH) -endif - -CXXFLAGS += $(ENGINE_INC) - ifndef ENGINE_TEST ENGINE_TEST = \"$(HOME)/dev/pEpEngine/test\" endif diff --git a/src/Makefile b/src/Makefile index 850134e..1efb480 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,7 +15,8 @@ ifneq ($(MAKECMDGOALS),clean) -include $(DEPENDS) endif -.PHONY: install uninstall clean +.PHONY: all install uninstall clean +.DEFAULT_GOAL := all all: $(TARGET) diff --git a/test/Makefile b/test/Makefile index 62e81de..1c77eae 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,30 +1,41 @@ include ../Makefile.conf -LDFLAGS=-L../src $(ENGINE_LIB) +LDFLAGS:=-L../src $(LDFLAGS) LDLIBS=-lstdc++ -lpEpEngine -lpEpAdapter CXXFLAGS:=-I../src -DENGINE_TEST=$(ENGINE_TEST) $(CXXFLAGS) +# Test SRC_TEST=$(wildcard test_*.cc) BIN_TEST=$(subst .cc,,$(SRC_TEST)) +# Framework SRC_FRAMEWORK=$(wildcard framework/*.cc) OBJ_FRAMEWORK=$(subst .cc,.o,$(SRC_FRAMEWORK)) +# Depends +DEP_TEST=$(subst .cc,.d,$(SRC_TEST)) +DEP_FRAMEWORK=$(subst .cc,.d,$(SRC_FRAMEWORK)) +DEPENDS+= $(DEP_TEST) $(DEP_FRAMEWORK) +CXXFLAGS+= -MMD -MP + +ifneq ($(MAKECMDGOALS),clean) + -include $(DEPENDS) +endif + .PHONY: all clean rmtestdata +.DEFAULT_GOAL := all all: $(BIN_TEST) - $(BIN_TEST): $(OBJ_FRAMEWORK) - clean: rm -f $(BIN_TEST) rm -f $(OBJ_FRAMEWORK) rm -Rf *.dSYM + rm -f *.d rm -f *.o rm -Rf /tmp/test_pEp.* rmtestdata: rm -Rf /tmp/test_pEp.* -