/trunk/Lib/python/Makefile.in
Autoconf | 135 lines | 53 code | 39 blank | 43 comment | 0 complexity | 40cff0cdca689e4d22569b73ea5fbba2 MD5 | raw file
1# --------------------------------------------------------------- 2# SWIG Python Makefile 3# 4# This file can be used to build various Python extensions with SWIG. 5# By default this file is set up for dynamic loading, but it can 6# be easily customized for static extensions by modifying various 7# portions of the file. 8# 9# SRCS = C source files 10# CXXSRCS = C++ source files 11# OBJCSRCS = Objective-C source files 12# OBJS = Additional .o files (compiled previously) 13# INTERFACE = SWIG interface file 14# TARGET = Name of target module or executable 15# 16# Many portions of this file were created by the SWIG configure 17# script and should already reflect your machine. 18#---------------------------------------------------------------- 19 20SRCS = 21CXXSRCS = 22OBJCSRCS = 23OBJS = 24INTERFACE = 25WRAPFILE = $(INTERFACE:.i=_wrap.c) 26WRAPOBJ = $(INTERFACE:.i=_wrap.o) 27TARGET = module@SO@ # Use this kind of target for dynamic loading 28#TARGET = mypython # Use this target for static linking 29 30prefix = @prefix@ 31exec_prefix = @exec_prefix@ 32 33CC = @CC@ 34CXX = @CXX@ 35OBJC = @CC@ -Wno-import # -Wno-import needed for gcc 36CFLAGS = 37INCLUDES = 38LIBS = 39 40# SWIG Options 41# SWIG = location of the SWIG executable 42# SWIGOPT = SWIG compiler options 43# SWIGCC = Compiler used to compile the wrapper file 44 45SWIG = $(exec_prefix)/bin/swig 46SWIGOPT = -python 47SWIGCC = $(CC) 48 49# SWIG Library files. Uncomment if rebuilding the Python interpreter 50#SWIGLIB = -lembed.i 51 52# Rules for creating .o files from source. 53 54COBJS = $(SRCS:.c=.o) 55CXXOBJS = $(CXXSRCS:.cxx=.o) 56OBJCOBJS = $(OBJCSRCS:.m=.o) 57ALLOBJS = $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(OBJS) 58 59# Command that will be used to build the final extension. 60BUILD = $(SWIGCC) 61 62# Uncomment the following if you are using dynamic loading 63CCSHARED = @CCSHARED@ 64BUILD = @LDSHARED@ 65 66# Uncomment the following if you are using dynamic loading with C++ and 67# need to provide additional link libraries (this is not always required). 68 69#DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \ 70 -L/usr/local/lib -lg++ -lstdc++ -lgcc 71 72# X11 installation (needed if rebuilding Python + tkinter) 73 74XLIB = @XLIBSW@ 75XINCLUDE = @XINCLUDES@ 76 77# Python installation 78 79PY_INCLUDE = -DHAVE_CONFIG_H @PYINCLUDE@ 80PY_LIB = @PYLIB@ 81 82# Tcl installation. Needed if rebuilding Python with tkinter. 83 84TCL_INCLUDE = @TCLINCLUDE@ 85TCL_LIB = @TCLLIB@ 86 87# Build libraries (needed for static builds) 88 89LIBM = @LIBM@ 90LIBC = @LIBC@ 91SYSLIBS = $(LIBM) $(LIBC) @LIBS@ 92 93# Build options (uncomment only one these) 94 95#TKINTER = $(TCL_LIB) -ltk -ltcl $(XLIB) 96BUILD_LIBS = $(LIBS) # Dynamic loading 97#BUILD_LIBS = $(PY_LIB) @PYLINK@ $(TKINTER) $(LIBS) $(SYSLIBS) 98 99# Compilation rules for non-SWIG components 100 101.SUFFIXES: .c .cxx .m 102 103.c.o: 104 $(CC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $< 105 106.cxx.o: 107 $(CXX) $(CCSHARED) $(CXXFLAGS) $(INCLUDES) -c $< 108 109.m.o: 110 $(OBJC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $< 111 112 113# ---------------------------------------------------------------------- 114# Rules for building the extension 115# ---------------------------------------------------------------------- 116 117all: $(TARGET) 118 119# Convert the wrapper file into an object file 120 121$(WRAPOBJ) : $(WRAPFILE) 122 $(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDES) $(PY_INCLUDE) 123 124$(WRAPFILE) : $(INTERFACE) 125 $(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE) 126 127$(TARGET): $(WRAPOBJ) $(ALLOBJS) 128 $(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET) 129 130clean: 131 rm -f $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(WRAPOBJ) $(WRAPFILE) $(TARGET) 132 133 134 135