#  Makefile for a GTK+-Binding for Haskell: Examples
#
#  Author : Manuel M. T. Chakravarty
#  Created: 16 January 1999
#
#  Version $Revision: 1.3 $ from $Date: 1999/10/04 14:54:20 $
#
#  Copyright (c) 1999 Manuel M. T. Chakravarty
#
#  This file 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 file 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.
#
#  = DOCU =====================================================================
#

#  ***************************************
#  !!! This makefile requires GNU make !!!
#  ***************************************

# slurp in the autoconf definitions
#
include ../mk/config.mk ../mk/common.mk

HCFLAGS   = -fglasgow-exts -i../glib:../gdk:../gtk -L../glib -L../gdk -L../gtk\
            -lgtkHS -lgdkHS -lglibHS $(LDFLAGS)
GTKHSLIBS = ../gtk/libgtkHS.a ../gdk/libgdkHS.a ../glib/libglibHS.a 

default:
	@echo "Targets: hello, hello2, hello3, hello4, hello5, "
	@echo "  butest, drawtest, etytest, fseltest, lbltest, idletest"
	@echo "  rngtest, tabtest, and threadtest"
	@echo "The target \`all' makes them all."

all: hello hello2 hello3 hello4 hello5 butest drawtest etytest fseltest\
     lbltest idletest rngtest tabtest threadtest

.phony: libglibHS.a libgdkHS.a libgtkHS.a
libglibHS.a:
	$(MAKE) -C ../glib $@
libgdkHS.a:
	$(MAKE) -C ../gdk $@
libgtkHS.a:
	$(MAKE) -C ../gtk $@

# the `Hello World!' series
#

hello: GtkHelloWorld.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

hello2: GtkHelloWorld2.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

hello3: GtkHelloWorld3.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

hello4: GtkHelloWorld4.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

hello5: GtkHelloWorld5.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

# some simple tests
#

butest: ButtonTest.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

drawtest: DrawTest.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

etytest: EntryTest.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

fseltest: FileSel.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

idletest: IdleTest.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

lbltest: LabelTest.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

rngtest: RangeTest.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

tabtest: TableTest.hs $(GTKHSLIBS)
	$(HC) -o $@ $(HCFLAGS) $<

threadtest: ThreadTest.hs $(GTKHSLIBS)
	$(HC) -syslib concurrent -o $@ $(HCFLAGS) $<


# auxilliary targets
#
.PHONY: clean spotless
clean:
	-$(RM) *.o hello hello?\
	       butest etytest fseltest rngtest tabtest threadtest

spotless: clean
