# # Name: Makehead.linux # # Purpose: This file is used to customize operating system and installation # dependent features of the Mp makefiles. This version is # customized for Linux. # PYTHON_VERSION = 2.5 PYTHON_INCLUDES = /usr/include/python$(PYTHON_VERSION) #PYTHON_INCLUDES = /usr/local/include/python$(PYTHON_VERSION) #PYTHON_INCLUDES = /home/lavender/local/include/python$(PYTHON_VERSION) # # 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 # Turn on optimization # #OPTIMIZE = -O2 #OPTIMIZE = -O3 #CFLAGS += $(OPTIMIZE) # # DEBUGGING SUPPORT # # If you want to use the debugging version of Python called "python-dbg", # then you must set MP_DEBUG to 'true' below when you compile your # code and also use python-dbg to build the pyc files. # # If you try to run a non-debug build of Mp with the debug version of # Python, namely python-dbg, you will get an error message similar # to this: # # ImportError: /opt/mx/lib/mp/MpPrivate.so: undefined symbol: Py_InitModule4 # MP_DEBUG = false #--- MP_DEBUG_LIBRARY_PATH = /usr/lib/debug/usr/lib/libpython2.4.so.1.0 # #========================================================================= # # Generally, you should not have to modify anything after this point. # ifeq ($(MP_DEBUG),true) PYTHON = python-dbg else PYTHON = python endif ifeq ($(MP_DEBUG),true) MP_DEBUG_LIBRARY = $(MP_DEBUG_LIBRARY_PATH) endif # # The Python developers have chosen to always compile Python with the # -Wno-strict-aliasing flag set. If the MP code is compiled with # strict-aliasing turned on, then at high optimization levels we can # get GCC warnings about the mere use of Python objects like Py_True # and Py_False. This unfortunately means that we must set the # -Wno-strict-aliasing flag for MP as well. # GCCFLAGS += -Wno-strict-aliasing # CFLAGS += -g -fPIC $(GCCFLAGS) $(INCLUDES) -I$(PYTHON_INCLUDES)\ -DOS_LINUX $(EXTRA_FLAGS) -DDEBUG ifeq ($(MP_DEBUG),true) CFLAGS += -DPy_DEBUG endif # MAKEDEPEND = gcc -MM $(CFLAGS) libMp.c mp_*.c > Makefile.depend MAKEDEPEND_CLEAN = rm Makefile.depend #--------------------------------------------------------------------- LIBMP_OBJS = $(LIBMP_SRCS:.c=.$(OBJ)) LIBMP_SONAME = libMp.so.$(MX_MAJOR_VERSION) LIBMP_NAME = $(LIBMP_SONAME).$(MX_MINOR_VERSION).$(MX_UPDATE_VERSION) LIBMP_STATIC_NAME = libMp.a LIBMP_DELETE = rm $(LIBMP_NAME) $(LIBMP_SONAME) libMp.so $(LIBMP_STATIC_NAME) #--- $(LIBMP_NAME): $(LIBMP_OBJS) -$(LIBMP_DELETE) gcc -shared -Wl,-soname,$(LIBMP_SONAME) -o $(LIBMP_NAME) $(LIBMP_OBJS) ln -sf $(LIBMP_NAME) $(LIBMP_SONAME) ln -sf $(LIBMP_NAME) libMp.so ar rcs $(LIBMP_STATIC_NAME) $(LIBMP_OBJS) ranlib $(LIBMP_STATIC_NAME) #--------------------------------------------------------------------- MP_MODULE_NAME = MpPrivate.so MP_MODULE_OBJS = $(MP_MODULE_SRCS:.c=.$(OBJ)) MP_MODULE_DELETE = rm $(MP_MODULE_NAME) #--- $(MP_MODULE_NAME): $(MP_MODULE_OBJS) -$(MP_MODULE_DELETE) gcc -g -shared -o $(MP_MODULE_NAME) $(MP_DEBUG_LIBRARY) \ $(MP_MODULE_DIRS) $(MP_MODULE_OBJS) \ $(MP_LIBRARIES) -lc #--------------------------------------------------------------------- INCLUDES = -I$(LIBMXSRC) MP_MODULE_DIRS = -L$(LIBMXSRC) -L. $(LIB_DIRS) MP_LIBRARIES = -lMp -lMx $(LIBRARIES) ifeq ($(MP_DEBUG),true) MP_MODULE_DIRS += $(MP_DEBUG_LIBRARY_DIR) endif #--------------------------------------------------------------------- mp_install: -mkdir $(MX_INSTALL_DIR)/bin -mkdir $(MX_INSTALL_DIR)/lib -mkdir $(MX_INSTALL_DIR)/lib/mp install -m 644 $(LIBMP_NAME) $(MX_INSTALL_DIR)/lib ( cd $(MX_INSTALL_DIR)/lib ; ln -sf $(LIBMP_NAME) $(LIBMP_SONAME) ) ( cd $(MX_INSTALL_DIR)/lib ; ln -sf $(LIBMP_NAME) libMp.so ) install -m 644 $(LIBMP_STATIC_NAME) $(MX_INSTALL_DIR)/lib install -m 644 *.py $(MX_INSTALL_DIR)/lib/mp install -m 644 *.pyc $(MX_INSTALL_DIR)/lib/mp install -m 644 MpPrivate.so $(MX_INSTALL_DIR)/lib/mp install -m 755 ../mpscript/mpscript $(MX_INSTALL_DIR)/bin install -m 755 ../mpscript/mpshell $(MX_INSTALL_DIR)/bin install -m 755 ../mpscript/mpenv $(MX_INSTALL_DIR)/bin