# Makefile template for dsc-1.0	-*-Makefile-*-
# Copyright (C) 1996 Henry Thompson ht@cogsci.ed.ac.uk (Henry S. Thompson)
# $Header: /home/ht/work/dsssl/dsc-1.0/RCS/Makefile.in,v 1.3 1997/01/27 14:42:58 ht Exp $

# configure uses this to build a Makefile

include sp-1.1.1/Makefile.env

# Name of GNU make utility, maybe
@SET_MAKE@

# Keep /bin/sh cd from screwing up
CDPATH =

prefix=@prefix@
exec_prefix=@exec_prefix@
srcdir=@srcdir@
# Where to install the binaries
bindir=@bindir@
libdir=@libdir@
ELKRUNDIR=@ELKRUNDIR@
INSTALL=@INSTALL@

all:	all_sp-1.1.1 all_elk-3.0 all_src
clean:  clean_sp-1.1.1 clean_elk-3.0 clean_src

%_src: FORCE
	dscsrcdir=`cd $(srcdir); pwd`/scm; \
	if test "$(ELKRUNDIR)"; \
	 then dscsrcdir="$$dscsrcdir:$(ELKRUNDIR)/scm:$(ELKRUNDIR)/obj" ; fi ;\
	cd src && $(MAKE) DSCSRCDIR=$$dscsrcdir -f Makefile.sub $@

%_sp-1.1.1: FORCE
	@if test ! -f .sp-1.1.1-built ;\
	then \
	cd sp-1.1.1 && $(MAKE) -f Makefile.sub $@ ; \
	fi

%_elk-3.0: FORCE
	@if test ! -f .elk-3.0-built ;\
	then \
	cd elk-3.0 && $(MAKE) INSTALLDIR=`pwd` -f Makefile.sub $@ ;\
	fi

SCMFILES= apropos.scm bitstring.scm cscheme.scm debug.scm describe.scm \
          gdbmtest.scm initscheme.scm motif.scm oops.scm parse.scm pp.scm \
          qsort.scm record.scm recordutil.scm regexp.scm safe-env.scm setf.scm \
          siteinfo.scm struct.scm toplevel.scm trace.scm unix.scm

MISOBJS= bitstring.o debug.o elk-eval.o hack.o monitor.o newhandler.o record.o \
         regexp.o struct.o 

install: src/dsc
	$(INSTALL) src/dsc $(bindir)/dsc
	@if test ! -f .elk-3.0-built ;\
	then \
	if test ! -d $(ELKRUNDIR)/scm; then mkdir -p $(ELKRUNDIR)/scm; fi ;\
	if test ! -d $(ELKRUNDIR)/obj; then mkdir -p $(ELKRUNDIR)/obj; fi ;\
	cd elk-3.0/scm; \
	for i in $(SCMFILES) ;\
	do \
	    echo cp $$i $(ELKRUNDIR)/scm; \
	    cp $$i $(ELKRUNDIR)/scm; \
	done; \
	cd ../lib/unix; \
	echo cp unix.pre $(ELKRUNDIR)/obj/unix.o; \
	cp unix.pre $(ELKRUNDIR)/obj/unix.o; \
	cd ../misc; \
	for i in $(MISOBJS) ;\
	do \
	    echo cp $$i $(ELKRUNDIR)/obj; \
	    cp $$i $(ELKRUNDIR)/obj; \
	done; \
	fi

distclean: clean
	rm -f config.cache config.status config.log \
		.sp-1.1.1-built .elk-3.0-built Makefile*
	cd sp-1.1.1; rm -f config.status config.log Makefile*
	cd elk-3.0;  rm -f config/site config/system */Makefile.local \
			include/config.h Makefile.sub

FORCE:
