소스 검색

added FD-compatible error messages to Makefile.win

Simon Krajewski 13 년 전
부모
커밋
032a9b3cdf
2개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      Makefile.win
  2. 2 0
      main.ml

+ 6 - 4
Makefile.win

@@ -11,6 +11,8 @@ kill:
 # allow Ocaml/Mingw as well
 NATIVE_LIBS += -I "c:/program files/mingw/lib/"
 
+LINEMERGE_FILTER=sed -n "/^File/!{H; bp; b; }; /^File/ bp; :p; { x; s/\n/ /g; p; }"
+
 # use make MSVC=1 -f Makefile.win to build for OCaml/MSVC
 # this will also convert the error messages to Visual Studio output format
 
@@ -20,11 +22,11 @@ MSVC_OUTPUT=1
 endif
 
 ifeq (${MSVC_OUTPUT}, 1)
-FILTER=sed 's/File "\([^"]\+\)", line \([0-9]\+\), \(.*\)/\1(\2): \3/' tmp.cmi
-CC_CMD=($(OCAMLOPT) $(CFLAGS) -c $< 2>tmp.cmi && $(FILTER)) || ($(FILTER) && exit 1)
-CC_PARSER_CMD=($(OCAMLOPT) -pp camlp4o $(CFLAGS) -c parser.ml 2>tmp.cmi && $(FILTER)) || ($(FILTER) && exit 1)
+FILTER=sed "s/File \"\(.*\?\)\", line \([0-9]\+\), \(.*\)/\1(\2): \3/"
+CC_CMD=$(OCAMLOPT) $(CFLAGS) -c $< 2>&1 | $(LINEMERGE_FILTER) | $(FILTER) 1>&2
+CC_PARSER_CMD=$(OCAMLOPT) -pp camlp4o $(CFLAGS) -c parser.ml 2>&1 | $(LINEMERGE_FILTER) | $(FILTER) 1>&2
 endif
 
 ifeq (${FD_OUTPUT}, 1)
-FILTER=sed '/File/{ N; s/File "\([^"]\+\)", line \([0-9]\+\), characters \([0-9-]\+\):[\r\n]*\(.*\)/\1:\2: characters \3 : \4/ }' tmp.cmi
+FILTER=sed "s/File \"\(.*\?\)\", line \([0-9]\+\), characters \([0-9-]\+\):\(.*\)/\1:\2: characters \3 : \4/"
 endif

+ 2 - 0
main.ml

@@ -21,6 +21,8 @@ open Genswf
 open Common
 open Type
 
+let _ = 0 = ""
+
 type context = {
 	com : Common.context;
 	mutable flush : unit -> unit;