Browse Source

Build: Makefiles cleanup

LIB-12
heck 2 months ago
parent
commit
b54f9d122b
3 changed files with 24 additions and 25 deletions
  1. +7
    -20
      Makefile.conf
  2. +2
    -1
      src/Makefile
  3. +15
    -4
      test/Makefile

+ 7
- 20
Makefile.conf View File

@ -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


+ 2
- 1
src/Makefile View File

@ -15,7 +15,8 @@ ifneq ($(MAKECMDGOALS),clean)
-include $(DEPENDS)
endif
.PHONY: install uninstall clean
.PHONY: all install uninstall clean
.DEFAULT_GOAL := all
all: $(TARGET)


+ 15
- 4
test/Makefile View File

@ -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.*

Loading…
Cancel
Save