Commit 5099f5dc authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Do not delete existing rif files.

Instead, add an integer suffix to the file name, e.g.,

  lutin -rif toto.rif (...)

will generate the file toto-2.rif if toto.rif and toto-1.rif already
exist.
parent 69ac49f9
...@@ -31,14 +31,14 @@ ifeq ($(HOST_TYPE),mac) ...@@ -31,14 +31,14 @@ ifeq ($(HOST_TYPE),mac)
CC = gcc -I$(OCAMLLIB) -L $(OCAMLLIB) CC = gcc -I$(OCAMLLIB) -L $(OCAMLLIB)
GMP_INSTALL=/sw GMP_INSTALL=/sw
else else
ifeq ($(HOST_TYPE),i386-cross-win32) ifeq ($(HOST_TYPE),cross-win32)
AR = /usr/bin/i586-mingw32msvc-ar AR = /usr/bin/i586-mingw32msvc-ar
CC = /usr/bin/i586-mingw32msvc-gcc CC = /usr/bin/i586-mingw32msvc-gcc
CC = /usr/bin/i586-mingw32msvc-gcc -I$(OCAMLLIB) -L $(OCAMLLIB) CC = /usr/bin/i586-mingw32msvc-gcc -I$(OCAMLLIB) -L $(OCAMLLIB)
GMP_INSTALL=$(HOME)/$(HOSTTYPE) GMP_INSTALL=$(LURETTE_PATH)/working/$(HOSTTYPE)
else else
CC = gcc CC = gcc
GMP_INSTALL=$(HOME)/$(HOSTTYPE) GMP_INSTALL=$(LURETTE_PATH)/$(HOSTTYPE)
endif endif
endif endif
endif endif
......
...@@ -246,9 +246,19 @@ let mkoptab () = ( ...@@ -246,9 +246,19 @@ let mkoptab () = (
mkopt mkopt
["-rif"] ["-rif"]
~arg:" <string>" ~arg:" <string>"
(Arg.String(function s -> (Arg.String(function s ->
_riffile := Some s; let s = if not (Sys.file_exists s) then s else
Luc2c.option.Luc2c.rif <- Some s let rec find_free_name b i =
let f = Printf.sprintf "%s-%d.rif" b i in
if Sys.file_exists f then
find_free_name b (i+1)
else
f
in
find_free_name (Filename.chop_extension s) 1
in
_riffile := Some s;
Luc2c.option.Luc2c.rif <- Some s
)) ))
["Save the generated data using the RIF format"] ["Save the generated data using the RIF format"]
; ;
......
Supports Markdown
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