Skip to content

Commit 759bd60

Browse files
committed
configure: make sure ocamlbuild_config.ml is rebuilt/PHONY
The configuration file depends on the current git state, so we should build it at least as often as the user requests it with 'make configure'.
1 parent a282216 commit 759bd60

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

Makefile

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,28 @@ beforedepend:: src/glob_lexer.ml
173173

174174
# The config file
175175

176-
configure: Makefile.config src/ocamlbuild_config.ml
177-
178-
Makefile.config src/ocamlbuild_config.ml: configure.make
176+
# we mark only the 'configure' rule PHONY,
177+
# not individual CONF_FILES, as all OCamlbuild
178+
# sources depend on ocamlbuild_config.ml,
179+
# so it would rebuild from scratch each time.
180+
#
181+
# The reason for marking PHONY is to let the user
182+
# explicitly re-configure; the --version answer
183+
# depends on the state of the git repository, so
184+
# it may change at any time.
185+
.PHONY: configure
186+
187+
CONF_FILES=Makefile.config src/ocamlbuild_config.ml
188+
configure:
189+
$(MAKE) -f configure.make $(CONF_FILES)
190+
191+
$(CONF_FILES):
179192
$(MAKE) -f configure.make $@
180193

181194
clean::
182-
rm -f Makefile.config src/ocamlbuild_config.ml
195+
rm -f $(CONF_FILES)
183196

184-
beforedepend:: src/ocamlbuild_config.ml
197+
beforedepend:: Makefile.config
185198

186199
# Installation
187200

configure.make

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ Makefile.config:
8383
echo "LIBDIR=$(OCAMLBUILD_LIBDIR)"; \
8484
) > $@
8585

86+
# the configuration file depends on the git environment,
87+
# so it should be rebuilt each time
88+
.PHONY: src/ocamlbuild_config.ml
89+
8690
src/ocamlbuild_config.ml:
8791
(echo "(* This file was generated from ../configure.make *)"; \
8892
echo ;\

0 commit comments

Comments
 (0)