#	Copyright (c) 1998 Canon Research Centre Europe (CRE).
#
#	You may redistribute and modify this module, provided you duplicate
#	all of the original copyright notices and associated disclaimers.
#	If you have modified the module in any way, you must document the
#	changes, and include a reference to the original distribution.
# 
#	THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
#	WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
#	OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 
#
# Makefile for gdbm interface
# To use it, import Gdbm.hs, and link with Gdbm.o and StdDIS.o
# Can make a profiling version as well.

#GC=/path/to/green-card
GC=../../src/green-card
GCDIR=../../lib/$(FOR_SYSTEM)

# If in a non-standard-place
#GDBMDIR=/usr/gdbm-1.7.3/

PROF=
# PROF=-prof
GHCOPTS=-c -fvia-C -fglasgow-exts -fno-prune-tydecls $(PROF)
GHCOPTS+=-i$(GCDIR) -I$(GDBMDIR)

LD_OPTS=-L$(GDBMDIR) -L$(GCDIR)

all: Gdbm.o

test: Main

clean: rm -f Main *.o *.hi Gdbm.hs

Gdbm.o: Gdbm.hs
	$(HC) $(GHCOPTS) Gdbm.hs

Gdbm.hs: Gdbm.gc
	$(GC) --target ghc --include-dir $(GCDIR) Gdbm.gc

#StdDIS.o: StdDIS.hs
#	$(HC) $(GHCOPTS) StdDIS.hs

#StdDIS.hs: StdDIS.gc
#	$(GC) --target ghc StdDIS.gc

Main.o: Main.hs
	$(HC) $(GHCOPTS) Main.hs

Main: Main.o Gdbm.o
	$(HC) $(HCOPTS) -o Main Main.o Gdbm.o $(LD_OPTS) -lgdbm -lgreencard

