# Makefile -- makefile for gnucash/src/g-wrap
# Copyright (C) 1998-1999 Rob Browning <rlb@cs.utexas.edu>
#                                                                  
# This program is free software; you can redistribute it and/or    
# modify it under the terms of the GNU General Public License as   
# published by the Free Software Foundation; either version 2 of   
# the License, or (at your option) any later version.              
#                                                                  
# This program is distributed in the hope that it will be useful,  
# but WITHOUT ANY WARRANTY; without even the implied warranty of   
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
# GNU General Public License for more details.                     
#                                                                  
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact:
#
# Free Software Foundation           Voice:  +1-617-542-5942
# 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
# Boston, MA  02111-1307,  USA       gnu@gnu.org

include @top_srcdir@/Makefile.init

INCLPATH = \
           -I. \
           -I@top_srcdir@/ \
           -I@top_srcdir@/src \
           -I@top_srcdir@/src/swig\
           -I@top_srcdir@/src/engine \
           -I@top_srcdir@/src/engine/guid \
           -I@top_srcdir@/src/register \
           -I@top_srcdir@/src/guile \
	   -I@top_srcdir@/src/gnome \
           -I@top_srcdir@/lib/ComboBox-1.33 \
           -I@top_srcdir@/lib/Xbae-4.6.2-linas \
           -I$(prefix)/include

CFLAGS = @CFLAGS@ @X_CFLAGS@ ${INCLPATH} ${CPPFLAGS} ${G_WRAP_COMPILE_ARGS} ${GLIB_CFLAGS}

######################################################################
# See Makefile.common for information about these variables.
COMMON_SRCS := gnc-helpers.c gnc.c
######################################################################

GWPS := gnc.gwp
WRAPPERS := $(patsubst %.gwp,%.c,${GWPS})

# This inclusion must come after the first target, and after the
# definitions of *_SRCS, etc., but before the usage of *_OBJS.
include @top_srcdir@/Makefile.common

gnome: gnome.wrap ${OBJS} ${GNOME_OBJS}

motif: motif.wrap ${OBJS} ${MOTIF_OBJS}

qt: qt.wrap ${OBJS} ${QT_OBJS}

${WRAPPERS}: ${GWPS}
	g-wrap --api c --target guile ${GWPS}

%.wrap:
	rm -f *.wrap
	g-wrap --api c --target guile ${GWPS}
	touch $@

TRASH += $(patsubst %.gwp,%.h,$(wildcard *.gwp))
TRASH += $(patsubst %.gwp,%.c,$(wildcard *.gwp))
TRASH += $(patsubst %.gwp,%.html,$(wildcard *.gwp))
TRASH += gnc-autogen.h
TRASH += gnome.wrap motif.wrap qt.wrap

.PHONY: default gnome motif qt
