Maj terminée. Pour consulter la release notes associée voici le lien :

Commit 1712e9e9 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Change the logic used in the root `Makefile` to deal with Unix and Windows in a uniform way.

parent 2143ce11
......@@ -16,7 +16,11 @@
* When writing a `.cmly` file, open it in binary mode. This should
eliminate the failure that was observed under Windows:
`output_value: not a binary channel`. (Reported by Bryan Phelps.)
`output_value: not a binary channel`. (Reported by Bryan Phelps.
A fix was present in the `mingw` patches for Menhir.)
* Change the logic used in the root `Makefile` to deal with Unix and Windows
in a uniform way. (Also inspired by the `mingw` patches for Menhir.)
* Coq back-end: add a few newlines in the generated file for readability.
(Suggested by Bernhard Schommer.)
......@@ -56,26 +56,15 @@ MLYLIB := src/standard.mly
# ----------------------------------------------------------------------------
# A few settings differ on Windows versus Unix.
# The following incantations should work on both Windows and Unix,
# and allow us to abstract away the differences.
# If the compiler is MSVC, then object file names end in .obj instead of .o.
ifneq (,$(shell ocamlc -config | grep -E "ccomp_type: msvc"))
OBJ := obj
# LIBSUFFIX := lib
OBJ := o
# If we are under Windows (regardless of whether we are using MSVC or mingw)
# then the name of the executable file ends in .exe.
ifeq ($(OS),Windows_NT)
MENHIREXE := menhir.exe
MENHIREXE := menhir
# The extension of object files.
OBJ := $(shell ocamlc -config | sed -n '/^ext_obj:/p' | sed 's/ext_obj: //')
# The extension of executable files.
EXE := $(shell ocamlc -config | sed -n '/^ext_exe:/p' | sed 's/ext_exe: //')
# The OS type.
OS_TYPE := $(shell ocamlc -config | sed -n '/^os_type:/p' | sed 's/os_type: //')
# The path $(installation_libdir), which is recorded in src/ (see
# below), must sometimes be translated using cygpath.
......@@ -92,10 +81,10 @@ endif
# performed if "os_type" is "Win32" or "Win64", and must not be performed if
# "os_type" is "Cygwin" or "Unix".
ifneq (,$(shell ocamlc -config | grep -E "os_type: (Win32|Win64)"))
installation_libdir := $(shell cygpath -m $(libdir))
ifeq ($(OS_TYPE),$(filter $(OS_TYPE),Win32 Win64))
installation_libdir := $(shell cygpath -m $(libdir) || echo $(libdir))
installation_libdir := $(libdir)
installation_libdir := $(libdir)
# -------------------------------------------------------------------------
......@@ -168,7 +157,7 @@ all:
MENHIRLIB := menhirLib.mli menhirLib.cmi menhirLib.cmo
ifneq ($(TARGET),byte)
MENHIRLIB := $(MENHIRLIB) menhirLib.cmx menhirLib.cmxs menhirLib.$(OBJ)
MENHIRLIB := $(MENHIRLIB) menhirLib.cmx menhirLib.cmxs menhirLib$(OBJ)
# -------------------------------------------------------------------------
......@@ -177,7 +166,7 @@ endif
MENHIRSDK := menhirSdk.cmi menhirSdk.cmo
ifneq ($(TARGET),byte)
MENHIRSDK := $(MENHIRSDK) menhirSdk.cmx menhirSdk.cmxs menhirSdk.$(OBJ)
MENHIRSDK := $(MENHIRSDK) menhirSdk.cmx menhirSdk.cmxs menhirSdk$(OBJ)
# ----------------------------------------------------------------------------
......@@ -186,7 +175,7 @@ endif
# Install the executable.
mkdir -p $(bindir)
install $(BUILDDIR)/menhir.$(TARGET) $(bindir)/$(MENHIREXE)
install $(BUILDDIR)/menhir.$(TARGET) $(bindir)/menhir$(EXE)
# Install Menhir's standard library.
mkdir -p $(libdir)
install -m 644 $(MLYLIB) $(libdir)
......@@ -211,12 +200,12 @@ install:
@if `$(bindir)/$(MENHIREXE) --suggest-ocamlfind` ; then \
@if `$(bindir)/menhir$(EXE) --suggest-ocamlfind` ; then \
echo 'Un-installing MenhirLib and MenhirSdk via ocamlfind.' ; \
ocamlfind remove menhirLib ; \
ocamlfind remove menhirSdk ; \
rm -rf $(bindir)/$(MENHIREXE)
rm -rf $(bindir)/menhir$(EXE)
rm -rf $(libdir)
rm -rf $(docdir)
rm -rf $(mandir)/$(MANS)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment