Home | History | Annotate | Download | only in ruby
      1 # File : Makefile.swig
      2 # Makefile for a SWIG module.  Use this file if you are
      3 # producing a Ruby extension for general use or distribution.
      4 #
      5 # 1.  Prepare extconf.rb.
      6 # 2.  Modify this file as appropriate.
      7 # 3.  Type 'make -f Makefile.swig' to generate wrapper code and Makefile.
      8 # 4.  Type 'make' to build your extension.
      9 # 5.  Type 'make install' to install your extension.
     10 # 
     11 
     12 MODULE    = yourmodule
     13 FEATURE   = $(MODULE)
     14 INTERFACE = $(MODULE).i
     15 RUBY      = ruby
     16 SWIG      = swig
     17 
     18 # for C extension
     19 SWIGOPT   = -ruby
     20 WRAPPER   = $(MODULE)_wrap.c
     21 
     22 ## for C++ extension
     23 #SWIGOPT   = -ruby -c++
     24 #WRAPPER   = $(MODULE)_wrap.cc
     25 
     26 
     27 swigall: $(WRAPPER) Makefile
     28 
     29 $(WRAPPER): $(INTERFACE)
     30 	$(SWIG) $(SWIGOPT) -o $@ $(INTERFACE)
     31 
     32 Makefile: extconf.rb
     33 	$(RUBY) extconf.rb
     34 	@if [ -f Makefile ] ; then\
     35 		echo "include Makefile.swig" >> Makefile;\
     36 	fi
     37 
     38 swigclean:
     39 	@if [ -f Makefile ] ; then\
     40 		make -f Makefile clean;\
     41 	fi
     42 	rm -f Makefile $(WRAPPER)
     43