diff options
| author | Gus Smith <gus@normalcomputing.ai> | 2026-05-29 10:01:23 -0700 |
|---|---|---|
| committer | Gus Smith <gus@normalcomputing.ai> | 2026-05-29 10:01:23 -0700 |
| commit | 499d389779f7881054ecd691db7ebea49eb5a492 (patch) | |
| tree | 4315be9b31cb3f6c6761ef670e8181fa722ee439 | |
| parent | 8c0c60187088b6841be7b1dbaf335eea2bd46468 (diff) | |
| download | dram-bender-499d389779f7881054ecd691db7ebea49eb5a492.tar.gz | |
Improve makefile portability
| -rw-r--r-- | sources/api/pySoftMC/Makefile | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sources/api/pySoftMC/Makefile b/sources/api/pySoftMC/Makefile index 0c1d241..b03b1a9 100644 --- a/sources/api/pySoftMC/Makefile +++ b/sources/api/pySoftMC/Makefile @@ -1,21 +1,19 @@ -# https://stackoverflow.com/questions/4933285/how-to-determine-python-version-in-makefile -python_version_full := $(wordlist 2,4,$(subst ., ,$(shell python3 --version 2>&1))) -python_version := $(word 1,${python_version_full}).$(word 2,${python_version_full}) - program_NAME := pySoftMC program_CXX_SRCS := $(wildcard ../*.c) $(wildcard ../*.cpp) ./pySoftMC.cpp program_CXX_OBJS := ${program_CXX_SRCS:.cpp=.o} program_CXX_OBJS := ${program_CXX_OBJS:.c=.o} program_OBJS := $(program_CXX_OBJS) -program_INCLUDE_DIRS := . .. /usr/include/python${python_version} ../ext/pybind11/include +python_INCLUDE_FLAGS := $(shell python3-config --includes) +program_INCLUDE_DIRS := . .. ../ext/pybind11/include program_LIBRARY_DIRS := -program_LIBRARIES := python${python_version} +program_LIBRARIES := CPPFLAGS += -g -std=c++14 -pthread -O3 -fPIC -Wall -CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) -DPYSMC +CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) $(python_INCLUDE_FLAGS) -DPYSMC LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir)) LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library)) +LDFLAGS += $(shell python3-config --ldflags --embed 2>/dev/null || python3-config --ldflags) SHARED_LIB_FLAGS := -shared -fPIC |
