From 223f4ac3cd1caa98941edb328905486c444a871d Mon Sep 17 00:00:00 2001 From: heck Date: Thu, 6 Jan 2022 00:12:33 +0100 Subject: [PATCH] Build: Add Makefile-based build --- Makefile | 10 ++++++++-- src/pEp/_pEp/Makefile | 35 +++++++++++++++++++++++++++++++++++ src/pEp/_pEp/Makefile.conf | 16 ++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/pEp/_pEp/Makefile create mode 100644 src/pEp/_pEp/Makefile.conf diff --git a/Makefile b/Makefile index 1a92ced..5311b97 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ compile: compile-inplace: python3 setup.py build_ext $(DEBUG_OPT) $(PREFIX_OPT) --inplace +makefile-build: + $(MAKE) -C src/pEp/_pEp/ + # Packaging # ========= # create wheel and egg package in dist/ @@ -74,10 +77,10 @@ docs: compile-inplace # Housekeeping # ============ -clean-all: +clean-all: clean clean-docs rm -rf $(VENV_DIR) -clean: +clean: clean-makefile-build rm -rf $(BUILD_DIR) rm -rf $(DIST_DIR) rm -rf $(PYTHON_ARTIFACTS) @@ -86,3 +89,6 @@ clean: clean-docs: make clean -C docs/ + +clean-makefile-build: + $(MAKE) -C src/pEp/_pEp clean diff --git a/src/pEp/_pEp/Makefile b/src/pEp/_pEp/Makefile new file mode 100644 index 0000000..1b27df7 --- /dev/null +++ b/src/pEp/_pEp/Makefile @@ -0,0 +1,35 @@ +include Makefile.conf +TARGET=$(TARGET_PEP) + +# Specific Build settings +#CXXFLAGS+=-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -g -fwrapv -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk +CXXFLAGS+=$(shell python-config --cflags) +#INCLUDES+=$(shell python-config --includes) +INCLUDES+=-I/opt/local/include +LIB_DIRS+=-L$(shell python-config --prefix) +LIB_DIRS+=-L/opt/local/lib +LIBS+=-lboost_python3-mt -lboost_locale-mt +LDFLAGS+=$(shell python-config --ldflags) + + + +# Combine Settings +CXXFLAGS+=$(INCLUDES) +LDFLAGS+=$(LIB_DIRS) +LDFLAGS+=$(LIBS) + +SRCS:=$(wildcard *.cc) +OBJS:=$(SRCS:.cc=.o) + +.PHONY: clean + +all: $(TARGET) + +# Using implicit compile target +# And explicit link taget +$(TARGET): $(OBJS) +# $(CXX) $(LDFLAGS) -o $@ $^ + +clean: + rm -rf $(TARGET) + rm -rf $(OBJS) diff --git a/src/pEp/_pEp/Makefile.conf b/src/pEp/_pEp/Makefile.conf new file mode 100644 index 0000000..8dda7c7 --- /dev/null +++ b/src/pEp/_pEp/Makefile.conf @@ -0,0 +1,16 @@ +HERE:=$(dir $(lastword $(MAKEFILE_LIST))) +-include $(HERE)../../../local.conf + +TARGET_PEP=_pEp.so + +# General Build settings +# CXX=g++ +CXXFLAGS+=-std=c++11 -g +INCLUDES+=-I$(PREFIX)/include +# INCLUDES+=-I/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 + +LIB_DIRS=-L$(PREFIX)/lib +# LIB_DIRS+=-L/opt/local/lib +LIBS=-lpEpEngine -lpEpAdapter +# LDFLAGS+=-undefined dynamic_lookup +