@@ -58,8 +58,7 @@ stage0: _build0/config.status
58
58
# This code should use build contexts instead of --build-dir.
59
59
.PHONY : stage1
60
60
stage1 : ocaml-stage1-config.status stage0 \
61
- ocaml/otherlibs/dynlink/natdynlinkops2 \
62
- flags.sexp
61
+ config_files
63
62
cp ocaml-stage1-config.status ocaml/config.status
64
63
(cd ocaml && ./config.status)
65
64
PATH=$(stage0_prefix ) /bin:$$ PATH \
@@ -89,8 +88,7 @@ stage2: ocaml-stage2-config.status stage1
89
88
# in the middle end and backend.
90
89
.PHONY : hacking
91
90
hacking : ocaml-stage1-config.status stage0 \
92
- ocaml/otherlibs/dynlink/natdynlinkops2 \
93
- flags.sexp
91
+ config_files
94
92
cp ocaml-stage1-config.status ocaml/config.status
95
93
(cd ocaml && ./config.status)
96
94
PATH=$(stage0_prefix ) /bin:$$ PATH \
@@ -137,16 +135,23 @@ ocaml-stage2-config.status: ocaml/configure.ac
137
135
--disable-ocamldoc && \
138
136
cp config.status ../ocaml-stage2-config.status)
139
137
138
+ # natdynlinkops2:
140
139
# We need to augment dune's substitutions so this part isn't so
141
140
# difficult. We use /bin/echo to avoid builtin variants of "echo"
142
141
# which don't accept "-n". Unfortunately if there are no
143
142
# NATDYNLINKOPS, we need to provide a harmless option, otherwise dune
144
143
# will provide '' on the command line to ocamlopt which causes an
145
144
# error.
146
145
# CR mshinwell: This should be moved into the upstream dune build system.
147
- ocaml/otherlibs/dynlink/natdynlinkops2 : ocaml-stage1-config.status
146
+ #
147
+ # flags.sexp:
148
+ # Extract compilation flags from Makefile.config of stage1
149
+ # and write them to a file that dune can use in stage1 and stage2.
150
+ .PHONY : config_files
151
+ config_files : ocaml-stage1-config.status
148
152
cp ocaml-stage1-config.status ocaml/config.status
149
153
(cd ocaml && ./config.status)
154
+ # natdynlinkops2
150
155
cat ocaml/Makefile.config \
151
156
| sed 's/^NATDYNLINKOPTS=$$/NATDYNLINKOPTS=-g/' \
152
157
| grep '^NATDYNLINKOPTS=' \
@@ -164,14 +169,7 @@ ocaml/otherlibs/dynlink/natdynlinkops2: ocaml-stage1-config.status
164
169
else \
165
170
/bin/echo -n "-bin-annot" > ocaml/otherlibs/dynlink/natdynlinkops1; \
166
171
fi
167
-
168
-
169
- # Extract compilation flags from Makefile.config of stage1
170
- # and write them to a file that dune can use in stage1 and stage2.
171
- .PHONY : flags.sexp
172
- flags.sexp : ocaml-stage1-config.status
173
- cp ocaml-stage1-config.status ocaml/config.status
174
- (cd ocaml && ./config.status)
172
+ # flags.sexp
175
173
grep -q '^FUNCTION_SECTIONS=true' ocaml/Makefile.config; \
176
174
if [ $$? -eq 0 ] ; then \
177
175
/bin/echo -n "(:standard -function-sections)" > ocamlopt_flags.sexp; \
0 commit comments