Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

build open-axiom

54513 views
## ---------------------------------
## -- Standard Autoconf variables --
## ---------------------------------

SHELL = /bin/bash
VPATH = ../../../open-axiom/src/interp

prefix = /projects/77750c71-ec7b-4962-bf55-a49ff5065fb6
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datarootdir = ${prefix}/share
datadir = ${datarootdir}
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
includedir = ${prefix}/include
oldincludedir = /usr/include
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
infodir = ${datarootdir}/info
htmldir = ${docdir}
dvidir = ${docdir}
pdfdir = ${docdir}
psdir = ${docdir}
libdir = ${exec_prefix}/lib
lispdir = @lispdir@
localedir = ${datarootdir}/locale

host = x86_64-unknown-linux-gnu
host_alias = 
build = x86_64-unknown-linux-gnu
build_alias = 
target = x86_64-unknown-linux-gnu
target_alias = 

srcdir = ../../../open-axiom/src/interp
abs_srcdir = /projects/77750c71-ec7b-4962-bf55-a49ff5065fb6/open-axiom-build/../open-axiom/src/interp
top_srcdir = ../../../open-axiom
abs_top_srcdir = /projects/77750c71-ec7b-4962-bf55-a49ff5065fb6/open-axiom-build/../open-axiom
top_confdir = $(top_srcdir)/config

# Notice that there is a bug in Autoconf 2.59 whereby the variable
# top_builddir is not defined.  So avoid to use it directly.  Use
# abs_top_builddir.
builddir = .
abs_builddir = /projects/77750c71-ec7b-4962-bf55-a49ff5065fb6/open-axiom-build/src/interp
top_builddir = ../..
abs_top_builddir = /projects/77750c71-ec7b-4962-bf55-a49ff5065fb6/open-axiom-build
datadir = ${datarootdir}

PACKAGE_VERSION = 1.5.0-2016-01-24

AR = ar
CC = gcc
CXX = g++
LD = /usr/bin/ld -m elf_x86_64
CPPFLAGS =  -m64 -D_GNU_SOURCE
CFLAGS = -g -O2 -O2 -Wall
CXXFLAGS = -std=c++11 -g -O2 -O2 -Wall
LDFLAGS =  -m64
OBJEXT = o
EXEEXT = 
# this includes leading period
SHREXT = .so
# extension of the archive library; this does not include period
LIBEXT = a

PACKAGE_STRING = OpenAxiom 1.5.0-2016-01-24

LIBTOOL_DEPS = ../open-axiom/config/ltmain.sh
LIBTOOL = $(top_builddir)/libtool

## Command used to compile a C++ program 
COMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c $(CPPFLAGS) $(CXXFLAGS)

## Sadly, at the moment, the C parts of the OpenAxiom system is not
## well structured enough to allow for clean dynamic libraries
## and dynamic linking.  So, we build static programs.
## This situation is to be fixed when I have time.
LINK = $(LIBTOOL) --tag=CXX --mode=link $(CXX) -static $(LDFLAGS)

## Libtool is a disaster for building DLLs on Cygwin, and insists
## on adding silly extensions where it should not on MinGW, so we have
## to be very selective about when and where to use.  Sadly, that ends
## up negating the whole point of having Libtool in the first place.
ifeq (no,no)
LINK_SHRLIB = $(CC) $(LDFLAGS)
CXXLINK_SHRLIB = $(CXX) $(LDFLAGS)
else
LINK_SHRLIB = $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS)
CXXLINK_SHRLIB = $(LIBTOOL) --tag=CXX --mode=link $(CC) $(LDFLAGS)
endif


oa_shrobj_flags = -prefer-pic
oa_shrlib_flags = -shared

AWK = gawk
INSTALL = /usr/bin/install -c
install_sh = ${SHELL} /projects/77750c71-ec7b-4962-bf55-a49ff5065fb6/open-axiom/config/install-sh
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_script = $(install_sh) -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
## FIXME:  The test done with Autoconf-2.60 and later concludes
##         that "ln -s" is unusable on msys, and therefore defaults to
##         "cp -p", but that default is unusable for us.  For our
##         purpose "ln -s" is just fine on that platform.  Consequently
##         we are explicitly overrding that value here.
LN_S = ln -s
mkinstalldirs = $(top_srcdir)/config/mkinstalldirs
RANLIB = ranlib
TOUCH = touch

# The list of make targets made recursively, by walking sub-directories
# Normally, this is a template generated by Automake, but we don't
# use Automake yet; so, we must do it the hard way.  
# See the corresponding rules in setup-dep.mk
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
		html-recursive info-recursive install-data-recursive \
		install-exec-recursive install-info-recursive \
		install-recursive installcheck-recursive \
		installdirs-recursive pdf-recursive ps-recursive \
		uninstall-info-recursive uninstall-recursive


## Normally, Automake will substitute the value for this variable.
## But, we don't have Automake yet.  So we punt on it.
mkdir_p = mkdir -p

STAMP = echo timestamp >

## -------------------------
## -- OpenAxiom variables --
## -------------------------

quiet_flags = --noinform --noprint
eval_flags = --no-sysinit --no-userinit --disable-debugger --eval
oa_standard_linking = no


## Absolute path to the toplevel source directory for OpenAxiom.  This is
## almost like Autoconf-standard abs_top_srcdir except that, it retains 
## the same syntactic values in subdirectories.

## Where The OpenAxiom distribution main source files are kept.
## Notice, this is the src/ directory within the toplevel source
## directory 

oa_src_srcdir = $(top_srcdir)/src
oa_src_docdir = $(oa_src_srcdir)/doc
oa_src_datadir = $(oa_src_srcdir)/share
oa_src_algdir = $(oa_src_srcdir)/algebra
oa_src_texdir = $(oa_src_datadir)/tex

oa_configdir = $(top_builddir)/config
oa_c_macros = $(oa_configdir)/axiom-c-macros.h

LATEX = 

## Staging directory for the target DESTDIR
oa_targetdir = $(top_builddir)/$(target)
oa_target_bindir = $(oa_targetdir)/bin
oa_target_libdir = $(oa_targetdir)/lib
oa_target_srcdir = $(oa_targetdir)/src
oa_target_docdir = $(oa_targetdir)/doc
oa_target_datadir = $(oa_targetdir)/share
oa_target_texdir = $(oa_target_datadir)/texmf/tex
oa_target_includedir = $(oa_targetdir)/include


## The final directory where OpenAxiom is installed.  This is usually
## the directory deduced or specified at configuration time.
open_axiom_installdir = ${exec_prefix}/lib/open-axiom/x86_64-unknown-linux-gnu/1.5.0-2016-01-24

INC=$(top_srcdir)/src/include
oa_c_runtime_extra = -lutil   -lm
oa_c_libs = -lopen-axiom-core $(oa_c_runtime_extra) -lm

oa_yesno_to_lisp_boolean = $(subst yes,t,$(subst no,nil,$(1)))

oa_enable_profiling = no
oa_enable_lisp_profiling = \
	$(call oa_yesno_to_lisp_boolean,$(oa_enable_profiling))

oa_enable_threads = no

oa_use_x = yes
AXIOM_X11_CFLAGS =  
AXIOM_X11_LDFLAGS =  -lXpm  -lSM -lICE -lX11 

oa_includes = -I$(oa_src_srcdir)/include -I$(oa_configdir)

## Where the staging build directory is found
AXIOM = $(top_builddir)/$(target)

## Where to find OpenAxiom data bases.
DAASE = $(oa_src_datadir)

## -------------------------------------------
## -- Files generated for the build machine --
## -------------------------------------------
oa_hammer = $(top_builddir)/src/utils/hammer$(EXEEXT)

OA_LISP = sbcl
# Extension of the output file name returned by compile-file
FASLEXT = fasl

# Extension of compiled FASLs appropriate for linking into executable
# programs.  For most Lisp systems, it is the same as FASLEXT because
# they build programs by dumping images.
ifeq (sbcl,ecl)
LNKEXT = $(OBJEXT)
else
LNKEXT = $(FASLEXT)
endif


# Qt utilities
OA_QT_MOC = moc
OA_QT_QMAKE = qmake

## Clear suffix-based implicit rule table.
.SUFFIXES:
## Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
## All rights reserved.
## Copyright (C) 2007-2014, Gabriel Dos Reis.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are
## met:
##
##     - Redistributions of source code must retain the above copyright
##       notice, this list of conditions and the following disclaimer.
##
##     - Redistributions in binary form must reproduce the above copyright
##       notice, this list of conditions and the following disclaimer in
##       the documentation and/or other materials provided with the
##       distribution.
##
##     - Neither the name of The Numerical ALgorithms Group Ltd. nor the
##       names of its contributors may be used to endorse or promote products
##       derived from this software without specific prior written permission.
##
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
## IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
## PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
## OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
## LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##


subdir = src/interp/

IN=$(srcdir)
DOC=$(oa_target_docdir)/src/interp
BOOK=$(oa_target_docdir)

## Where to put interp modules
oa_target_moddir = $(oa_targetdir)/interp

## FFI module.
OA_FFI_MOD = sys-os.$(FASLEXT)
#OA_FFI_OBJ = $(OA_FFI_MOD)

## Installed FFI delayed module.
oa_target_delayed = $(oa_target_moddir)/$(OA_FFI_MOD)
oa_target_ffi = $(oa_target_delayed)

# Driver to launch translation and compilation
DRIVER = $(top_builddir)/src/driver/open-axiom$(EXEEXT)

# Translator from Boot to Lisp (or machine code)
BOOTSYS = $(oa_target_bindir)/bootsys$(EXEEXT)

# Minimal OpenAxiom image necessary to build the algebra
SAVESYS= interpsys$(EXEEXT)

# Complete OpenAxiom image after completion of algebra, ready to install.
AXIOMSYS= $(oa_target_bindir)/AXIOMsys$(EXEEXT)

OBJS=   boot-pkg.$(FASLEXT)	types.$(FASLEXT)	 \
	$(OA_FFI_OBJ)           \
	sys-driver.$(FASLEXT)	sys-constants.$(FASLEXT) \
	hash.$(FASLEXT) 	lisp-backend.$(FASLEXT)	 \
	sys-globals.$(FASLEXT)	vmlisp.$(FASLEXT)	 \
	io.$(FASLEXT)          	                      	 \
	sys-utility.$(FASLEXT)  lexing.$(FASLEXT)        \
	diagnostics.$(FASLEXT)	                         \
	union.$(FASLEXT)	sys-macros.$(FASLEXT)	 \
	                     	util.$(FASLEXT)		 \
	unlisp.$(FASLEXT)	g-util.$(FASLEXT)	\
	g-opt.$(FASLEXT)	c-util.$(FASLEXT)	\
	astr.$(FASLEXT)		                  	\
	ht-util.$(FASLEXT)	bc-util.$(FASLEXT)	\
	br-search.$(FASLEXT)	alql.$(FASLEXT)		\
	buildom.$(FASLEXT)	                        \
	simpbool.$(FASLEXT)	g-timer.$(FASLEXT)	\
	cattable.$(FASLEXT)	posit.$(FASLEXT)	\
	cformat.$(FASLEXT)	clam.$(FASLEXT)		\
	clammed.$(FASLEXT)	nlib.$(FASLEXT)	        \
	                        daase.$(FASLEXT)       	\
	pathname.$(FASLEXT)	compat.$(FASLEXT)      	\
	serror.$(FASLEXT)	ptrees.$(FASLEXT)	\
	cparse.$(FASLEXT)	cstream.$(FASLEXT)	\
	g-cndata.$(FASLEXT)	database.$(FASLEXT)	\
	debug.$(FASLEXT)	dq.$(FASLEXT)		\
	fname.$(FASLEXT)	format.$(FASLEXT)	\
	g-error.$(FASLEXT)	ggreater.$(FASLEXT)	\
	hypertex.$(FASLEXT)	i-object.$(FASLEXT)	\
	i-analy.$(FASLEXT)	i-resolv.$(FASLEXT)	\
	i-coerfn.$(FASLEXT)	i-coerce.$(FASLEXT)	\
	i-eval.$(FASLEXT)	i-funsel.$(FASLEXT)	\
	i-intern.$(FASLEXT)	i-map.$(FASLEXT)	\
	i-output.$(FASLEXT)	i-special.$(FASLEXT)	\
	i-syscmd.$(FASLEXT)	i-toplev.$(FASLEXT)	\
	i-util.$(FASLEXT)	incl.$(FASLEXT)		\
	int-top.$(FASLEXT)	                   	\
	lisplib.$(FASLEXT)	macex.$(FASLEXT)	\
	match.$(FASLEXT)	monitor.$(FASLEXT)	\
	msg.$(FASLEXT)		msgdb.$(FASLEXT)	\
	                    	newfort.$(FASLEXT)	\
	nrunfast.$(FASLEXT)	osyscmd.$(FASLEXT)	\
	packtran.$(FASLEXT)	pf2sex.$(FASLEXT)	\
	scan.$(FASLEXT)		pile.$(FASLEXT)		\
	                      	postpar.$(FASLEXT)	\
	parse.$(FASLEXT)	spad-parser.$(FASLEXT) \
	record.$(FASLEXT)	rulesets.$(FASLEXT)	\
	server.$(FASLEXT)	setvars.$(FASLEXT)	\
	sfsfun-l.$(FASLEXT)	sfsfun.$(FASLEXT)	\
	slam.$(FASLEXT)		                        \
	spad.$(FASLEXT)		termrw.$(FASLEXT)	\
	trace.$(FASLEXT)	word.$(FASLEXT)        	\
	fortcall.$(FASLEXT) 	i-parser.$(FASLEXT) 	\
	$(OCOBJS) $(BROBJS)     setvart.$(FASLEXT)

# Main compiler files.
OCOBJS=	\
	category.$(FASLEXT)	define.$(FASLEXT)	\
	                    	compiler.$(FASLEXT)	\
	c-doc.$(FASLEXT)	\
	profile.$(FASLEXT)	functor.$(FASLEXT)	\
	nruncomp.$(FASLEXT)	htcheck.$(FASLEXT)

# Browser component files.
BROBJS=	bc-matrix.$(FASLEXT)				\
	bc-misc.$(FASLEXT)	bc-solve.$(FASLEXT)	\
	htsetvar.$(FASLEXT)	\
	ht-root.$(FASLEXT)	\
	br-con.$(FASLEXT)	\
	br-data.$(FASLEXT)	showimp.$(FASLEXT)    \
	br-op1.$(FASLEXT)	br-op2.$(FASLEXT)	\
	br-util.$(FASLEXT)	\
	topics.$(FASLEXT)     br-prof.$(FASLEXT)    \
	br-saturn.$(FASLEXT)

INITDB_OBJ = $(builddir)/../algebra/initdb.$(LNKEXT)

TIMESTAMP=$(oa_targetdir)/timestamp
YEARWEEK=(progn (defconstant timestamp "${TIMESTAMP}") \
                (setq *build-version* "$(PACKAGE_STRING)") \
                (yearweek))


.PRECIOUS:	${SAVESYS}
.PRECIOUS:	${AXIOMSYS}

UNUSED= ${DOC}/guess.boot.dvi \
	${DOC}/interp-fix.boot.dvi \
	${DOC}/nhyper.boot.dvi ${DOC}/pf2atree.boot.dvi \
	${DOC}/redefs.boot.dvi


.SUFFIXES:
.SUFFIXES: .boot .clisp .lisp .pamphlet

.PHONY: all all-ax all-interpsys all-axiomsys

all: all-ax

all-ax: all-interpsys
	@echo finished $(srcdir)

all-interpsys:
	$(MAKE) $(SAVESYS)

all-axiomsys:
	$(MAKE) $(AXIOMSYS)

mostlyclean-local:
	@rm -f *.fn *.data *.$(FASLEXT) *.lib *.$(OBJEXT)
	@rm -f $(SAVESYS) makeint.lisp

clean-local: mostlyclean-local
	@rm -f *.clisp *.lsp

distclean-local: clean-local

$(oa_target_delayed): $(OA_FFI_MOD)
	$(mkdir_p) $(oa_target_moddir)
	cp -p $< $@

$(oa_target_datadir)/msgs/s2-us.msgs: \
	$(oa_src_docdir)/msgs/s2-us.msgs
	$(mkdir_p) $(oa_target_datadir)/msgs
	cp -p $< $@

makeint.lisp: Makefile
	@rm -f makeint.lisp
	@ echo '(import-module "util")' >> makeint.lisp
	@ echo '(in-package "BOOT")' >> makeint.lisp
	@ touch ${TIMESTAMP}
	@ echo '${YEARWEEK}' >> makeint.lisp
	@ echo '(unless (or |$$StandardLinking| (|%basicSystemIsComplete|)) (build-interpsys)(|clearClams|))' >> makeint.lisp
	@ echo '#+:gcl (setq compiler::*suppress-compiler-notes* t)' >> makeint.lisp
	@ echo '#+:gcl (si::gbc-time 0)' >> makeint.lisp
	@ echo '#+:GCL (si::gbc t)' >> makeint.lisp

$(SAVESYS): database.date $(oa_target_datadir)/msgs/s2-us.msgs $(OBJS) $(oa_target_ffi)
	$(DRIVER) --execpath=$(BOOTSYS) \
		--syslib=$(oa_target_libdir) --system="$(AXIOM)/" \
		--prologue="(pushnew :open-axiom-basic-system *features*)" \
		--make --output=$@ --main="BOOT::|systemMain|" \
		--load-directory=. $(OBJS)

.PHONY: all-axiomsys

all-axiomsys: ${AXIOMSYS}

${AXIOMSYS}: database.date \
		$(oa_targetdir)/algebra/exposed.$(FASLEXT) \
		$(oa_target_datadir)/msgs/s2-us.msgs \
		$(OBJS) $(oa_target_ffi) \
		$(INITDB_OBJ) \
		makeint.$(LNKEXT)
	$(DRIVER) --execpath=$(BOOTSYS) \
		--syslib=$(oa_target_libdir) \
		--system="$(AXIOM)/" \
		--sysalg="$(oa_targetdir)/algebra/" \
		--prologue="(pushnew :open-axiom-algebra-system *features*)" \
		--make --output=$@ --main="BOOT::|systemMain|" \
		--load-directory=. $(OBJS) $(INITDB_OBJ) makeint.$(LNKEXT)
	@ echo 6a $@ created
exposed.lsp: $(oa_src_algdir)/exposed.lsp.pamphlet
	$(oa_hammer) --tangle --output=$@ $<

$(oa_targetdir)/algebra/exposed.$(FASLEXT) : exposed.lsp boot-pkg.$(LNKEXT)
	$(mkdir_p) $(oa_targetdir)/algebra
	$(DRIVER) --execpath=$(BOOTSYS) --syslib=$(oa_target_libdir) \
		--compile --output=$@ --load-directory=. $<

database.date:
	@ echo 617 the database was updated...remaking interpsys
	@ touch database.date


%.$(LNKEXT) %.$(FASLEXT): %.boot
	$(DRIVER) --execpath=$(BOOTSYS) --syslib=$(oa_target_libdir) \
		--compile --output=$@ --load-directory=. $<

%.$(LNKEXT) %.$(FASLEXT): %.lisp
	$(DRIVER) --execpath=$(BOOTSYS) --syslib=$(oa_target_libdir) \
		--compile --output=$@ --load-directory=. $<

## Translation to Fortran
fortcall.$(FASLEXT): sys-macros.$(FASLEXT)

## HyperDoc
topics.$(FASLEXT): sys-macros.$(FASLEXT) sys-utility.$(FASLEXT)
alql.$(FASLEXT): br-search.$(FASLEXT)
br-search.$(FASLEXT): bc-util.$(FASLEXT)
br-saturn.$(FASLEXT): bc-util.$(FASLEXT)
br-op2.$(FASLEXT): br-op1.$(FASLEXT)
br-op1.$(FASLEXT): bc-util.$(FASLEXT)
br-con.$(FASLEXT): bc-util.$(FASLEXT)
br-prof.$(FASLEXT): bc-util.$(FASLEXT)
br-data.$(FASLEXT): bc-util.$(FASLEXT) nruncomp.$(FASLEXT)
br-util.$(FASLEXT): bc-util.$(FASLEXT)
bc-solve.$(FASLEXT): bc-matrix.$(FASLEXT) bc-misc.$(FASLEXT)
bc-matrix.$(FASLEXT): bc-util.$(FASLEXT)
bc-misc.$(FASLEXT): bc-util.$(FASLEXT)
bc-util.$(FASLEXT): ht-util.$(FASLEXT) c-util.$(FASLEXT)
ht-root.$(FASLEXT): ht-util.$(FASLEXT)
htcheck.$(FASLEXT): sys-driver.$(FASLEXT) sys-macros.$(FASLEXT)
ht-util.$(FASLEXT): sys-macros.$(FASLEXT)
htsetvar.$(FASLEXT): sys-macros.$(FASLEXT)
hypertex.$(FASLEXT): types.$(FASLEXT)

## OpenAxiom's interpreter.
makeint.$(FASLEXT): util.$(FASLEXT)
setvars.$(FASLEXT): sys-macros.$(FASLEXT) debug.$(FASLEXT)
profile.$(FASLEXT): sys-macros.$(FASLEXT) sys-utility.$(FASLEXT) c-util.$(FASLEXT)
rulesets.$(FASLEXT): vmlisp.$(FASLEXT)
osyscmd.$(FASLEXT): int-top.$(FASLEXT)
int-top.$(FASLEXT): incl.$(FASLEXT) i-toplev.$(FASLEXT) unlisp.$(FASLEXT)
i-toplev.$(FASLEXT): i-analy.$(FASLEXT)
i-syscmd.$(FASLEXT): i-object.$(FASLEXT)
i-output.$(FASLEXT): sys-utility.$(FASLEXT) sys-macros.$(FASLEXT)
i-special.$(FASLEXT): i-analy.$(FASLEXT)
i-funsel.$(FASLEXT): i-coerfn.$(FASLEXT)
i-map.$(FASLEXT): i-object.$(FASLEXT)
i-eval.$(FASLEXT): i-analy.$(FASLEXT)
i-coerce.$(FASLEXT): i-coerfn.$(FASLEXT)
i-coerfn.$(FASLEXT): i-analy.$(FASLEXT) i-resolv.$(FASLEXT)
i-resolv.$(FASLEXT): i-object.$(FASLEXT)
i-analy.$(FASLEXT): i-object.$(FASLEXT)
i-intern.$(FASLEXT): i-object.$(FASLEXT) ptrees.$(FASLEXT)
i-object.$(FASLEXT): i-util.$(FASLEXT)
i-util.$(FASLEXT): c-util.$(FASLEXT)
format.$(FASLEXT): sys-macros.$(FASLEXT)
match.$(FASLEXT): sys-macros.$(FASLEXT)
record.$(FASLEXT): nlib.$(FASLEXT) pathname.$(FASLEXT)
setvart.$(FASLEXT): sys-macros.$(FASLEXT)

## OpenAxiom's compiler
compiler.$(FASLEXT): msgdb.$(FASLEXT) pathname.$(FASLEXT) define.$(FASLEXT) 
nrunfast.$(FASLEXT): c-util.$(FASLEXT)
nruncomp.$(FASLEXT): profile.$(FASLEXT) simpbool.$(FASLEXT) nrunfast.$(FASLEXT)
define.$(FASLEXT): g-error.$(FASLEXT) nruncomp.$(FASLEXT) database.$(FASLEXT)
database.$(FASLEXT): clam.$(FASLEXT) nlib.$(FASLEXT) \
		cattable.$(FASLEXT) compat.$(FASLEXT) g-cndata.$(FASLEXT) \
		c-util.$(FASLEXT)
functor.$(FASLEXT): category.$(FASLEXT) lisplib.$(FASLEXT) nruncomp.$(FASLEXT)
category.$(FASLEXT): c-util.$(FASLEXT) g-cndata.$(FASLEXT)
cattable.$(FASLEXT): simpbool.$(FASLEXT) c-util.$(FASLEXT)
compat.$(FASLEXT): pathname.$(FASLEXT)
simpbool.$(FASLEXT): sys-macros.$(FASLEXT)
newfort.$(FASLEXT): sys-macros.$(FASLEXT)
lisplib.$(FASLEXT): database.$(FASLEXT) debug.$(FASLEXT)
c-doc.$(FASLEXT): c-util.$(FASLEXT)
server.$(FASLEXT): sys-macros.$(FASLEXT)

##
## OpenAxiom's front-end consists of two parts:
##    (a) the interprerter's parser -- also referred to as new parser
##    (b) the compiler parser -- also referred to as parser
##

## The old parser component roughtly is:
##
spad-parser.$(FASLEXT): parse.$(FASLEXT) lexing.$(FASLEXT)
parse.$(FASLEXT): postpar.$(FASLEXT)
packtran.$(FASLEXT): sys-macros.$(FASLEXT)
postpar.$(FASLEXT): sys-macros.$(FASLEXT)
nlib.$(FASLEXT): sys-macros.$(FASLEXT) sys-utility.$(FASLEXT)
lexing.$(FASLEXT): sys-utility.$(FASLEXT) sys-macros.$(FASLEXT) \
	io.$(FASLEXT)

## The new parser component roughtly is:
##   astr.boot dq.boot incl.boot pile.boot ptrees.boot
##   posit.boot cparse.boot format.boot cstream.boot
##
i-parser.$(FASLEXT): cparse.$(FASLEXT) pf2sex.$(FASLEXT)
pf2sex.$(FASLEXT): ptrees.$(FASLEXT)
cparse.$(FASLEXT): ptrees.$(FASLEXT)
macex.$(FASLEXT): ptrees.$(FASLEXT)
ptrees.$(FASLEXT): posit.$(FASLEXT) serror.$(FASLEXT)
pile.$(FASLEXT): scan.$(FASLEXT)
scan.$(FASLEXT): incl.$(FASLEXT) dq.$(FASLEXT) sys-utility.$(FASLEXT)
incl.$(FASLEXT): cstream.$(FASLEXT) cformat.$(FASLEXT)
cformat.$(FASLEXT): unlisp.$(FASLEXT) posit.$(FASLEXT)
serror.$(FASLEXT): posit.$(FASLEXT)
unlisp.$(FASLEXT): sys-macros.$(FASLEXT)
posit.$(FASLEXT): sys-macros.$(FASLEXT) astr.$(FASLEXT)
intfile.$(FASLEXT): cstream.$(FASLEXT)
cstream.$(FASLEXT): sys-macros.$(FASLEXT)
astr.$(FASLEXT): vmlisp.$(FASLEXT)
dq.$(FASLEXT): types.$(FASLEXT)

## General support and utilities.
daase.$(FASLEXT): sys-utility.$(FASLEXT)
debug.$(FASLEXT): sys-macros.$(FASLEXT) lexing.$(FASLEXT)
spad.$(FASLEXT): spad-parser.$(FASLEXT) postpar.$(FASLEXT) debug.$(FASLEXT)
monitor.$(FASLEXT): sys-macros.$(FASLEXT) sys-utility.$(FASLEXT)
sfsfun-l.$(FASLEXT): sys-macros.$(FASLEXT)
trace.$(FASLEXT): debug.$(FASLEXT)
termrw.$(FASLEXT): sys-macros.$(FASLEXT)
showimp.$(FASLEXT): c-util.$(FASLEXT) nruncomp.$(FASLEXT)
sfsfun.$(FASLEXT): sys-macros.$(FASLEXT)
slam.$(FASLEXT): g-timer.$(FASLEXT)
clammed.$(FASLEXT): g-timer.$(FASLEXT)
clam.$(FASLEXT): g-timer.$(FASLEXT)
g-opt.$(FASLEXT): g-util.$(FASLEXT)
g-timer.$(FASLEXT): sys-macros.$(FASLEXT) g-util.$(FASLEXT)
msgdb.$(FASLEXT): g-util.$(FASLEXT)
g-error.$(FASLEXT): diagnostics.$(FASLEXT) g-util.$(FASLEXT)
c-util.$(FASLEXT): g-opt.$(FASLEXT)
pathname.$(FASLEXT): nlib.$(FASLEXT)
word.$(FASLEXT): g-util.$(FASLEXT)
g-util.$(FASLEXT): ggreater.$(FASLEXT) sys-macros.$(FASLEXT) daase.$(FASLEXT)
g-cndata.$(FASLEXT): sys-macros.$(FASLEXT) c-util.$(FASLEXT)
msg.$(FASLEXT): sys-macros.$(FASLEXT) astr.$(FASLEXT)
util.$(FASLEXT): lexing.$(FASLEXT)
fname.$(FASLEXT): sys-macros.$(FASLEXT)
sys-macros.$(FASLEXT): diagnostics.$(FASLEXT) union.$(FASLEXT)
buildom.$(FASLEXT): buildom.boot sys-macros.$(FASLEXT) c-util.$(FASLEXT) \
	nruncomp.$(FASLEXT)
diagnostics.$(FASLEXT): sys-globals.$(FASLEXT) vmlisp.$(FASLEXT)
sys-driver.$(FASLEXT): sys-driver.boot types.$(FASLEXT)
sys-globals.$(FASLEXT): sys-constants.$(FASLEXT) hash.$(FASLEXT)
sys-os.$(FASLEXT): sys-constants.$(FASLEXT)
sys-constants.$(FASLEXT): types.$(FASLEXT)
hash.$(FASLEXT): types.$(FASLEXT)
union.$(FASLEXT): vmlisp.$(FASLEXT)
ggreater.$(FASLEXT): vmlisp.$(FASLEXT)
lisp-backend.$(FASLEXT): sys-macros.$(FASLEXT) nlib.$(FASLEXT) c-util.$(FASLEXT)
sys-utility.$(FASLEXT): vmlisp.$(FASLEXT) sys-constants.$(FASLEXT) hash.$(FASLEXT)
vmlisp.$(FASLEXT): types.$(FASLEXT) sys-globals.$(FASLEXT)
io.$(FASLEXT): sys-constants.$(FASLEXT)
types.$(FASLEXT): boot-pkg.$(FASLEXT)
boot-pkg.$(FASLEXT): boot-pkg.lisp

$(oa_build_texdir)/diagrams.tex: $(oa_src_docdir)/diagrams.tex
	@cp -p $< $@

## ---------------------------------------
## -- Standard boilerplate dependencies --
## ---------------------------------------

# Recursive rules, usually automatically generated by Automake.
# Since we do not use (yet) Automake, we mimic the behaviour as
# close as possible.
# Recursive wall of sub-directories is based on the variable
# SUBDIRS.  That variable usually contains the of sub-directories
# to be made in depth-first postfix.  However, that order can
# be changed to depth-first prefix by explicitly including "."
# in SUBDIRS.  Rules ending with '-ax' are those specific to the
# the current directory.  Notice that the '-ax' rules are similar 
# to Automake generated '-am'.
.PHONY: $(RECURSIVE_TARGETS)
$(RECURSIVE_TARGETS):
	failcmd='exit 1'; \
	for f in $$MAKEFLAGS; do \
	   case $$f in \
	      *=* | --[!k]*) ;; \
	      *k*) failcmd='fail=yes';; \
	   esac; \
	done; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; list='$(SUBDIRS)'; \
	for subdir in $$list; do \
	   echo "Making $$target in $$subdir"; \
	   if test "$$subdir" = "."; then \
	      dot_seen=yes; \
	      local_target="$$target-ax"; \
	   else \
	      local_target="$$target"; \
	   fi; \
	   (cd $$subdir && $(MAKE) $$local_target) || eval $$failcmd; \
	done; \
	if test "$$dot_seen" = "no"; then \
	   $(MAKE) "$$target-ax" || exit 1; \
	fi; test -z "$$fail"

# Recursive cleanup is done in reverse, postfix order of ordinary build.
.PHONY: mostlyclean-recursive
.PHONY: clean-recursive
.PHONY: distclean-recursive
.PHONY: maintainer-clean-recursive
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
	@failcmd='exit 1'; \
	for f in $$MAKEFLAGS; do \
	   case $$f in \
	      *=* | --[!k]*) ;; \
	      *k*) failcmd='fail=yes';; \
	   esac; \
	done; \
	dot_seen=no; \
	case "$@" in \
	   distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
	   *) list='$(SUBDIRS)' ;; \
	esac; \
	rev=''; \
	for subdir in $$list; do \
	   if test "$$subdir" != "."; then \
	      rev="$$subdir $$rev"; \
	   fi; \
	done; \
	rev="$$rev ."; \
	target=`echo $@ | sed s/-recursive//`; \
	for subdir in $$rev; do \
	   echo "Making $$target in $$subdir"; \
	   if test "$$subdir" = "."; then \
	      local_target="$$target-ax"; \
	   else \
	      local_target="$$target"; \
	   fi; \
	   (cd $$subdir && $(MAKE) $$local_target) || eval $$failcmd; \
	done && test -z "$$fail"

## Rules to make DVI files from pamphlets

.PRECIOUS: %.tex
.PRECIOUS: %.dvi

DVI_FILES = $(addprefix $(oa_target_docdir)/$(subdir), \
		$(pamphlets:.pamphlet=.dvi))

pamphlets_SOURCES = $(addprefix $(srcdir)/, $(pamphlets))

.PHONY: dvi dvi-ax
dvi: dvi-recursive
dvi-ax: $(oa_build_texdir)/axiom.sty $(DVI_FILES)

$(oa_target_docdir)/$(subdir)%.dvi: $(builddir)/%.dvi
	$(mkinstalldirs) $(oa_target_docdir)/$(subdir)
	$(INSTALL_DATA) $< $@

%.dvi: %.tex $(oa_build_texdir)/axiom.sty
	TEXINPUTS=".:$(oa_build_texdir):$${TEXINPUTS}"; \
	export TEXINPUTS; \
	BIBINPUTS=".:$(oa_build_texdir):$${TEXINPUTS}"; \
	export BIBINPUTS; \
	$(oa_hammer) --latex $<

%.tex: $(srcdir)/%.pamphlet
	$(oa_hammer) --weave --output=$@ $<


.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_srcdir)/config/var-def.mk \
	  $(top_srcdir)/config/setup-dep.mk \
	  $(abs_top_builddir)/config.status
	cd $(abs_top_builddir) && $(SHELL) ./config.status $(subdir)$@

$(top_builddir)/src/lisp/core.lisp: \
	$(top_srcdir)/src/lisp/core.lisp.in \
	$(top_builddir)/config.status
	cd $(top_builddir) && \
	$(SHELL) ./config.status src/lisp/core.lisp

## Cleanup.
##   Each Makefile is responsible of defining targets named
##   mostlyclean-local, clean-local, and distclean-local.
.PHONY: mostlyclean-generic mostlyclean-local mostlyclean mostlyclean-ax
mostlyclean-generic:
	@-rm -f *~
	@-rm -f *.log *.aux *.toc

mostlyclean: mostlyclean-recursive
mostlyclean-ax: mostlyclean-generic mostlyclean-local

.PHONY: clean-generic clean-local clean clean-ax
clean-generic: mostlyclean-generic
	@-rm -f *.tex *.dvi

clean: clean-recursive
clean-ax: clean-generic clean-local

.PHONY: distclean-generic distclean-local distclean distclean-ax
distclean-generic: clean-generic
	@-rm -rf $(oa_target_docdir)/$(subdir)

distclean: distclean-recursive
distclean-ax: distclean-generic distclean-local