From: Kim Nguyễn Date: Fri, 4 Mar 2016 16:29:16 +0000 (+0100) Subject: Merge branch 'ocamlbuild-port' of ssh://git.nguyen.vg/tatoo into ocamlbuild-port X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=commitdiff_plain;h=3fadb034bfc0075d420bdd1383214014500501b8;hp=-c Merge branch 'ocamlbuild-port' of ssh://git.nguyen.vg/tatoo into ocamlbuild-port --- 3fadb034bfc0075d420bdd1383214014500501b8 diff --combined Makefile.in index 8da1e31,5d29eb8..f2df8d4 --- a/Makefile.in +++ b/Makefile.in @@@ -1,22 -1,27 +1,26 @@@ CAMLP4FLAGS=@CAMLP4FLAGS@ -PPOPTSFLAGS= $($CAMLP4FLAGS:%=ppopt(%)) -OCAMLBUILDFLAGS=-j 0 -use-ocamlfind @OCAMLBUILDFLAGS@ +OCAMLBUILDFLAGS=-j 0 -use-ocamlfind @OCAMLBUILDFLAGS@ $(CAMLP4FLAGS:%=-tag %) OCAMLBUILD=@OCAMLBUILD@ PACKAGE = @PACKAGE_TARNAME@ - TARGETS=tatoo.native + NATIVE=$(PACKAGE).native + BYTE=$(PACKAGE).byte + TARGETS=$(NATIVE) + ifeq ($(BYTE), true) - TARGETS += tatoo.byte + TARGETS += $(BYTE) endif + INLINE=@INLINE@ - TAGS= inline($INLINE) + TAGS= -tag 'inline($(INLINE))' - .PHONY: clean distclean + .PHONY: clean distclean test test_byte test_native do_test all $(TARGETS) - all: $(TARGETS) + all: @ %: - @ $(OCAMLBUILD) $(OCAMLBUILDFLAGS) $(TAGS) $(PPOPTFLAGS:%=-tag %) $@ + @ $(OCAMLBUILD) $(OCAMLBUILDFLAGS) $@ clean: @ $(OCAMLBUILD) $(OCAMLBUILDFLAGS) -clean @@@ -24,13 -29,20 +28,20 @@@ distclean: clean @ rm -rf configure config.log config.status autom4te.cache Makefile - %.summary: - target=$@ \ - base=$* \ - test=$${base#*.xml.} \ - xml=$${base%.$$test} \ - BIN=$(TEST) \ - SPLIT=tools/split_path.native \ - XMLDIFF=tools/xml_diff.native \ - PACKAGE=$(PACKAGE) \ - . tests/$${test}.sh + + test: + ${MAKE} test_native + ${MAKE} test_byte + + test_native: PROG=$(NATIVE) + test_native: $(NATIVE) do_test + + test_byte: PROG=$(BYTE) + test_byte: $(BYTE) do_test + + + do_test: + for test in tests/test_*.sh ; \ + do \ + $${test} $(PROG) tests ; \ + done diff --combined myocamlbuild.ml index 7f86523,3b3e516..dbc0a45 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@@ -1,26 -1,16 +1,28 @@@ - open Ocamlbuild_plugin ;; + open Ocamlbuild_plugin + let includes = + let open Pathname in + let d = Array.to_list (readdir "include") in + List.map (concat "include") d - let includes = [ "include/utils.ml"; "include/utils32.ml"; "include/utils64.ml"; "include/debug.ml" ] +let ml_str_rule () = + rule ".ml.str" ~dep:"%.ml.str" ~prod:"%.ml" + (fun env _ -> + let mlstr = env "%.ml.str" and ml = env "%.ml" in + let cmd = Printf.sprintf "echo -n 'let content = \"' > %s ;\ + sed -e 's/\\([\"\\\\]\\)/\\\\\\1/g' %s | sed -e 's/^\\(.*\\)$/\\1\\\\n\\\\/g' >> %s ;\ + echo '' >> %s ;\ + echo '\"' >> %s" ml mlstr ml ml ml + in + Cmd ( Sh cmd )) + let () = - dispatch begin function + dispatch (function | After_rules -> dep ["ocaml";"compile";] includes; dep ["ocaml";"ocamldep"; ] includes; - pflag ["ocaml";"compile";] "ppopt" (fun s -> S [A"-ppopt"; A (s)]); + pflag ["ocaml";"compile";] "ppopt" (fun s -> S [A"-ppopt"; A (s)]); pflag ["ocaml";"ocamldep";] "ppopt" (fun s -> S [A"-ppopt"; A (s)]); + ml_str_rule () | _ -> () - - end;; + )