diff --git a/.gitignore b/.gitignore index 6ee9be0..9b60f89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.a +*.lib *.cm? *.cmxa *.cmxs @@ -6,7 +7,9 @@ *.exe *.byt *.o +*.obj *.so -Makefile +*.dll +Makefile.config depend zarith_version.ml diff --git a/project.mak b/Makefile similarity index 87% rename from project.mak rename to Makefile index 3d5a837..d795e60 100644 --- a/project.mak +++ b/Makefile @@ -10,23 +10,7 @@ # ENS (École normale supérieure, Paris, France), # INRIA Rocquencourt (Institut national de recherche en informatique, France). -ifeq "$(shell $(OCAMLC) -config |grep ccomp_type)" "ccomp_type: msvc" -OBJSUFFIX := obj -LIBSUFFIX := lib -DLLSUFFIX := dll -EXE := .exe -else -OBJSUFFIX := o -LIBSUFFIX := a -ifeq "$(findstring mingw,$(shell $(OCAMLC) -config |grep system))" "mingw" -DLLSUFFIX := dll -EXE := .exe -else -DLLSUFFIX := so -EXE := -endif -endif - +include Makefile.config # project files ############### @@ -145,7 +129,7 @@ endif $(OCAMLC) -ccopt "$(CFLAGS)" -c $< clean: - /bin/rm -rf *.$(OBJSUFFIX) *.$(LIBSUFFIX) *.$(DLLSUFFIX) *.cmi *.cmo *.cmx *.cmxa *.cmxs *.cma *.cmt *.cmti *~ \#* depend test $(AUTOGEN) tmp.c depend + /bin/rm -rf *.o *.obj *.lib *.a *.cmi *.cmo *.cmx *.cmxa *.cmxs *.cma *.cmt *.cmti *~ \#* depend test $(AUTOGEN) tmp.c depend make -C tests clean depend: $(AUTOGEN) diff --git a/configure b/configure index 76b997f..d8dbb51 100755 --- a/configure +++ b/configure @@ -34,7 +34,6 @@ ccdef='' mlflags="$OCAMLFLAGS" mloptflags="$OCAMLOPTFLAGS" mlinc="$OCAMLINC" -objsuffix="o" ocamlfind="auto" # sanitize @@ -209,6 +208,30 @@ else ccopt="-O3 -Wall -Wextra $CFLAGS" fi +case "$("$ocamlc" -config | tr -d '\r' | sed -ne '/^system:/s/.*: //p')" in + win32|win64) + # MSVC + objsuffix='obj' + libsuffix='lib' + dllsuffix='dll' + exe='.exe' + ;; + mingw|mingw64) + # mingw-w64 + objsuffix='o' + libsuffix='a' + dllsuffix='dll' + exe='.exe' + ;; + *) + # Unix + objsuffix='o' + libsuffix='a' + dllsuffix='so' + exe='' + ;; +esac + # optional native-code generation hasocamlopt='no' @@ -231,7 +254,7 @@ fi # directories if test "$ocamllibdir" = "auto" -then ocamllibdir=`ocamlc -where | sed 's/\r$//'` +then ocamllibdir="$(ocamlc -where | tr -d '\r')" fi if test ! -f "$ocamllibdir/caml/mlvalues.h" @@ -258,7 +281,7 @@ searchbin ocamlfind if test $? -eq 1 && test $ocamlfind != "no"; then instmeth='findlib' if test "$installdir" = "auto" - then installdir=`ocamlfind printconf destdir`; fi + then installdir="$(ocamlfind printconf destdir | tr -d '\r')"; fi else searchbin install if test $? -eq 1; then instmeth='install' @@ -270,7 +293,7 @@ fi # detect OCaml's word-size echo "print_int (Sys.word_size);;" > tmp.ml -wordsize=`ocaml tmp.ml` +wordsize="$(ocaml tmp.ml)" echo "OCaml's word size is $wordsize" rm -f tmp.ml @@ -312,7 +335,7 @@ if test "$gmp" != 'OK'; then echo "cannot find GMP nor MPIR"; exit 2; fi # OCaml version -ocamlver=`ocamlc -version` +ocamlver="$(ocamlc -version)" # OCaml version 4.04 or later is required @@ -340,7 +363,7 @@ esac # dump Makefile -cat > Makefile < Makefile.config <