1 # ---------------------------------------------------------------
4 # This file can be used to build various Tcl 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.
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
16 # Many portions of this file were created by the SWIG configure
17 # script and should already reflect your machine. However, you
18 # may need to modify the Makefile to reflect your specific
20 #----------------------------------------------------------------
27 WRAPFILE = $(INTERFACE:.i=_wrap.c)
28 WRAPOBJ = $(INTERFACE:.i=_wrap.o)
29 TARGET = module@SO@ # Use this kind of target for dynamic loading
30 #TARGET = my_tclsh # Use this target for static linking
33 exec_prefix = @exec_prefix@
37 OBJC = @CC@ -Wno-import # -Wno-import needed for gcc
43 # SWIG = location of the SWIG executable
44 # SWIGOPT = SWIG compiler options
45 # SWIGCC = Compiler used to compile the wrapper file
47 SWIG = $(exec_prefix)/bin/swig
48 SWIGOPT = -tcl # use -tcl8 for Tcl 8.0
51 # SWIG Library files. Uncomment one of these for rebuilding tclsh or wish
55 # Rules for creating .o files from source.
58 CXXOBJS = $(CXXSRCS:.cxx=.o)
59 OBJCOBJS = $(OBJCSRCS:.m=.o)
60 ALLOBJS = $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(OBJS)
62 # Command that will be used to build the final extension.
65 # Uncomment the following if you are using dynamic loading
69 # Uncomment the following if you are using dynamic loading with C++ and
70 # need to provide additional link libraries (this is not always required).
72 #DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
73 -L/usr/local/lib -lg++ -lstdc++ -lgcc
75 # X11 installation (needed to rebuild Tk extensions)
78 XINCLUDE = @XINCLUDES@
80 # Tcl installation (where is Tcl/Tk located)
82 TCL_INCLUDE = @TCLINCLUDE@
85 # Build libraries (needed for static builds)
89 SYSLIBS = $(LIBM) $(LIBC) @LIBS@
91 # Build options (uncomment only one these)
93 BUILD_LIBS = $(LIBS) # Dynamic loading
94 #BUILD_LIBS = $(TCL_LIB) -ltcl $(LIBS) $(SYSLIBS) # tclsh
95 #BUILD_LIBS = $(TCL_LIB) -ltk -ltcl $(XLIB) $(LIBS) $(SYSLIBS) # wish
97 # Compilation rules for non-SWIG components
102 $(CC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $<
105 $(CXX) $(CCSHARED) $(CXXFLAGS) $(INCLUDES) -c $<
108 $(OBJC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $<
111 # ----------------------------------------------------------------------
112 # Rules for building the extension
113 # ----------------------------------------------------------------------
117 # Convert the wrapper file into an object file
119 $(WRAPOBJ) : $(WRAPFILE)
120 $(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDES) $(TCL_INCLUDE)
122 $(WRAPFILE) : $(INTERFACE)
123 $(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
125 $(TARGET): $(WRAPOBJ) $(ALLOBJS)
126 $(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)
129 rm -f $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(WRAPOBJ) $(WRAPFILE) $(TARGET)