# Makedefs.in -- input for the common Makefile definitions
# Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
# $Id: Makedefs.in,v 1.35 2003/09/04 05:57:43 jsh Exp $
#
# This file is part of Jade.
#
# Jade 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, or (at your option)
# any later version.
#
# Jade 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.
#
# You should have received a copy of the GNU General Public License
# along with Jade; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

version=0.17
libversion=13:0:4
SHELL=/bin/sh

top_srcdir=..
srcdir=.

prefix=/usr/local
exec_prefix=${prefix}
datadir=${prefix}/share
bindir=${exec_prefix}/bin
includedir=${prefix}/include
infodir=${prefix}/share/info
libdir=${exec_prefix}/lib
libexecdir=${exec_prefix}/libexec
localstatedir=${prefix}/var
mandir=${prefix}/share/man
sharedstatedir=${prefix}/com
aclocaldir=/usr/share/aclocal
emacssitelispdir=${datadir}/emacs/site-lisp

host_type=i686-pc-linux-gnu
repdir=${datadir}/rep
replispdir=${repdir}/${version}/lisp
repexecdir=${libexecdir}/rep/${version}/${host_type}
repcommonexecdir=${libexecdir}/rep/${host_type}
repdocfile=${repexecdir}/doc-strings

CC=gcc
LIBTOOL=$(SHELL) $(top_builddir)/libtool
MAKEDEP=$(CC) -MM
CPPFLAGS=-DHAVE_CONFIG_H -I. -I$(top_srcdir)/src -I.. 
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wmissing-prototypes
LDFLAGS=
LIBS=-ldl  -lcrypt
LIBOBJS=
EXTRA_LIBOBJS=
READLINE_LIBS=-lreadline  -lncurses
GMP_LIBS=-lgmp -lm
GDBM_LIBS=-lgdbm
FFI_LIBS=
ALLOCA=

DESTDIR=
INSTALL=/usr/bin/install -c
INSTALL_DATA=${INSTALL} -m 644
INSTALL_PROGRAM=${INSTALL}
INSTALL_SCRIPT=${INSTALL}

MAKEINFO = makeinfo
MAKEINFOFLAGS =
TEXI2DVI = texi2dvi
TEXI2PDF = texi2pdf
DVIPS = dvips

HAVE_X11=
HAVE_UNIX=1

.PHONY: clean realclean install

rep_prog = $(top_builddir)/src/rep
COMPILE_ENV = REPLISPDIR=$(top_builddir)/lisp \
	      REP_DL_LOAD_PATH=$(top_builddir)/src/.libexec \
	      REPDOCFILE=$(top_builddir)/doc-strings

include $(top_srcdir)/rules.mk
rep_LIBTOOL=$(SHELL) $(top_builddir)/libtool

# Rule for ``normal'' C objects
%.o : %.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<

# Rule for ``normal'' executables
% : %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)

# Rule for libtool controlled C objects
%.lo : %.c
	$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $<

# Rule for dlopen'able C objects
%.la : %.c
	$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
	$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $*.lo

# Build dependancy files from C source files.
.%.d : %.c
	$(SHELL) -ec '$(MAKEDEP) $(CPPFLAGS) $< \
	| sed '\''s/$*\.o/& $*.lo .$*\.d/g'\'' > $@'
# Makefile.in for rep's Lisp files
# Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
# $Id: Makefile.in,v 1.28 2002/06/22 23:12:26 jsh Exp $
#
# This file is part of rep.
#
# rep 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, or (at your option)
# any later version.
#
# rep 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.
#
# You should have received a copy of the GNU General Public License
# along with rep; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

top_builddir=..
VPATH=..

INSTALL_FILES = *.jl *.jlc

INSTALL_DIRS := . rep rep rep/lang rep/vm rep/vm/compiler rep/io \
	rep/io/file-handlers rep/io/file-handlers/remote rep/i18n \
	rep/data rep/www rep/util rep/mail rep/threads rep/system \
	rep/net rep/test rep/xml scheme unscheme

all : lisp

lisp : ../src/.libexec
	$(COMPILE_ENV) $(rep_prog) --batch --no-rc \
	  -l rep.vm.compiler -f compile-assembler
	$(COMPILE_ENV) $(rep_prog) --batch --no-rc \
	  -l rep.vm.compiler -f compile-compiler
	$(COMPILE_ENV) $(rep_prog) --batch --no-rc \
	  -l rep.vm.compiler -f compile-lisp-lib

../src/.libexec :
	( cd ../src && $(MAKE) .libexec )

check : all
	$(COMPILE_ENV) $(rep_prog) --batch --check

install : all installdirs
	for d in $(INSTALL_DIRS); do \
	  for f in  $(foreach x,$(INSTALL_FILES),$$d/$(x)); do \
	    $(INSTALL_DATA) $$f $(DESTDIR)$(replispdir)/$$d; \
	  done; \
	done
	$(SHELL) $(top_srcdir)/install-aliases -l . $(DESTDIR)$(replispdir)

installdirs : mkinstalldirs
	$(SHELL) $< $(foreach x,$(INSTALL_DIRS),$(DESTDIR)$(replispdir)/$(x))

uninstall :
	for d in $(INSTALL_DIRS); do \
	  for f in $(foreach x,$(INSTALL_FILES),$$d/$(x)); do \
	    rm -f $(DESTDIR)$(replispdir)/$$f; \
	  done; \
	done

clean :
	rm -f `find . \( -name '*.jlc' -o -name '*~' -o -name core \) -print`

distclean : clean
	rm -f Makefile

realclean : distclean

.PHONY : all lisp install uninstall clean realclean distclean
