# makefile for regression tests, Time-stamp: <2006-09-29 09:52:17 feeley>

# Copyright (C) 1994-2006 by Marc Feeley, All Rights Reserved.

herefromroot = tests
rootfromhere = ..
escrootfromhere = ".."
SUBDIRS =

PACKAGE_SHORTNAME = gambc
PACKAGE_NAME = Gambit-C
PACKAGE_VERSION = 4.0b20
PACKAGE_STRING = Gambit-C 4.0b20
PACKAGE_BUGREPORT = gambit@iro.umontreal.ca
PACKAGE_TARNAME = gambc-4.0b20
PACKAGE_SUBDIR = 



srcdir = .

srcdirpfx = 

C_COMPILER = cc
C_PREPROC = cc -E
FLAGS_OBJ = -fno-common -O1
FLAGS_DYN =  -O1 -shared
FLAGS_LIB =  -shared
FLAGS_EXE = 
DEFS = -DHAVE_CONFIG_H
LIBS = 

GAMBCLIB = libgambc.a
INSTALL = $(rootfromhere)/install-sh -c
INSTALL_DATA = $(rootfromhere)/install-sh -c -m 644
INSTALL_LIB = $(rootfromhere)/install-sh -c -m 644
INSTALL_PROGRAM = $(rootfromhere)/install-sh -c -m 755

prefix = 
exec_prefix = ${prefix}
includedir = $(prefix)$(PACKAGE_SUBDIR)/include
libdir = $(prefix)$(PACKAGE_SUBDIR)/lib
bindir = $(prefix)$(PACKAGE_SUBDIR)/bin
docdir = $(prefix)$(PACKAGE_SUBDIR)/doc
infodir = $(prefix)$(PACKAGE_SUBDIR)/info
emacsdir = $(prefix)$(PACKAGE_SUBDIR)/share/emacs/site-lisp

INCLUDES = -I$(srcdirpfx)$(rootfromhere)/include -I$(srcdir)

.SUFFIXES:

DISTFILES = makefile.in \
debug.scm error.scm r4rstest.scm mix.scm mem.scm client.c server.scm server.h \
test1.ok test2.ok test3.ok test4.ok test5.ok test6.ok test7.ok \
test8.ok test9.ok input

all: all-recursive all-local

all-local:
	@if [ ! -f debug.scm ]; then \
	  cp $(srcdirpfx)debug.scm .; \
	  touch debug.rm; \
	  cp $(srcdirpfx)error.scm .; \
	  touch error.rm; \
	  cp $(srcdirpfx)r4rstest.scm .; \
	  touch r4rstest.rm; \
	  cp $(srcdirpfx)mix.scm .; \
	  touch mix.rm; \
	  cp $(srcdirpfx)mem.scm .; \
	  touch mem.rm; \
	  cp $(srcdirpfx)server.scm .; \
	  touch server.rm; \
	fi

check: all test1 test2 test3 test4 test5 test6 test7 test8 test9
	@echo "============ ALL TESTS SUCCESSFUL"
	rm -f mem.c mem_.c mem. mem.o1 mem_. mem \
	  mix.c mix_.c mix. mix_. mix \
	  server.c server_.c server. server_. client. \
	  client so_locations *.out tmp*

test1:
	@echo "------------ TEST 1 (debugging support)"
	 $(rootfromhere)/gsi/gsi -f debug.scm > test1.out
	diff $(srcdirpfx)test1.ok test1.out && rm -f test1.out

test2:
	@echo "------------ TEST 2 (error handling)"
	 $(rootfromhere)/gsi/gsi -:h4000 -f error.scm < error.scm > test2.out
	diff $(srcdirpfx)test2.ok test2.out && rm -f test2.out

test3:
	@echo "------------ TEST 3 (interpreter and library functions)"
	 $(rootfromhere)/gsi/gsi -:s -f -e '(begin (load "r4rstest.scm") (test-cont) (test-sc4) (test-delay) (exit))' > test3.out
	diff $(srcdirpfx)test3.ok test3.out && rm -f test3.out tmp*

test4:
	@echo "------------ TEST 4 (interpreter running an application)"
	rm -f mix.
	 $(rootfromhere)/gsi/gsi -f mix.scm > test4.out
	diff $(srcdirpfx)test4.ok test4.out && rm -f test4.out

test5:
	@echo "------------ TEST 5 (compiler generating C code)"
	rm -f mix.c
	 $(rootfromhere)/gsc/gsc -:=$(srcdirpfx)$(escrootfromhere) -f -c mix.scm
	diff $(srcdirpfx)test5.ok mix.c

test6:
	@echo "------------ TEST 6 (link and execute the code generated)"
	rm -f mix_.c mix. mix_. mix
	 $(rootfromhere)/gsc/gsc -:=$(srcdirpfx)$(escrootfromhere) -f -link mix.c
	$(C_COMPILER) $(INCLUDES) $(FLAGS_OBJ) -c mix.c
	$(C_COMPILER) $(INCLUDES) $(FLAGS_OBJ) -c mix_.c
	$(MAKE) link EXECUTABLE="mix" \
	  OBJECTS="mix. mix_." \
	  OBJECTS_PLUS="+mix. +mix_." \
	  OBJECTS_COMMA="mix.,mix_."
	 ./mix > test6.out
	diff $(srcdirpfx)test6.ok test6.out && \
	  rm -f test6.out mix.c mix_.c mix. mix_. mix

test7:
	@echo "------------ TEST 7 (memory management and C-interface)"
	rm -f mem.c mem_.c mem. mem_. mem
	 $(rootfromhere)/gsc/gsc -:=$(srcdirpfx)$(escrootfromhere) -f -link mem.scm
	$(C_COMPILER) $(INCLUDES) $(FLAGS_OBJ) -c mem.c
	$(C_COMPILER) $(INCLUDES) $(FLAGS_OBJ) -c mem_.c
	$(MAKE) link EXECUTABLE="mem" \
	  OBJECTS="mem. mem_." \
	  OBJECTS_PLUS="+mem. +mem_." \
	  OBJECTS_COMMA="mem.,mem_."
	 ./mem -:h4000 > test7.out
	diff $(srcdirpfx)test7.ok test7.out && \
	  rm -f test7.out mem.c mem_.c mem. mem_. mem

test8:
	@echo "------------ TEST 8 (use C-interface to implement a Scheme server)"
	rm -f server.c server_.c server. server_. \
	  client. client
	 $(rootfromhere)/gsc/gsc -:=$(srcdirpfx)$(escrootfromhere) -f -link server.scm
	$(C_COMPILER) $(INCLUDES) $(FLAGS_OBJ) -c client.c
	$(C_COMPILER) $(INCLUDES) $(FLAGS_OBJ) -D___LIBRARY -c server.c
	$(C_COMPILER) $(INCLUDES) $(FLAGS_OBJ) -D___LIBRARY -c server_.c
	$(MAKE) link EXECUTABLE="client" \
	  OBJECTS="client. server. server_." \
	  OBJECTS_PLUS="+client. +server. +server_." \
	  OBJECTS_COMMA="client.,server.,server_."
	 ./client > test8.out
	diff -w $(srcdirpfx)test8.ok test8.out && \
	  rm -f test8.out server.c server_.c server. server_. \
	    client. client

test9:
	@echo "------------ TEST 9 (dynamic compilation and loading of a module)"
	rm -f mem. mem.o*
	 $(rootfromhere)/gsc/gsc -:=$(srcdirpfx)$(escrootfromhere) -f -dynamic mem.scm
	 $(rootfromhere)/gsi/gsi -:h4000 -f mem.o1 > test9.out
	diff $(srcdirpfx)test9.ok test9.out && rm -f test9.out mem. mem.o1

link:
	$(C_COMPILER) $(FLAGS_EXE) $(OBJECTS) $(rootfromhere)/lib/$(GAMBCLIB) $(LIBS) -o $(EXECUTABLE)

install-local: all

uninstall-local:

mostlyclean-local:
	rm -f mem.c mem_.c mem. mem.o1 mem_. mem mem.exe \
	  mix.c mix_.c mix. mix_. mix mix.exe \
	  server.c server_.c server. server_. client. client \
	  client.exe gambit.h so_locations *.out tmp*

clean-local: mostlyclean-local
	test ! -f debug.rm || rm -f debug.rm debug.scm
	test ! -f error.rm || rm -f error.rm error.scm
	test ! -f r4rstest.rm || rm -f r4rstest.rm r4rstest.scm
	test ! -f mix.rm || rm -f mix.rm mix.scm
	test ! -f mem.rm || rm -f mem.rm mem.scm
	test ! -f server.rm || rm -f server.rm server.scm
	rm -f *.da *.bb *.bbg *.gcov

distclean-local: clean-local
	rm -f makefile

realclean-local: distclean-local

all-recursive install-recursive uninstall-recursive mostlyclean-recursive clean-recursive distclean-recursive realclean-recursive:
	@if test -n "$(SUBDIRS)"; then \
	  for subdir in ""$(SUBDIRS); do \
	    target=`echo $@ | sed 's/-recursive//'`; \
	    echo making $$target in $$subdir; \
	    (cd $$subdir && $(MAKE) $$target) || exit 1; \
	  done \
	fi

install: install-recursive install-local

uninstall: uninstall-recursive uninstall-local

mostlyclean: mostlyclean-recursive mostlyclean-local

clean: clean-recursive clean-local

distclean: distclean-recursive distclean-local

realclean: realclean-recursive realclean-local

dist:
	@if test -n "$(SUBDIRS)"; then \
	  for subdir in ""$(SUBDIRS); do \
	    echo making $@ in $$subdir; \
	    mkdir $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot)/$$subdir; \
	    chmod 777 $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot)/$$subdir; \
	    (cd $$subdir && $(MAKE) $(MDEFINES) $@) || exit 1; \
	  done \
	fi
	@echo "Copying distribution files"
	@for file in $(DISTFILES); do \
	  ln $(srcdirpfx)$$file $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot) 2> /dev/null \
	    || cp -p $(srcdirpfx)$$file $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot); \
	done

makefile: makefile.in $(rootfromhere)/config.status
	cd $(rootfromhere) && CONFIG_FILES=$(herefromroot)/$@ CONFIG_HEADERS= ./config.status

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:


syntax highlighted by Code2HTML, v. 0.9.1