1# ---------------------------------------------------------------
2# SWIG Tcl/Tk Makefile
3# 
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.  
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. However, you
18# may need to modify the Makefile to reflect your specific
19# application.
20#----------------------------------------------------------------
21
22SRCS          = 
23CXXSRCS       = 
24OBJCSRCS      = 
25OBJS          = 
26INTERFACE     = 
27WRAPFILE      = $(INTERFACE:.i=_wrap.c)
28WRAPOBJ       = $(INTERFACE:.i=_wrap.o)
29TARGET        = module@SO@ # Use this kind of target for dynamic loading
30#TARGET        = my_tclsh  # Use this target for static linking
31
32prefix        = @prefix@
33exec_prefix   = @exec_prefix@
34
35CC            = @CC@
36CXX           = @CXX@
37OBJC          = @CC@ -Wno-import # -Wno-import needed for gcc 
38CFLAGS        = 
39INCLUDES      =
40LIBS          =
41
42# SWIG Options
43#     SWIG      = location of the SWIG executable
44#     SWIGOPT   = SWIG compiler options
45#     SWIGCC    = Compiler used to compile the wrapper file
46
47SWIG          = $(exec_prefix)/bin/swig 
48SWIGOPT       = -tcl # use -tcl8 for Tcl 8.0
49SWIGCC        = $(CC) 
50
51# SWIG Library files.  Uncomment one of these for rebuilding tclsh or wish
52#SWIGLIB       = -ltclsh.i
53#SWIGLIB       = -lwish.i
54
55# Rules for creating .o files from source.
56
57COBJS         = $(SRCS:.c=.o)
58CXXOBJS       = $(CXXSRCS:.cxx=.o)
59OBJCOBJS      = $(OBJCSRCS:.m=.o)
60ALLOBJS       = $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(OBJS)
61
62# Command that will be used to build the final extension.
63BUILD         = $(SWIGCC)
64
65# Uncomment the following if you are using dynamic loading
66CCSHARED      = @CCSHARED@
67BUILD         = @LDSHARED@
68
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).
71
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
74
75# X11 installation (needed to rebuild Tk extensions)
76
77XLIB          = @XLIBSW@
78XINCLUDE      = @XINCLUDES@
79
80# Tcl installation (where is Tcl/Tk located)
81
82TCL_INCLUDE   = @TCLINCLUDE@
83TCL_LIB       = @TCLLIB@
84
85# Build libraries (needed for static builds)
86
87LIBM          = @LIBM@
88LIBC          = @LIBC@
89SYSLIBS       = $(LIBM) $(LIBC) @LIBS@
90
91# Build options (uncomment only one these)
92
93BUILD_LIBS    = $(LIBS) # Dynamic loading
94#BUILD_LIBS    = $(TCL_LIB) -ltcl $(LIBS) $(SYSLIBS) # tclsh  
95#BUILD_LIBS    = $(TCL_LIB) -ltk -ltcl $(XLIB) $(LIBS) $(SYSLIBS) # wish
96
97# Compilation rules for non-SWIG components
98
99.SUFFIXES: .c .cxx .m
100
101.c.o:
102	$(CC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $<
103
104.cxx.o:
105	$(CXX) $(CCSHARED) $(CXXFLAGS) $(INCLUDES) -c $<
106
107.m.o:
108	$(OBJC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $<
109
110
111# ----------------------------------------------------------------------
112# Rules for building the extension
113# ----------------------------------------------------------------------
114
115all: $(TARGET)
116
117# Convert the wrapper file into an object file
118
119$(WRAPOBJ) : $(WRAPFILE)
120	$(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDES) $(TCL_INCLUDE) 
121
122$(WRAPFILE) : $(INTERFACE)
123	$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
124
125$(TARGET): $(WRAPOBJ) $(ALLOBJS)
126	$(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)
127
128clean:
129	rm -f $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(WRAPOBJ) $(WRAPFILE) $(TARGET)
130
131
132
133
134