Skip to content

Commit 25dd149

Browse files
authored
Speed up compile time for dev builds (oxcaml#2304)
* fix warning * add --enable-dev-build * rename flag to --enable-dev
1 parent 8d5f840 commit 25dd149

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

Makefile.config.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dune = @dune@
33
middle_end = @middle_end@
44
coverage = @coverage@
55
legacy_layout = @legacy_layout@
6+
main_build_profile = @main_build_profile@

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,20 @@ AC_ARG_ENABLE([legacy-library-layout],
6666
[legacy_layout=yes],
6767
[legacy_layout=no])
6868

69+
AC_ARG_ENABLE([dev],
70+
[AS_HELP_STRING([--enable-dev],
71+
[Use the dev build profile for dune when building the 2nd stage.
72+
Can speed up the compile time by a lot. (WARNING: do not use for
73+
production compiler deployments)])],
74+
[main_build_profile=dev],
75+
[main_build_profile=main])
76+
6977
AC_SUBST([prefix])
7078
AC_SUBST([middle_end])
7179
AC_SUBST([dune])
7280
AC_SUBST([coverage])
7381
AC_SUBST([legacy_layout])
82+
AC_SUBST([main_build_profile])
7483

7584
# Don't error on options that this configure script doesn't understand but
7685
# the ocaml/ one does.

native_toplevel/opttoploop.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type directive_info = {
9494

9595
let remembered = ref Ident.empty
9696

97-
let rec remember phrase_name signature =
97+
let remember phrase_name signature =
9898
let exported = List.filter Includemod.is_runtime_component signature in
9999
List.iteri (fun i sg ->
100100
match sg with

ocaml/Makefile.common-jst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ define dune_main_context
4242
(lang dune 2.8)
4343
(context (default
4444
(name main)
45-
(profile main)
45+
(profile $(main_build_profile))
4646
(paths
4747
(PATH ("$(CURDIR)/_build/_bootinstall/bin" :standard))
4848
(OCAMLLIB ("$(CURDIR)/_build/install/runtime_stdlib/lib/ocaml_runtime_stdlib")))

tools/merge_archives.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ let merge_cmxa0 ~archives =
8080
incr ncmxs
8181
end));
8282
let cmis = Array.make !ncmis Import_info.dummy in
83-
Hashtbl.iter (fun name (import, i) -> cmis.(i) <- import) cmi_table;
83+
Hashtbl.iter (fun _name (import, i) -> cmis.(i) <- import) cmi_table;
8484
let cmxs = Array.make !ncmxs Import_info.dummy in
85-
Hashtbl.iter (fun name (import, i) -> cmxs.(i) <- import) cmx_table;
85+
Hashtbl.iter (fun _name (import, i) -> cmxs.(i) <- import) cmx_table;
8686
let genfns = Generic_fns.Tbl.make () in
8787
let _, lib_units, lib_ccobjs, lib_ccopts =
8888
List.fold_left

0 commit comments

Comments
 (0)