#############################################################################
##
#W  Makefile                    GAP source                       Frank Celler
##
#H  @(#)$Id: Makefile.in,v 1.5 1999/07/01 15:32:24 gap Exp $
##
#Y  Copyright (C)  1997,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany
##
##  This file is the top level make file.  It is generated from `Makefile.in'
##  by the `configure' script.  After unpacking XGAP you simply type
##
##    ./configure
##
##  to create a make file and then
##
##    make
##
##  to compile and link XGAP.
##
##  The "default" traget:
##    - creates a subdirectory CPU-VENDOR-OS in the directory `bin',
##    - copies the configuration script into this directory,
##    - it switches into this directory and executes the configure script,
##    - it makes XGAP in this directory.
##
##  The "clean" target:
##    - removes the subdirectory CPU-VENDOR-OS in the directory `bin'
##    - removes any files created by `configure'
##
SHELL=/bin/sh
CC=@CC@
@SET_MAKE@

default: config compile

config: bin/@target@-@CC@/configure bin/@target@-@CC@/Makefile

bin/@target@-@CC@/configure: cnf/configure.out
	if test ! -d bin;  then mkdir bin;  fi
	if test ! -d bin/@target@-@CC@;  then mkdir bin/@target@-@CC@;  fi
	@rm -f bin/@target@-@CC@/configure
	cp cnf/configure.out bin/@target@-@CC@/configure

bin/@target@-@CC@/Makefile: bin/@target@-@CC@/configure cnf/config.hin
	( cd bin/@target@-@CC@ ; CC=$(CC) ./configure --target=@target@ @gp_configure_options@ )

compile: bin/@target@-@CC@/configure bin/@target@-@CC@/Makefile
	( cd bin/@target@-@CC@ ; $(MAKE) CC=$(CC) )
	chmod +x xgap.sh
	cp xgap.sh bin/xgap.sh

clean:
	rm -rf bin/@target@-@CC@
	rm -f xgap.sh bin/xgap.sh
	rm -f config.cache config.log config.status Makefile
