1# --------------------------------------------------------------- 2# SWIG Perl5 Makefile 3# 4# This file can be used to build various Perl5 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. 18#---------------------------------------------------------------- 19 20SRCS = 21CXXSRCS = 22OBJCSRCS = 23OBJS = 24INTERFACE = 25WRAPFILE = $(INTERFACE:.i=_wrap.c) 26WRAPOBJ = $(INTERFACE:.i=_wrap.o) 27TARGET = module@SO@ # Use this kind of target for dynamic loading 28#TARGET = myperl # Use this target for static linking 29 30prefix = @prefix@ 31exec_prefix = @exec_prefix@ 32 33CC = @CC@ 34CXX = @CXX@ 35OBJC = @CC@ -Wno-import # -Wno-import needed for gcc 36CFLAGS = 37INCLUDES = 38LIBS = 39 40# SWIG Options 41# SWIG = location of the SWIG executable 42# SWIGOPT = SWIG compiler options 43# SWIGCC = Compiler used to compile the wrapper file 44 45SWIG = $(exec_prefix)/bin/swig 46SWIGOPT = -perl5 47SWIGCC = $(CC) 48 49# SWIG Library files. Uncomment this to staticly rebuild Perl 50#SWIGLIB = -static -lperlmain.i 51 52# Rules for creating .o files from source. 53 54COBJS = $(SRCS:.c=.o) 55CXXOBJS = $(CXXSRCS:.cxx=.o) 56OBJCOBJS = $(OBJCSRCS:.m=.o) 57ALLOBJS = $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(OBJS) 58 59# Command that will be used to build the final extension. 60BUILD = $(SWIGCC) 61 62# Uncomment the following if you are using dynamic loading 63CCSHARED = @CCSHARED@ 64BUILD = @LDSHARED@ 65 66# Uncomment the following if you are using dynamic loading with C++ and 67# need to provide additional link libraries (this is not always required). 68 69#DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \ 70 -L/usr/local/lib -lg++ -lstdc++ -lgcc 71 72# X11 installation (possibly needed if using Perl-Tk) 73 74XLIB = @XLIBSW@ 75XINCLUDE = @XINCLUDES@ 76 77# Perl installation 78 79PERL_INCLUDE = -I@PERL5EXT@ 80PERL_LIB = -L@PERL5EXT@ -lperl 81PERL_FLAGS = -Dbool=char -Dexplicit= 82 83# Tcl installation. If using Tk you might need this 84 85TCL_INCLUDE = @TCLINCLUDE@ 86TCL_LIB = @TCLLIB@ 87 88# Build libraries (needed for static builds) 89 90LIBM = @LIBM@ 91LIBC = @LIBC@ 92SYSLIBS = $(LIBM) $(LIBC) @LIBS@ 93 94# Build options (uncomment only one these) 95 96#TK_LIB = $(TCL_LIB) -ltcl -ltk $(XLIB) 97BUILD_LIBS = $(LIBS) # Dynamic loading 98#BUILD_LIBS = $(PERL_LIB) $(TK_LIB) $(LIBS) $(SYSLIBS) # Static linking 99 100# Compilation rules for non-SWIG components 101 102.SUFFIXES: .c .cxx .m 103 104.c.o: 105 $(CC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $< 106 107.cxx.o: 108 $(CXX) $(CCSHARED) $(CXXFLAGS) $(INCLUDES) -c $< 109 110.m.o: 111 $(OBJC) $(CCSHARED) $(CFLAGS) $(INCLUDES) -c $< 112 113 114# ---------------------------------------------------------------------- 115# Rules for building the extension 116# ---------------------------------------------------------------------- 117 118all: $(TARGET) 119 120# Convert the wrapper file into an object file 121 122$(WRAPOBJ) : $(WRAPFILE) 123 $(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(INCLUDES) $(PERL_INCLUDE) $(PERL_FLAGS) $(WRAPFILE) 124 125$(WRAPFILE) : $(INTERFACE) 126 $(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE) 127 128$(TARGET): $(WRAPOBJ) $(ALLOBJS) 129 $(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET) 130 131clean: 132 rm -f $(COBJS) $(CXXOBJS) $(OBJCOBJS) $(WRAPOBJ) $(WRAPFILE) $(TARGET) 133 134 135 136 137 138 139