1 # ---------------------------------------------------------------
 
   5 # This file can be used to build various Tcl extensions with SWIG.
 
   6 # By default this file is set up for dynamic loading, but it can
 
   7 # be easily customized for static extensions by modifying various
 
   8 # portions of the file.  
 
  10 #        SRCS       = C source files
 
  11 #        CXXSRCS    = C++ source files
 
  12 #        OBJCSRCS   = Objective-C source files
 
  13 #        OBJS       = Additional .o files (compiled previously)
 
  14 #        INTERFACE  = SWIG interface file
 
  15 #        TARGET     = Name of target module or executable
 
  17 # Many portions of this file were created by the SWIG configure
 
  18 # script and should already reflect your machine. However, you
 
  19 # may need to modify the Makefile to reflect your specific
 
  21 #----------------------------------------------------------------
 
  28 WRAPFILE      = $(INTERFACE:.i=_wrap.c)
 
  29 WRAPOBJ       = $(INTERFACE:.i=_wrap.o)
 
  30 TARGET        = module@SO@ # Use this kind of target for dynamic loading
 
  31 #TARGET        = my_tclsh  # Use this target for static linking
 
  34 exec_prefix   = @exec_prefix@
 
  38 OBJC          = @CC@ -Wno-import # -Wno-import needed for gcc 
 
  44 #     SWIG      = location of the SWIG executable
 
  45 #     SWIGOPT   = SWIG compiler options
 
  46 #     SWIGCC    = Compiler used to compile the wrapper file
 
  48 SWIG          = $(exec_prefix)/bin/swig 
 
  49 SWIGOPT       = -tcl # use -tcl8 for Tcl 8.0
 
  52 # SWIG Library files.  Uncomment one of these for rebuilding tclsh or wish
 
  56 # Rules for creating .o files from source.
 
  59 CXXOBJS       = $(CXXSRCS:.cxx=.o)
 
  60 OBJCOBJS      = $(OBJCSRCS:.m=.o)
 
  61 ALLOBJS       = $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(OBJS)
 
  63 # Command that will be used to build the final extension.
 
  66 # Uncomment the following if you are using dynamic loading
 
  70 # Uncomment the following if you are using dynamic loading with C++ and
 
  71 # need to provide additional link libraries (this is not always required).
 
  73 #DLL_LIBS      = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
 
  74              -L/usr/local/lib -lg++ -lstdc++ -lgcc
 
  76 # X11 installation (needed to rebuild Tk extensions)
 
  79 XINCLUDE      = @XINCLUDES@
 
  81 # Tcl installation (where is Tcl/Tk located)
 
  83 TCL_INCLUDE   = @TCLINCLUDE@
 
  86 # Build libraries (needed for static builds)
 
  90 SYSLIBS       = $(LIBM) $(LIBC) @LIBS@
 
  92 # Build options (uncomment only one these)
 
  94 BUILD_LIBS    = $(LIBS) # Dynamic loading
 
  95 #BUILD_LIBS    = $(TCL_LIB) -ltcl $(LIBS) $(SYSLIBS) # tclsh  
 
  96 #BUILD_LIBS    = $(TCL_LIB) -ltk -ltcl $(XLIB) $(LIBS) $(SYSLIBS) # wish
 
  98 # Compilation rules for non-SWIG components
 
 100 .SUFFIXES: .c .cxx .m
 
 103         $(CC) $(CCSHARED) $(CFLAGS) $(INCLUDE) -c $<
 
 106         $(CXX) $(CCSHARED) $(CXXFLAGS) $(INCLUDE) -c $<
 
 109         $(OBJC) $(CCSHARED) $(CFLAGS) $(INCLUDE) -c $<
 
 112 # ----------------------------------------------------------------------
 
 113 # Rules for building the extension
 
 114 # ----------------------------------------------------------------------
 
 118 # Convert the wrapper file into an object file
 
 120 $(WRAPOBJ) : $(WRAPFILE)
 
 121         $(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDE) $(TCL_INCLUDE) 
 
 123 $(WRAPFILE) : $(INTERFACE)
 
 124         $(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
 
 126 $(TARGET): $(WRAPOBJ) $(ALLOBJS)
 
 127         $(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)
 
 130         rm -f $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(WRAPOBJ) $(WRAPFILE) $(TARGET)