aboutsummaryrefslogtreecommitdiff
path: root/Lib/python/Makefile.in
blob: eb18214d08b1438975bc4ba0590729af5591d88d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# ---------------------------------------------------------------
# $Header$
# SWIG Python Makefile
# 
# This file can be used to build various Python extensions with SWIG.
# By default this file is set up for dynamic loading, but it can
# be easily customized for static extensions by modifying various
# portions of the file.
#
#        SRCS       = C source files
#        CXXSRCS    = C++ source files
#        OBJCSRCS   = Objective-C source files
#        OBJS       = Additional .o files (compiled previously)
#        INTERFACE  = SWIG interface file
#        TARGET     = Name of target module or executable
#
# Many portions of this file were created by the SWIG configure
# script and should already reflect your machine.
#----------------------------------------------------------------

SRCS          = 
CXXSRCS       = 
OBJCSRCS      = 
OBJS          = 
INTERFACE     = 
WRAPFILE      = $(INTERFACE:.i=_wrap.c)
WRAPOBJ       = $(INTERFACE:.i=_wrap.o)
TARGET        = module@SO@ # Use this kind of target for dynamic loading
#TARGET        = mypython  # Use this target for static linking

prefix        = @prefix@
exec_prefix   = @exec_prefix@

CC            = @CC@
CXX           = @CXX@
OBJC          = @CC@ -Wno-import # -Wno-import needed for gcc 
CFLAGS        = 
INCLUDES      =
LIBS          =

# SWIG Options
#     SWIG      = location of the SWIG executable
#     SWIGOPT   = SWIG compiler options
#     SWIGCC    = Compiler used to compile the wrapper file

SWIG          = $(exec_prefix)/bin/swig 
SWIGOPT       = -python 
SWIGCC        = $(CC) 

# SWIG Library files.  Uncomment if rebuilding the Python interpreter
#SWIGLIB       = -lembed.i

# Rules for creating .o files from source.

COBJS         = $(SRCS:.c=.o)
CXXOBJS       = $(CXXSRCS:.cxx=.o)
OBJCOBJS      = $(OBJCSRCS:.m=.o)
ALLOBJS       = $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(OBJS)

# Command that will be used to build the final extension.
BUILD         = $(SWIGCC)

# Uncomment the following if you are using dynamic loading
CCSHARED      = @CCSHARED@
BUILD         = @LDSHARED@

# Uncomment the following if you are using dynamic loading with C++ and
# need to provide additional link libraries (this is not always required).

#DLL_LIBS      = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
             -L/usr/local/lib -lg++ -lstdc++ -lgcc

# X11 installation (needed if rebuilding Python + tkinter)

XLIB          = @XLIBSW@
XINCLUDE      = @XINCLUDES@

# Python installation

PY_INCLUDE    = -DHAVE_CONFIG_H @PYINCLUDE@ 
PY_LIB        = @PYLIB@

# Tcl installation.  Needed if rebuilding Python with tkinter.

TCL_INCLUDE   = @TCLINCLUDE@
TCL_LIB       = @TCLLIB@

# Build libraries (needed for static builds)

LIBM          = @LIBM@
LIBC          = @LIBC@
SYSLIBS       = $(LIBM) $(LIBC) @LIBS@

# Build options (uncomment only one these)

#TKINTER      = $(TCL_LIB) -ltk -ltcl $(XLIB)
BUILD_LIBS    = $(LIBS) # Dynamic loading
#BUILD_LIBS    = $(PY_LIB) @PYLINK@ $(TKINTER) $(LIBS) $(SYSLIBS)

# Compilation rules for non-SWIG components

.SUFFIXES: .c .cxx .m

.c.o:
	$(CC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $<

.cxx.o:
	$(CXX) $(CCSHARED) $(CXXFLAGS) $(INCLUDES) -c $<

.m.o:
	$(OBJC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $<


# ----------------------------------------------------------------------
# Rules for building the extension
# ----------------------------------------------------------------------

all: $(TARGET)

# Convert the wrapper file into an object file

$(WRAPOBJ) : $(WRAPFILE)
	$(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDES) $(PY_INCLUDE) 

$(WRAPFILE) : $(INTERFACE)
	$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)

$(TARGET): $(WRAPOBJ) $(ALLOBJS)
	$(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)

clean:
	rm -f $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(WRAPOBJ) $(WRAPFILE) $(TARGET)