#######################################################################
# $Header$
# Simplified Wrapper and Interface Generator (SWIG)
#
# Makefile for version 1.1
# Dave Beazley
# January 7, 1997
#
# This makefile is now mostly constructed by ./configure.
#
# $Log$
# Revision 1.1  2002/04/29 19:56:47  RD
# Since I have made several changes to SWIG over the years to accomodate
# special cases and other things in wxPython, and since I plan on making
# several more, I've decided to put the SWIG sources in wxPython's CVS
# instead of relying on maintaining patches.  This effectivly becomes a
# fork of an obsolete version of SWIG, :-( but since SWIG 1.3 still
# doesn't have some things I rely on in 1.1, not to mention that my
# custom patches would all have to be redone, I felt that this is the
# easier road to take.
#
# Revision 1.3  1999/08/17 03:31:30  beazley
# Minor cleanup. Removed Perl4
#
# Revision 1.2  1999/02/28 02:44:43  beazley
# Initial cleanup
#
# Revision 1.1.1.1  1999/02/28 02:00:49  beazley
# Swig1.1
#
# Revision 1.1  1996/08/12 01:55:02  dmb
# Initial revision
#
#######################################################################

srcdir = @srcdir@
VPATH = @srcdir@

#
# Set the prefix below to indicate where you want SWIG to install its
# files.   Normally this is /usr/local
#

prefix     = @prefix@
exec_prefix= @exec_prefix@

# Location of the SWIG library.  Is normally put in /usr/local/lib/swig_lib
# The SWIG library contains configuration files and library modules
# so you should install it someplace where it can be easily accessed.

SWIG_LIB = $(prefix)/lib/swig_lib

# Change these prefixes to set where you would like the
# SWIG binary file (swig) and C library (libswig.a) installed.
# Usually you don't need to change these unless you are
# installing SWIG into a CPU dependent directory such as /usr/local/bin/cpu-type/bin
#

BIN_DIR        = $(exec_prefix)/bin
LIB_DIR        = $(exec_prefix)/lib

# Other installation locations.   Shouldn't need to change these unless you want

INCLUDE_DIR    = $(prefix)/include
MAN_DIR        = $(prefix)/man/man1

SHELL  = /bin/sh

# --with-PACKAGE options for configure script.
WITH=

#
#
#
# Rules for creation of a .o file from .cxx

all:		wxswig
		@echo "Compilation complete."

wxswig: 	Makefiles
		@echo "Making the SWIG Parser..."
		@cd SWIG; $(MAKE)
		@echo "Make Modules..."
		@cd Modules; $(MAKE)

Makefiles:	config.status
		@cd SWIG; echo "making Makefile in subdirectory SWIG"; $(MAKE) Makefile
		@cd Modules; echo "making Makefile in subdirectory Modules"; $(MAKE) Makefile

Makefile:	Makefile.in config.status
		CONFIG_FILES=Makefile $(SHELL) config.status

config.status:	$(srcdir)/configure
		if test -f config.status; \
		then $(SHELL) config.status --recheck; \
		     $(SHELL) config.status; \
		else $(SHELL) $(srcdir)/configure $(WITH); \
		fi

.PRECIOUS:	config.status swig

clean:
	rm -f *.o *.so libswig.a swig *~ core
	@cd SWIG; $(MAKE) clean
	@cd Modules; $(MAKE) clean
	@cd Runtime; $(MAKE) clean

nuke: 	clean
	@cd SWIG; $(MAKE) nuke
	@cd Modules; $(MAKE) nuke
	@cd Examples; $(MAKE) nuke
	@cd Tests; $(MAKE) clean
	@cd Runtime; $(MAKE) clean
	rm -f Makefile Makefile.template config.*

doc:	swig
	@echo "Building Documentation for SWIG library..."
	./swig -Iswig_lib -d ./Doc/swiglib ./swig_lib/autodoc.i
	@rm -f swig_lib/autodoc_wrap*


runtime: swig
	@cd Runtime; $(MAKE)

test::
	cd Tests; $(MAKE) parser; $(MAKE) doc; $(MAKE) huge;
	@echo "See test.log for errors"
	@echo "type 'make testclean' to cleanup."

testbuild::
	cd Tests; $(MAKE) build

testall::
	cd Tests; $(MAKE) all; $(MAKE) clean

# Only do this before releasing a distribution

testclean::
	cd Tests; $(MAKE) clean;


## # Install the SWIG program
##
## INSTALL        = ./install-sh -c
## INSTALL_DATA   = ${INSTALL} -m 644
## INSTALL_PROGRAM= ${INSTALL} -m 755
##
## install: install-main install-lib install-runtime
## 	@echo "Installation complete"
##
## install-runtime:
## 	@cd Runtime; $(MAKE) install
##
## smallinstall: install-main
##
## install-main:
## 	@for i in $(LIB_DIR) $(INCLUDE_DIR) $(BIN_DIR) $(prefix)/man $(MAN_DIR); \
## 	do \
## 	  if [ ! -d $$i ] ; then \
## 	         mkdir $$i; \
##                  echo "Making directory $$i"; \
##                  chmod 755 $$i;\
##                  else true; \
##              fi; \
##             done;
## 	@echo "Installing $(BIN_DIR)/swig"
## 	@$(INSTALL_PROGRAM) swig $(BIN_DIR)/swig
## 	@echo "Installing $(LIB_DIR)/libswig.a..."
## 	@$(INSTALL_DATA) libswig.a $(LIB_DIR)/libswig.a
## 	@echo "Installing $(INCLUDE_DIR)/swig.h..."
## 	@$(INSTALL_DATA) Include/swig.h $(INCLUDE_DIR)/swig.h
## 	@echo "Installing $(INCLUDE_DIR)/swigver.h..."
## 	@$(INSTALL_DATA) Include/swigver.h $(INCLUDE_DIR)/swigver.h
## 	@echo "Installing $(MAN_DIR)/swig.1..."
## 	@$(INSTALL_DATA) swig.1 $(MAN_DIR)/swig.1
## install-lib:
## 	@for i in $(SWIG_LIB) ; \
## 	do \
## 	  if [ ! -d $$i ] ; then \
## 	         mkdir $$i; \
##                  echo "Making directory $$i"; \
##                  chmod 755 $$i;\
##                  else true; \
##              fi; \
##             done;
## 	@echo "Installing the SWIG library"
## #	cd $(SWIG_LIB); rm -rf *
## 	@for i in $(SWIG_LIB)/tcl $(SWIG_LIB)/perl5 $(SWIG_LIB)/python $(SWIG_LIB)/guile $(SWIG_LIB)/config ; \
## 	do \
## 	  if [ ! -d $$i ] ; then \
## 	         mkdir $$i; \
##                  echo "Making directory $$i"; \
##                  chmod 755 $$i;\
##                  else true; \
##              fi; \
##             done;
## 	@cd swig_lib; for i in *.i *.swg; \
## 	    do \
## 	    echo "Installing swig_lib/$$i"; \
##             ../$(INSTALL_DATA) $$i $(SWIG_LIB)/$$i; \
## 	    done;
## 	@cd swig_lib/tcl; for i in *.i *.swg Makefile; \
## 	    do \
## 	    echo "Installing swig_lib/tcl/$$i"; \
##             ../../$(INSTALL_DATA) $$i $(SWIG_LIB)/tcl/$$i; \
## 	    done;
## 	@cd swig_lib/perl5; for i in *.i *.swg Makefile Makefile.pl; \
## 	    do \
## 	    echo "Installing swig_lib/perl5/$$i"; \
##             ../../$(INSTALL_DATA) $$i $(SWIG_LIB)/perl5/$$i; \
## 	    done;
## 	@cd swig_lib/python; for i in *.i *.swg Makefile; \
## 	    do \
## 	    echo "Installing swig_lib/python/$$i"; \
##             ../../$(INSTALL_DATA) $$i $(SWIG_LIB)/python/$$i; \
## 	    done;
## 	@cd swig_lib/guile; for i in *.i *.swg; \
## 	    do \
## 	    echo "Installing swig_lib/guile/$$i"; \
##             ../../$(INSTALL_DATA) $$i $(SWIG_LIB)/guile/$$i; \
## 	    done;
## 	@cd swig_lib/config; for i in *.swg; \
## 	    do \
## 	    echo "Installing swig_lib/config/$$i"; \
##             ../../$(INSTALL_DATA) $$i $(SWIG_LIB)/config/$$i; \
## 	    done;
## 	@echo "Installing Makefile"
## 	$(INSTALL_DATA) Makefile.template $(SWIG_LIB)/Makefile