#  file config/Makefile: Numerix build
#-----------------------------------------------------------------------+
#  Copyright 2005-2006, Michel Quercia (michel.quercia@prepas.org)      |
#                                                                       |
#  This file is part of Numerix. Numerix is free software; you can      |
#  redistribute it and/or modify it under the terms of the GNU Lesser   |
#  General Public License as published by the Free Software Foundation; |
#  either version 2.1 of the License, or (at your option) any later     |
#  version.                                                             |
#                                                                       |
#  The Numerix Library 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  |
#  Lesser General Public License for more details.                      |
#                                                                       |
#  You should have received a copy of the GNU Lesser General Public     |
#  License along with the GNU MP Library; see the file COPYING. If not, |
#  write to the Free Software Foundation, Inc., 59 Temple Place -       |
#  Suite 330, Boston, MA 02111-1307, USA.                               |
#-----------------------------------------------------------------------+
#                                                                       |
#                        Compilation de Numerix                         |
#                                                                       |
#-----------------------------------------------------------------------+

# Normally the script [configure] will check your computer and create a
# suitable [Makefile] file; edit this file only when [configure] cannot
# determine by itself the correct values. Then you'll need to regenerate
# a suitable set of kernel/*/makefiles by running the command:
#
# make makefiles
#
# Enter 1 or 0 for boolean values, 1 == yes

# enter the processor category below
# this definition is used to select appropriate machine code for the
# Slong module and also to select appropriate thresholds for all modes
# (Clong/Dlong/Slong).
#
# [x86] should be ok with all Intel-like processors
# [x86-sse2] selects faster code with sse2 instructions for Pentiums >= 4
# [x86-64] selects 64 bit code for Athlon-64 and Pentiums with LM capability
# [alpha] selects 64 bit code for Digital-Alpha processors
# [ppc32] selects 32 bit code for PowerPC 32 bit processors
# use [generic] if you don't one of the above processors.
PROCESSOR = @processor@

#--------------- Selection of languages
# Note : the Pascal interface needs the C one, so the C interface
# will be built even if unwanted when MAKE_PASCAL_LIB = 1.

MAKE_C_LIB       = @make_c_lib@
MAKE_CAML_LIB    = @make_caml_lib@
MAKE_OCAML_LIB   = @make_ocaml_lib@
MAKE_PASCAL_LIB  = @make_pascal_lib@

#--------------- Selection of modules
# Slong is not available for processor=generic

USE_CLONG        = @use_clong@
USE_DLONG        = @use_dlong@
USE_SLONG        = @use_slong@
USE_GMP          = @use_gmp@
USE_CAML_BIGNUM  = @use_caml_bignum@
USE_OCAML_BIGNUM = @use_ocaml_bignum@

#--------------- C compile commands
# you can add -I and -L directives if gcc or the linker fail to find
# some include files or some libraries

# C compiler
GCC = @CC@ -O2 -Wall

# build shared libraries ?
SHARED = @SHARED@

# make position independent code ?
# Shared libraries and x86-64 static libraries require one of the "-fpic"
# or "-fPIC" compile switch. Enter the correct one into the PIC variable.
# For static non-x86-64 libraries, leave the PIC variable blank.
# "-fpic" is said to be produce lighter code but may not work, while "-fPIC"
# should work on all architectures
PIC = @pic@

# librarian
AR = @ar@ -rc
RANLIB = @RANLIB@

#--------------- Caml specifics
# if you do not want the Caml interface you can ignore the following variables
# if you do not know the answers, ask caml with: camlc -v

# Caml library path
CAML_LIBDIR = @caml_libdir@

# Caml compilers, add paths and -I/-ccopt directives if necessary
CAMLC     = @camlc@
CAMLLIBR  = @camllibr@
CAMLMKTOP = @camlmktop@

#--------------- Ocaml specifics
# if you do not want the Ocaml interface you can ignore the following variables
# if you do not know the answers, ask ocaml with: ocamlc -v

# Ocaml library path
OCAML_LIBDIR = @ocaml_libdir@

# Ocaml compilers, add paths and -I/-ccopt directives if necessary
OCAMLC     = @ocamlc@
OCAMLOPT   = @ocamlopt@
OCAMLMKTOP = @ocamlmktop@
OCAMLMKLIB = @ocamlmklib@

#--------------- Pascal compile commands
# PASCAL is the string "gpc "or "fpc"
# PC is the Pascal compiler invocation
# you can add directives if the Pascal compiler or the linker fail to find
# some include files or some libraries.

PASCAL = @pascal@
PC     = @pc@

#--------------- Installation directories

INSTALL_BIN     = @bindir@
INSTALL_LIB     = @libdir@
INSTALL_INCLUDE = @includedir@

# here, you can define language-specific directories if necessary

C_INSTALL_BIN          = $(INSTALL_BIN)
C_INSTALL_LIB          = $(INSTALL_LIB)
C_INSTALL_INCLUDE      = $(INSTALL_INCLUDE)

CAML_INSTALL_BIN       = $(INSTALL_BIN)
CAML_INSTALL_LIB       = $(INSTALL_LIB)
CAML_INSTALL_INCLUDE   = $(INSTALL_INCLUDE)

OCAML_INSTALL_BIN      = $(INSTALL_BIN)
OCAML_INSTALL_LIB      = $(INSTALL_LIB)
OCAML_INSTALL_INCLUDE  = $(INSTALL_INCLUDE)

PASCAL_INSTALL_BIN     = $(INSTALL_BIN)
PASCAL_INSTALL_LIB     = $(INSTALL_LIB)
PASCAL_INSTALL_INCLUDE = $(INSTALL_INCLUDE)

#------------------------- Nothing to change below -------------------

# targets
.PHONY : all lib exemples examples test doc install clean confclean makefiles
all:      lib exemples test
examples: exemples

# version number
NUMERIX_MAJOR = 0
NUMERIX_MINOR = 22

# rewrite the language-specific makefiles
makefiles:
	for i in n c caml ocaml pascal; do \
	  PROCESSOR=$(PROCESSOR) \
	  MAKE_C_LIB=$(MAKE_C_LIB) \
	  MAKE_CAML_LIB=$(MAKE_CAML_LIB) \
	  MAKE_OCAML_LIB=$(MAKE_OCAML_LIB) \
	  MAKE_PASCAL_LIB=$(MAKE_PASCAL_LIB) \
	  USE_CLONG=$(USE_CLONG) \
	  USE_DLONG=$(USE_DLONG) \
	  USE_SLONG=$(USE_SLONG) \
	  USE_GMP=$(USE_GMP) \
	  USE_CAML_BIGNUM=$(USE_CAML_BIGNUM) \
	  USE_OCAML_BIGNUM=$(USE_OCAML_BIGNUM) \
	  OCAMLOPT="$(OCAMLOPT)" \
	  OCAMLMKLIB="$(OCAMLMKLIB)" \
	  PASCAL="$(PASCAL)" \
	  SHARED="$(SHARED)" \
	  kernel/$$i/remake >kernel/$$i/makefile; done

# read the language-specific makefiles
# these files must exist, even if the corresponding interface is unwanted.
include kernel/n/makefile
include kernel/c/makefile
include kernel/caml/makefile
include kernel/ocaml/makefile
include kernel/pascal/makefile

# clean configure files
confclean:
	rm -f config.{status,log} kernel/config.h kernel/*/makefile Makefile
	rm -f doc/*/*.{aux,bmt,log,mtc*,toc,dvi,flc}
	rm -f *~ */*~ */*/*~ */*/*/*~

#-------------------------- end of Makefile ---------------------------
