Skip to content

Commit

Permalink
Fix parallel make (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
lthls authored Jun 29, 2021
1 parent ebce94c commit 2846c72
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ stage0: _build0/config.status
# This code should use build contexts instead of --build-dir.
.PHONY: stage1
stage1: ocaml-stage1-config.status stage0 \
ocaml/otherlibs/dynlink/natdynlinkops2 \
flags.sexp
config_files
cp ocaml-stage1-config.status ocaml/config.status
(cd ocaml && ./config.status)
PATH=$(stage0_prefix)/bin:$$PATH \
Expand Down Expand Up @@ -89,8 +88,7 @@ stage2: ocaml-stage2-config.status stage1
# in the middle end and backend.
.PHONY: hacking
hacking: ocaml-stage1-config.status stage0 \
ocaml/otherlibs/dynlink/natdynlinkops2 \
flags.sexp
config_files
cp ocaml-stage1-config.status ocaml/config.status
(cd ocaml && ./config.status)
PATH=$(stage0_prefix)/bin:$$PATH \
Expand Down Expand Up @@ -137,16 +135,23 @@ ocaml-stage2-config.status: ocaml/configure.ac
--disable-ocamldoc && \
cp config.status ../ocaml-stage2-config.status)

# natdynlinkops2:
# We need to augment dune's substitutions so this part isn't so
# difficult. We use /bin/echo to avoid builtin variants of "echo"
# which don't accept "-n". Unfortunately if there are no
# NATDYNLINKOPS, we need to provide a harmless option, otherwise dune
# will provide '' on the command line to ocamlopt which causes an
# error.
# CR mshinwell: This should be moved into the upstream dune build system.
ocaml/otherlibs/dynlink/natdynlinkops2: ocaml-stage1-config.status
#
# flags.sexp:
# Extract compilation flags from Makefile.config of stage1
# and write them to a file that dune can use in stage1 and stage2.
.PHONY: config_files
config_files: ocaml-stage1-config.status
cp ocaml-stage1-config.status ocaml/config.status
(cd ocaml && ./config.status)
# natdynlinkops2
cat ocaml/Makefile.config \
| sed 's/^NATDYNLINKOPTS=$$/NATDYNLINKOPTS=-g/' \
| grep '^NATDYNLINKOPTS=' \
Expand All @@ -164,14 +169,7 @@ ocaml/otherlibs/dynlink/natdynlinkops2: ocaml-stage1-config.status
else \
/bin/echo -n "-bin-annot" > ocaml/otherlibs/dynlink/natdynlinkops1; \
fi


# Extract compilation flags from Makefile.config of stage1
# and write them to a file that dune can use in stage1 and stage2.
.PHONY: flags.sexp
flags.sexp: ocaml-stage1-config.status
cp ocaml-stage1-config.status ocaml/config.status
(cd ocaml && ./config.status)
# flags.sexp
grep -q '^FUNCTION_SECTIONS=true' ocaml/Makefile.config; \
if [ $$? -eq 0 ] ; then \
/bin/echo -n "(:standard -function-sections)" > ocamlopt_flags.sexp; \
Expand Down

0 comments on commit 2846c72

Please sign in to comment.