summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Dolan <sdolan@janestreet.com>2019-05-22 15:57:01 +0100
committerStephen Dolan <sdolan@janestreet.com>2019-05-27 13:24:41 +0100
commit35ea7eb9a44249285b80b963841cf0a609562f1e (patch)
treed6f9df01272268e0576287910253c13cd5a2ee0d
parent455bd0ffae85a9b63cb331ac532ea2ab52fe418c (diff)
downloadocaml-35ea7eb9a44249285b80b963841cf0a609562f1e.tar.gz
Avoid rebuilding the world when files containing primitives change.
-rw-r--r--.gitignore1
-rw-r--r--Changes3
-rw-r--r--runtime/Makefile13
3 files changed, 9 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 513a270404..2ae570771c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -177,6 +177,7 @@ _build
/runtime/caml/m.h
/runtime/caml/s.h
/runtime/primitives
+/runtime/primitives.new
/runtime/prims.c
/runtime/caml/opnames.h
/runtime/caml/version.h
diff --git a/Changes b/Changes
index ade9a86b04..372d7a4ba1 100644
--- a/Changes
+++ b/Changes
@@ -54,6 +54,9 @@ Working version
revise generation of config/util.ml to better quote special characters
(Xavier Leroy, review by David Allsopp)
+- #8690: avoid rebuilding the world when files containing primitives change.
+ (Stephen Dolan, review by ??)
+
### Bug fixes:
- #8622: Don't generate #! headers over 127 characters.
diff --git a/runtime/Makefile b/runtime/Makefile
index c50e521a3f..a62fb26752 100644
--- a/runtime/Makefile
+++ b/runtime/Makefile
@@ -20,11 +20,6 @@ include $(ROOTDIR)/Makefile.common
# Lists of source files
-PRIMS := $(addsuffix .c, \
- alloc array compare extern floats gc_ctrl hash intern interp ints io \
- lexing md5 meta memprof obj parsing signals str sys callback weak finalise \
- stacks dynlink backtrace_byt backtrace spacetime_byt afl bigarray)
-
BYTECODE_C_SOURCES := $(addsuffix .c, \
interp misc stacks fix_code startup_aux startup_byt freelist major_gc \
minor_gc memory alloc roots_byt globroots fail_byt signals \
@@ -238,9 +233,11 @@ ld.conf: $(ROOTDIR)/Makefile.config
# see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html:
# "using sort to process pathnames, it is recommended that LC_ALL .. set to C"
-
-primitives : $(PRIMS)
- ./gen_primitives.sh >$@
+# To speed up builds, we avoid changing "primitives" when files
+# containing primitives change but the primitives table does not
+primitives: $(shell ./gen_primitives.sh > primitives.new; \
+ cmp -s primitives primitives.new || echo primitives.new)
+ cp $^ $@
prims.c : primitives
(echo '#define CAML_INTERNALS'; \