move the REQUIRES_CONFIGURATION logic in Makefile.config_if_required

This lets us share the logic between Makefile.common and Makefile.tools.
master
Gabriel Scherer 2020-05-05 08:37:59 +02:00
parent 8d716a1712
commit e34e62253f
3 changed files with 32 additions and 14 deletions

View File

@ -16,19 +16,7 @@
# This makefile contains common definitions and rules shared by
# other Makefiles
# Some special targets ('*clean' and 'configure') do not require configuration.
# REQUIRES_CONFIGURATION is empty if only those targets are requested,
# and non-empty if configuration is required.
REQUIRES_CONFIGURATION := $(strip \
$(filter-out partialclean clean distclean configure, \
$(if $(MAKECMDGOALS),$(MAKECMDGOALS),defaultentry)))
# If no goals were specified (i.e. `make`), we add defaultentry
# (since it requires ./configure to be run) so that
# REQUIRES_CONFIGURATION is non-empty.
ifneq "$(REQUIRES_CONFIGURATION)" ""
include $(ROOTDIR)/Makefile.build_config
endif
include $(ROOTDIR)/Makefile.config_if_required
# %(DEPDIR) must be kept in sync with entries in .gitignore
DEPDIR=.dep

View File

@ -0,0 +1,28 @@
#**************************************************************************
#* *
#* OCaml *
#* *
#* Gabriel Scherer, projet Parsifal, INRIA Saclay *
#* *
#* Copyright 2020 Institut National de Recherche en Informatique et *
#* en Automatique. *
#* *
#* All rights reserved. This file is distributed under the terms of *
#* the GNU Lesser General Public License version 2.1, with the *
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
# Some special targets ('*clean' and 'configure') do not require configuration.
# REQUIRES_CONFIGURATION is empty if only those targets are requested,
# and non-empty if configuration is required.
REQUIRES_CONFIGURATION := $(strip \
$(filter-out partialclean clean distclean configure, \
$(if $(MAKECMDGOALS),$(MAKECMDGOALS),defaultentry)))
# If no goals were specified (i.e. `make`), we add defaultentry
# (since it requires ./configure to be run) so that
# REQUIRES_CONFIGURATION is non-empty.
ifneq "$(REQUIRES_CONFIGURATION)" ""
include $(ROOTDIR)/Makefile.build_config
endif

View File

@ -47,7 +47,9 @@ SET_LD_PATH=CAML_LD_LIBRARY_PATH="$(LD_PATH)"
# variable. Note that for Windows we add Unix-syntax directory names in
# PATH, and Cygwin will translate it to Windows syntax.
-include $(TOPDIR)/Makefile.config
# TOPDIR is legacy, our makefiles should use ROOTDIR now
ROOTDIR=$(TOPDIR)
include $(ROOTDIR)/Makefile.config_if_required
# Make sure USE_RUNTIME is defined
USE_RUNTIME ?=