# # Supported values of MX_ARCH: linux, win32 # ifndef ($(MX_ARCH)) MX_ARCH = linux endif ifndef ($(MX_INSTALL_DIR)) MX_INSTALL_DIR = /opt/mx endif #---- ifeq ($(MX_ARCH),win32) pyversion := $(shell ../../../mx/tools/mx_config python versions | cut -f1) pyinstall := $(shell ../../../mx/tools/mx_config python install_path ${pyversion}) pyinclude := $(shell ../../../mx/tools/mx_config python include ${pyversion}) pylibrary := $(shell ../../../mx/tools/mx_config python library ${pyversion}) $(info $$pyversion is [${pyversion}]) $(info $$pyinstall is [${pyinstall}]) $(info $$pyinclude is [${pyinclude}]) $(info $$pylibrary is [${pylibrary}]) PYTHON_INCLUDES := ${pyinclude} PYTHON_LIBRARY := ${pylibrary} CFLAGS += -DHAVE_SNPRINTF #---- else #MX_PYTHON = 2.7 ifndef MX_PYTHON MX_PYTHON := $(shell python -V 2>&1 | cut -f2 -d' ' | cut -c1-3) endif PYTHON_INCLUDES = /usr/include/python$(MX_PYTHON) PYTHON_LINK = $(shell python$(MX_PYTHON)-config --ldflags) endif #-------------------------------------------------------------------------- all: mp_test.mxo include ../../../mx/libMx/Makehead.$(MX_ARCH) CFLAGS += -I../../../mx/libMx -D__MX_LIBRARY__ -I$(PYTHON_INCLUDES) PYTHON_OBJS = mp_test.$(OBJ) e_mp_test.$(OBJ) #-------------------------------------------------------------------------- ifeq ($(MX_ARCH),win32) mp_test.mxo: $(PYTHON_OBJS) link /dll /debug /nologo /out:mp_test.mxo /nodefaultlib:libc \ $(PYTHON_OBJS) $(PYTHON_LIBRARY) \ ..\\..\\..\\mx\\libMx\\$(MX_LIBRARY_NAME) # For VC2005 or later, embed the manifest in the module. if test -f mp_test.mxo.manifest; then \ $(MSMANIFEST_TOOL) -nologo -outputresource:mp_test.mxo\;2 \ -manifest mp_test.mxo.manifest ; \ rm -f mp_test.mxo.manifest; \ fi endif #-------------------------------------------------------------------------- ifeq ($(MX_ARCH),linux) mp_test.mxo: $(PYTHON_OBJS) $(CC) -shared -rdynamic -Wl,-soname,mp_test.mxo \ -o mp_test.mxo $(PYTHON_OBJS) $(PYTHON_LINK) \ ../../../mx/libMx/libMx.so endif #-------------------------------------------------------------------------- ifeq ($(MX_ARCH),linux-clang) mp_test.mxo: $(PYTHON_OBJS) $(CC) -shared -rdynamic -Wl,-soname,mp_test.mxo \ -o mp_test.mxo $(PYTHON_OBJS) $(PYTHON_LINK) \ ../../../mx/libMx/libMx.so endif #-------------------------------------------------------------------------- mp_test.$(OBJ): mp_test.c e_mp_test.h $(COMPILE) $(CFLAGS) mp_test.c e_mp_test.$(OBJ): e_mp_test.c e_mp_test.h $(COMPILE) $(CFLAGS) e_mp_test.c install: mp_test.mxo -mkdir $(MX_INSTALL_DIR)/lib/modules cp mp_test.mxo $(MX_INSTALL_DIR)/lib/modules clean: -$(RM) *.mxo *.o *.obj *.exp *.ilk *.lib *.pdb *.manifest distclean: clean depend: