Set the obj_dir for executables

This commit is contained in:
Jeremie Dimino 2018-02-07 12:31:44 +00:00
parent 0f0c0c2997
commit b17b476048
11 changed files with 44 additions and 42 deletions

View File

@ -728,7 +728,9 @@ Add it to your jbuild file to remove this warning.
let executables_rules (exes : Executables.t) ~dir ~all_modules
~(scope : Lib_db.Scope.t With_required_by.t) =
let item = List.hd exes.names in
let obj_dir = dir in
(* Use "eobjs" rather than "objs" to avoid a potential conflict with a library of the
same name *)
let obj_dir = Path.relative dir ("." ^ item ^ ".eobjs") in
let dep_kind = Build.Required in
let flags = Ocaml_flags.make exes.buildable sctx ~scope:scope.data ~dir in
let modules =

View File

@ -5,9 +5,9 @@
ocamldep q/q.mli.d
ocamlmklib q/dllq_stubs.so,q/libq_stubs.a
ocamlc q/.q.objs/q.{cmi,cmti}
ocamlc qnativerun/run.{cmi,cmo,cmt}
ocamlc qnativerun/.run.eobjs/run.{cmi,cmo,cmt}
ocamlopt q/.q.objs/q.{cmx,o}
ocamlopt qnativerun/run.{cmx,o}
ocamlopt qnativerun/.run.eobjs/run.{cmx,o}
ocamlopt q/q.{a,cmxa}
ocamlopt qnativerun/run.exe
42

View File

@ -6,12 +6,12 @@
ocamlc bar.o
ocamlc .foo.objs/dummy.{cmi,cmo,cmt}
ocamlmklib dllfoo_stubs.so,libfoo_stubs.a
ocamlc lexer1.{cmi,cmo,cmt}
ocamlc .test.eobjs/lexer1.{cmi,cmo,cmt}
ocamlopt .foo.objs/dummy.{cmx,o}
ocamlc test.{cmi,cmo,cmt}
ocamlopt lexer1.{cmx,o}
ocamlc .test.eobjs/test.{cmi,cmo,cmt}
ocamlopt .test.eobjs/lexer1.{cmx,o}
ocamlopt foo.{a,cmxa}
ocamlopt test.{cmx,o}
ocamlopt .test.eobjs/test.{cmx,o}
ocamlopt test.exe
$ $JBUILDER build -j1 @bar-source --display short --root .
#line 1 "include/bar.h"

View File

@ -5,16 +5,16 @@
ocamlc lib/.p.objs/p.{cmi,cmo,cmt} [default.foo]
ocamldep lib/p.ml.d
ocamlopt lib/.p.objs/p.{cmx,o} [default.foo]
ocamlc bin/blah.{cmi,cmo,cmt} [default.foo]
ocamlc bin/.blah.eobjs/blah.{cmi,cmo,cmt} [default.foo]
ocamlc lib/p.cma [default.foo]
ocamlc lib/.p.objs/p.{cmi,cmo,cmt}
ocamlopt lib/p.{a,cmxa} [default.foo]
ocamlopt bin/blah.{cmx,o} [default.foo]
ocamlc bin/blah.{cmi,cmo,cmt}
ocamlopt bin/.blah.eobjs/blah.{cmx,o} [default.foo]
ocamlc bin/.blah.eobjs/blah.{cmi,cmo,cmt}
ocamlopt lib/.p.objs/p.{cmx,o}
ocamlopt lib/p.cmxs [default.foo]
ocamlopt bin/blah.exe [default.foo]
ocamlopt bin/blah.{cmx,o}
ocamlopt bin/.blah.eobjs/blah.{cmx,o}
ocamlopt lib/p.{a,cmxa}
ocamlopt bin/blah.exe
blah file [default.foo]

View File

@ -4,13 +4,13 @@
[1]
$ $JBUILDER exec ./foo.exe -j1 --display short --root .
ocamldep foo.ml.d
ocamlc foo.{cmi,cmo,cmt}
ocamlopt foo.{cmx,o}
ocamlc .foo.eobjs/foo.{cmi,cmo,cmt}
ocamlopt .foo.eobjs/foo.{cmx,o}
ocamlopt foo.exe
Foo
$ $JBUILDER exec --dev ./foo.exe -j1 --display short --root .
ocamlc foo.{cmi,cmo,cmt}
ocamlopt foo.{cmx,o}
ocamlc .foo.eobjs/foo.{cmi,cmo,cmt}
ocamlopt .foo.eobjs/foo.{cmx,o}
ocamlopt foo.exe
Foo
$ $JBUILDER exec bar --no-build -j1 --display short --root .
@ -18,7 +18,7 @@
[1]
$ $JBUILDER exec bar -j1 --display short --root .
ocamldep bar.ml.d
ocamlc bar.{cmi,cmo,cmt}
ocamlopt bar.{cmx,o}
ocamlc .bar.eobjs/bar.{cmi,cmo,cmt}
ocamlopt .bar.eobjs/bar.{cmx,o}
ocamlopt bar.exe
Bar

View File

@ -1,8 +1,8 @@
$ $JBUILDER clean -j1 --display short --root .
$ $JBUILDER runtest -j1 --display short --root .
ocamldep f.ml.d
ocamlc f.{cmi,cmo,cmt}
ocamlopt f.{cmx,o}
ocamlc .f.eobjs/f.{cmi,cmo,cmt}
ocamlopt .f.eobjs/f.{cmx,o}
ocamlopt f.exe
f alias runtest
Foo Bar

View File

@ -6,10 +6,10 @@
ocamlc .foo.objs/foo.{cmi,cmo,cmt}
ocamlc foo_byte.cma
ocamlopt .foo.objs/foo.{cmx,o}
ocamlc bar.{cmi,cmo,cmt}
ocamlc .bar.eobjs/bar.{cmi,cmo,cmt}
ocamlc foo.cma
ocamlopt foo.{a,cmxa}
ocamlopt bar.{cmx,o}
ocamlopt .bar.eobjs/bar.{cmx,o}
ocamlopt foo.cmxs
ocamlopt bar.exe
lib: [

View File

@ -10,14 +10,14 @@
ocamldep src/test_menhir1.ml.d
ocamldep src/test_menhir1.mli.d
ocamldep src/test_base.mli.d
ocamlc src/test_menhir1.{cmi,cmti}
ocamlc src/test_base.{cmi,cmti}
ocamlc src/lexer1.{cmi,cmo,cmt}
ocamlopt src/test_menhir1.{cmx,o}
ocamlc src/lexer2.{cmi,cmo,cmt}
ocamlopt src/test_base.{cmx,o}
ocamlopt src/lexer1.{cmx,o}
ocamlc src/test.{cmi,cmo,cmt}
ocamlopt src/lexer2.{cmx,o}
ocamlopt src/test.{cmx,o}
ocamlc src/.test.eobjs/test_menhir1.{cmi,cmti}
ocamlc src/.test.eobjs/test_base.{cmi,cmti}
ocamlc src/.test.eobjs/lexer1.{cmi,cmo,cmt}
ocamlopt src/.test.eobjs/test_menhir1.{cmx,o}
ocamlc src/.test.eobjs/lexer2.{cmi,cmo,cmt}
ocamlopt src/.test.eobjs/test_base.{cmx,o}
ocamlopt src/.test.eobjs/lexer1.{cmx,o}
ocamlc src/.test.eobjs/test.{cmi,cmo,cmt}
ocamlopt src/.test.eobjs/lexer2.{cmx,o}
ocamlopt src/.test.eobjs/test.{cmx,o}
ocamlopt src/test.exe

View File

@ -6,15 +6,15 @@
ocamlopt .ppx/fooppx@/ppx.exe
ppx w_omp_driver.pp.ml
ocamldep w_omp_driver.pp.ml.d
ocamlc w_omp_driver.{cmi,cmo,cmt}
ocamlopt w_omp_driver.{cmx,o}
ocamlc .w_omp_driver.eobjs/w_omp_driver.{cmi,cmo,cmt}
ocamlopt .w_omp_driver.eobjs/w_omp_driver.{cmx,o}
ocamlopt w_omp_driver.exe
$ $JBUILDER build ./w_ppx_driver.exe -j1 --display short --root .
ocamlopt .ppx/ppx_driver.runner/ppx.exe
ppx w_ppx_driver.pp.ml
ocamldep w_ppx_driver.pp.ml.d
ocamlc w_ppx_driver.{cmi,cmo,cmt}
ocamlopt w_ppx_driver.{cmx,o}
ocamlc .w_ppx_driver.eobjs/w_ppx_driver.{cmi,cmo,cmt}
ocamlopt .w_ppx_driver.eobjs/w_ppx_driver.{cmx,o}
ocamlopt w_ppx_driver.exe
This test is broken because ppx_driver doesn't support migrate custom arguments
# $ $JBUILDER build ./w_ppx_driver_flags.exe -j1 --display short --root .

View File

@ -6,12 +6,12 @@
ocamldep foo_fake.ml.d
ocamldep foo_no_fake.ml.d
ocamldep main.ml.d
ocamlc bar.{cmi,cmo,cmt}
ocamlc foo.{cmi,cmo,cmt}
ocamlopt bar.{cmx,o}
ocamlopt foo.{cmx,o}
ocamlc main.{cmi,cmo,cmt}
ocamlopt main.{cmx,o}
ocamlc .main.eobjs/bar.{cmi,cmo,cmt}
ocamlc .main.eobjs/foo.{cmi,cmo,cmt}
ocamlopt .main.eobjs/bar.{cmx,o}
ocamlopt .main.eobjs/foo.{cmx,o}
ocamlc .main.eobjs/main.{cmi,cmo,cmt}
ocamlopt .main.eobjs/main.{cmx,o}
ocamlopt main.exe
main alias runtest
bar has unix

View File

@ -2,7 +2,7 @@
ocamldep forutop/.utop/utop.ml.d
ocamldep forutop/forutop.ml.d
ocamlc forutop/.forutop.objs/forutop.{cmi,cmo,cmt}
ocamlc forutop/.utop/utop.{cmi,cmo,cmt}
ocamlc forutop/.utop/.utop.eobjs/utop.{cmi,cmo,cmt}
ocamlc forutop/forutop.cma
ocamlc forutop/.utop/utop.exe
hello in utop