From 688fff566700b0e56458aa210636b511eb0dff5f Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 4 Dec 2020 01:39:28 +0100 Subject: [PATCH] Add Makefile based build for _pEp native module --- Makefile | 6 ++++++ src/pEp/_pEp/Makefile | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/pEp/_pEp/Makefile diff --git a/Makefile b/Makefile index 494ad53..9e10092 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ compile: compile-inplace: python3 setup.py build_ext $(DEBUG_OPT) $(PREFIX_OPT) --inplace +make-compile: + $(MAKE) -C src/pEp/_pEp + # Packaging # ========= # create wheel and egg package in dist/ @@ -88,3 +91,6 @@ clean: clean-docs clean-docs: make clean -C docs/ + +make-clean: + $(MAKE) -C src/pEp/_pEp clean diff --git a/src/pEp/_pEp/Makefile b/src/pEp/_pEp/Makefile new file mode 100644 index 0000000..e26e970 --- /dev/null +++ b/src/pEp/_pEp/Makefile @@ -0,0 +1,33 @@ +TARGET=_pEp.so +CXX=g++ + +# Include dirs +INCLUDES=-I/Users/heck/local-default/include +INCLUDES+=-I/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 + +# Libs +LIB_DIRS=-L/opt/local/lib -L/Users/heck/local-default/lib +LIBS=-lpEpEngine -lpEpAdapter -lboost_python38-mt -lboost_locale-mt + +# Compile +CXXFLAGS+=-std=c++11 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk +CXXFLAGS+=$(INCLUDES) + +# Link +LDFLAGS+= -undefined dynamic_lookup +LDFLAGS+=$(LIB_DIRS) +LDFLAGS+=$(LIBS) + +SRCS := $(wildcard *.cc) +OBJS := $(SRCS:.cc=.o) + +.PHONY: clean + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CXX) $(LDFLAGS) -o $@ $^ + +clean: + rm -rf $(TARGET) + rm -rf $(OBJS)