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