Skip to content

Commit

Permalink
configure: make sure ocamlbuild_config.ml is rebuilt/PHONY
Browse files Browse the repository at this point in the history
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'.
  • Loading branch information
gasche committed Feb 22, 2016
1 parent a282216 commit 759bd60
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,28 @@ beforedepend:: src/glob_lexer.ml

# The config file

configure: Makefile.config src/ocamlbuild_config.ml

Makefile.config src/ocamlbuild_config.ml: configure.make
# we mark only the 'configure' rule PHONY,
# not individual CONF_FILES, as all OCamlbuild
# sources depend on ocamlbuild_config.ml,
# so it would rebuild from scratch each time.
#
# The reason for marking PHONY is to let the user
# explicitly re-configure; the --version answer
# depends on the state of the git repository, so
# it may change at any time.
.PHONY: configure

CONF_FILES=Makefile.config src/ocamlbuild_config.ml
configure:
$(MAKE) -f configure.make $(CONF_FILES)

$(CONF_FILES):
$(MAKE) -f configure.make $@

clean::
rm -f Makefile.config src/ocamlbuild_config.ml
rm -f $(CONF_FILES)

beforedepend:: src/ocamlbuild_config.ml
beforedepend:: Makefile.config

# Installation

Expand Down
4 changes: 4 additions & 0 deletions configure.make
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ Makefile.config:
echo "LIBDIR=$(OCAMLBUILD_LIBDIR)"; \
) > $@

# the configuration file depends on the git environment,
# so it should be rebuilt each time
.PHONY: src/ocamlbuild_config.ml

src/ocamlbuild_config.ml:
(echo "(* This file was generated from ../configure.make *)"; \
echo ;\
Expand Down

0 comments on commit 759bd60

Please sign in to comment.