#-----------------------------------------------------------
#	 Copyright (C) 1996-1997 Kazuhiko Ohno, Masahiko Ikawa,
#	 and Computer Architecture Laboratory, Depertment of
#	 Information Science, Kyoto University.
#-----------------------------------------------------------
# ---------------------------------------------------------- 
#   (C)1993,1994 Institute for New Generation Computer Technology 
#       (Read COPYRIGHT for detailed information.) 
# ----------------------------------------------------------

PARALLEL = 0
KLIC = ../compiler/klic -P$(PARALLEL) \
	-v -K../compiler/kl1cmp -D../compiler/klicdb \
	-X. -I../include -L../runtime
KLICT = ../compiler/klic -E -P$(PARALLEL) \
	-v -K../compiler/kl1cmp-p -D../compiler/klicdb\
	-X. -I../include -L../runtime -E
KLICTP = ../compiler/klic -P$(PARALLEL) \
	-v -K../compiler/kl1cmp-p -D../compiler/klicdb\
	-X. -I../include -L../runtime -E
KLICSYS = ../compiler/klic ../compiler/kl1cmp ../compiler/klicdb \
	../include/klic/* ../runtime/libklic.a

.SUFFIXES: $(.SUFFIXES)

TESTPROGS = \
    hand_shake2 hand_shake2-sched hand_shake2-reply \
    misctest misctest-sched misctest-reply          \
    atomtest atomtest-sched atomtest-reply          \
    functest functest-sched functest-reply          \
    loop1 loop1-sched loop1-reply                   \
    loop2 loop2-sched loop2-reply

TESTSRCS = \
	hand_shake2.kl1 misctest.kl1 atomtest.kl1 functest.kl1

all:	klicdb.init libklic.db $(TESTPROGS)

klicdb.init:
	cp -p ../runtime/klic.db klicdb.init

libklic.db:
	cp -p ../runtime/libklic.db .

hand_shake2:	hand_shake2.kl1 $(KLICSYS)
	$(CLEANOBJ); $(KLIC) -o hand_shake2 hand_shake2.kl1
hand_shake2-sched:	hand_shake2.kl1
	$(CLEANOBJ); $(KLICT) -o hand_shake2-sched hand_shake2.kl1
hand_shake2-reply:	hand_shake2.kl1
	$(CLEANOBJ); $(KLICTP) -o hand_shake2-reply hand_shake2.kl1

misctest:	misctest.kl1 $(KLICSYS)
	$(CLEANOBJ); $(KLIC) -o misctest misctest.kl1
misctest-sched:	misctest.kl1
	$(CLEANOBJ); $(KLICT) -o misctest-sched misctest.kl1
misctest-reply:	misctest.kl1
	$(CLEANOBJ); $(KLICTP) -o misctest-reply misctest.kl1

atomtest:	atomtest.kl1 $(KLICSYS)
	$(CLEANOBJ); $(KLIC) -o atomtest atomtest.kl1
atomtest-sched:	atomtest.kl1
	$(CLEANOBJ); $(KLICT) -o atomtest-sched atomtest.kl1
atomtest-reply:	atomtest.kl1
	$(CLEANOBJ); $(KLICTP) -o atomtest-reply atomtest.kl1

functest:	functest.kl1 $(KLICSYS)
	$(CLEANOBJ); $(KLIC) -o functest functest.kl1
functest-sched:	functest.kl1
	$(CLEANOBJ); $(KLICT) -o functest-sched functest.kl1
functest-reply:	functest.kl1
	$(CLEANOBJ); $(KLICTP) -o functest-reply functest.kl1

loop1:	loop1.kl1 $(KLICSYS)
	$(CLEANOBJ); $(KLIC) -o loop1 loop1.kl1
loop1-sched:	loop1.kl1
	$(CLEANOBJ); $(KLICT) -o loop1-sched loop1.kl1
loop1-reply:	loop1.kl1
	$(CLEANOBJ); $(KLICTP) -o loop1-reply loop1.kl1

loop2:	loop2.kl1 $(KLICSYS)
	$(CLEANOBJ); $(KLIC) -o loop2 loop2.kl1
loop2-sched:	loop2.kl1
	$(CLEANOBJ); $(KLICT) -o loop2-sched loop2.kl1
loop2-reply:	loop2.kl1
	$(CLEANOBJ); $(KLICTP) -o loop2-reply loop2.kl1



CLEANOBJ = /bin/rm -f atom.* funct.* predicate.* *.o *.c *.ext

clean:
	/bin/rm -f *.c *.ext *.h *.o klic.db klicdb.init libklic.db \
		work* *~ core

distclean: clean
	/bin/rm -f $(TESTPROGS) log0 p-log0

realclean: distclean


