#! /bin/sh
# remake: reconstitue le fichier Makefile

cat <<EOF
#-------------------- file generated by remake -----------------------

# configure options are stored in the [numconf] file. If you edit
# manually [numconf] then you need to update the compilation rules with
# the command:
#
# make -f numconf makerules
#
include numconf

lib:      k_lib   c_lib      caml_lib      ocaml_lib      pascal_lib
exemples:         c_exemples caml_exemples ocaml_exemples pascal_ex
test:             c_test     caml_test     ocaml_test     pascal_test
install:          c_install  caml_install  ocaml_install  pascal_install
clean:    k_clean c_clean    caml_clean    ocaml_clean    pascal_clean   doc_clean

examples: exemples
realclean: clean
	rm config.* numconf Makefile
	find -name \*~ | xargs -r rm

# add options for GCC
NUMGCC = \$(GCC) -Dbits_\$(BITS) -Duseless_init

# documentation
.PHONY : doc_clean
doc: doc/numerix.ps doc/numerix-eng.ps
doc/numerix.ps: doc/numerix.tex
	cd doc; latex numerix; latex numerix; dvips numerix
doc/numerix-eng.ps: doc/numerix-eng.tex
	cd doc; latex numerix-eng; latex numerix-eng; dvips numerix-eng
doc_clean:
	rm doc/*.log doc/*.dvi doc/*.aux doc/*.toc || /bin/true

EOF

USE_CLONG=$USE_CLONG \
USE_DLONG=$USE_DLONG \
USE_SLONG=$USE_SLONG config/makefile.kernel

USE_CLONG=$USE_CLONG \
USE_DLONG=$USE_DLONG \
USE_SLONG=$USE_SLONG \
USE_GMP=$USE_GMP \
MAKE_C_LIB=$MAKE_C_LIB config/makefile.clib

USE_CLONG=$USE_CLONG \
USE_DLONG=$USE_DLONG \
USE_SLONG=$USE_SLONG \
USE_GMP=$USE_GMP \
USE_BIGNUM=$USE_CAML_BIGNUM \
MAKE_CAML_LIB=$MAKE_CAML_LIB \
CAML_VERSION=$CAML_VERSION config/makefile.caml

USE_CLONG=$USE_CLONG \
USE_DLONG=$USE_DLONG \
USE_SLONG=$USE_SLONG \
USE_GMP=$USE_GMP \
USE_BIGNUM=$USE_OCAML_BIGNUM \
MAKE_OCAML_LIB=$MAKE_OCAML_LIB \
OCAML_VERSION=$OCAML_VERSION config/makefile.ocaml

USE_CLONG=$USE_CLONG \
USE_DLONG=$USE_DLONG \
USE_SLONG=$USE_SLONG \
MAKE_PASCAL_LIB=$MAKE_PASCAL_LIB config/makefile.pascal
