# # Name: Makehead.bsd-clang # # Purpose: This file is used to customize operating system and installation # dependent features of the Mp makefiles. This version is # customized for FreeBSD using Clang. # # WARNING: On FreeBSD, the Python numpy package is compiled using GCC rather # than Clang. Apparently this can matter in some cases, so you may # want to build MX using the 'bsd' target instead if you are planning # to use Numpy. But this may not always be necessary. #MX_PYTHON = 2.7 ifndef MX_PYTHON MX_PYTHON = $(shell python3 -V 2>&1 | cut -f2 -d' ' | cut -c1-3) endif $(info Python is [${MX_PYTHON}]) #--- _bsd_version = $(shell uname -s) $(info _bsd_version is [${_bsd_version}]) ifneq ($(_bsd_version),FreeBSD) $(info The 'bsd-clang' build target is currently only available for FreeBSD.) $(info For other BSD versions, please try the 'bsd' build target instead.) $(error Aborting ...) endif # FreeBSD ifeq ($(_bsd_version),FreeBSD) PYTHON_INCLUDES = -I/usr/local/include/python$(MX_PYTHON) PYTHON_LINK = $(shell python$(MX_PYTHON)-config --ldflags) PYTHON_MAJOR = $(shell echo $(MX_PYTHON) | cut -f1 -d'.') endif $(info PYTHON_MAJOR is [${PYTHON_MAJOR}]) # # The following optional modules import external Python modules that may not # be available at all sites and for all operating systems. Comment out any # that will not build at your site. # # MpNum.py - Requires the 'numpy' module. OPTIONAL_MODULES += MpNum.pyc #=== _pycache_exists = $(shell ../../mx/scripts/directory_exists __pycache__) $(info _pycache_exists is [$[_pycache_exists}]) # #========================================================================= # # Generally, you should not have to modify anything after this point. # ifeq ($(PYTHON_MAJOR),2) ifeq ($(MP_DEBUG),true) PYTHON = python-dbg else PYTHON = python endif else ifeq ($(MP_DEBUG),true) PYTHON = python$(PYTHON_MAJOR)-dbg else PYTHON = python$(PYTHON_MAJOR) endif endif $(info PYTHON is [${PYTHON}]) #=== PYTHON_BIN = $(shell which ${PYTHON}) $(info PYTHON_BIN is [${PYTHON_BIN}]) MP_BUILD_PYC = $(PYTHON) MpBuildPyc.pyx CFLAGS = -g -O -fPIC $(GCCFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) \ -DOS_BSD $(EXTRA_FLAGS) -DDEBUG MAKEDEPEND = clang -MM $(CFLAGS) mp_*.c > Makefile.depend MAKEDEPEND_CLEAN = rm Makefile.depend #--------------------------------------------------------------------- LIBMP_OBJS = $(LIBMP_SRCS:.c=.o) LIBMP_NAME = libMp.so.$(MX_MAJOR_VERSION) LIBMP_STATIC_NAME = libMp.a LIBMP_DELETE = rm $(LIBMP_NAME) $(LIBMP_SONAME) libMp.so $(LIBMP_STATIC_NAME) #--- $(LIBMP_NAME): $(LIBMP_OBJS) -$(LIBMP_DELETE) clang -shared -o $(LIBMP_NAME) $(LIBMP_OBJS) ln -sf $(LIBMP_NAME) libMp.so ar rcs $(LIBMP_STATIC_NAME) $(LIBMP_OBJS) ranlib $(LIBMP_STATIC_NAME) #--------------------------------------------------------------------- MP_PYTHON_MODULES = Mp.pyc MpScan.pyc MP_MODULE_NAME = MpPrivate.so MP_MODULE_OBJS = $(MP_MODULE_SRCS:.c=.o) #--------------------------------------------------------------------- MP_MODULE_DELETE = rm $(MP_MODULE_NAME) $(MP_MODULE_NAME): $(MP_MODULE_OBJS) -$(MP_MODULE_DELETE) clang -g -shared -o $(MP_MODULE_NAME) \ $(MP_MODULE_DIRS) $(MP_MODULE_OBJS) \ $(MP_LIBRARIES) $(LIBMP_NAME) -lc # echo "#! ${PYTHON_BIN}" > mpscript.temp tail -n +2 ../mpscript/mpscript >> mpscript.temp # echo "#! ${PYTHON_BIN}" > mpenv.temp tail -n +2 ../mpscript/mpenv >> mpenv.temp #--------------------------------------------------------------------- INCLUDES = -I$(LIBMXSRC) MP_MODULE_DIRS = -L$(LIBMXSRC) $(LIB_DIRS) MP_LIBRARIES = -lMx $(LIBRARIES) #--------------------------------------------------------------------- mp_install: -mkdir $(MX_INSTALL_DIR)/bin -mkdir $(MX_INSTALL_DIR)/lib -mkdir $(MX_INSTALL_DIR)/lib/mp /usr/bin/install -c -m 644 *.py $(MX_INSTALL_DIR)/lib/mp /usr/bin/install -c -m 644 *.so $(MX_INSTALL_DIR)/lib/mp /usr/bin/install -c -m 755 ../mpscript/mpshell $(MX_INSTALL_DIR)/bin /usr/bin/install -c -m 755 mpscript.temp $(MX_INSTALL_DIR)/bin/mpscript /usr/bin/install -c -m 755 mpenv.temp $(MX_INSTALL_DIR)/bin/mpenv ifeq ($(_pycache_exists),false) -/usr/bin/install -c -m 644 *.pyc $(MX_INSTALL_DIR)/lib/mp else -mkdir $(MX_INSTALL_DIR)/lib/mp/__pycache__ -/usr/bin/install -c -m 644 __pycache__/*.pyc $(MX_INSTALL_DIR)/lib/mp/__pycache__ endif