From fab58a938a61c62bb66ed70ce2563e1657d9f53b Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Sun, 3 May 2020 10:42:13 +0200 Subject: [PATCH] makefiles: move the inclusion of Makefile.build_config in Makefile.common --- Makefile | 16 +--------------- Makefile.common | 17 ++++++++++++++++- debugger/Makefile | 1 - lex/Makefile | 1 - ocamldoc/Makefile | 1 - ocamltest/Makefile | 1 - otherlibs/Makefile | 1 - otherlibs/Makefile.otherlibs.common | 1 - otherlibs/dynlink/Makefile | 1 - otherlibs/systhreads/Makefile | 1 - runtime/Makefile | 1 - stdlib/Makefile | 1 - tools/Makefile | 1 - yacc/Makefile | 1 - 14 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 75aa89e88..2547f0b97 100644 --- a/Makefile +++ b/Makefile @@ -16,20 +16,6 @@ # The main Makefile ROOTDIR = . - -# The configure and *clean targets can all be run without running ./configure -# first. -# If no goals were specified (i.e. `make`), add defaultentry (since it requires -# ./configure to be run) -CAN_BE_UNCONFIGURED := $(strip \ - $(filter-out partialclean clean distclean configure, \ - $(if $(MAKECMDGOALS),$(MAKECMDGOALS),defaultentry))) - -ifeq "$(CAN_BE_UNCONFIGURED)" "" --include Makefile.build_config -else -include Makefile.build_config -endif include Makefile.common .PHONY: defaultentry @@ -1083,7 +1069,7 @@ distclean: clean include .depend -ifneq "$(strip $(CAN_BE_UNCONFIGURED))" "" +ifneq "$(CAN_BE_UNCONFIGURED)" "" Makefile.config Makefile.build_config: config.status config.status: diff --git a/Makefile.common b/Makefile.common index 55d44fdfe..91644949f 100644 --- a/Makefile.common +++ b/Makefile.common @@ -15,7 +15,22 @@ # This makefile contains common definitions and rules shared by # other Makefiles -# We assume that Makefile.config has already been included + +# Some special targets ('*clean' and 'configure') do not require configuration. +# CAN_BE_UNCONFIGURED is empty if only those targets are requested, +# and non-empty if configuration is required. +CAN_BE_UNCONFIGURED := $(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 +# CAN_BE_UNCONFIGURED is non-empty. + +ifeq "$(CAN_BE_UNCONFIGURED)" "" +-include $(ROOTDIR)/Makefile.build_config +else +include $(ROOTDIR)/Makefile.build_config +endif # %(DEPDIR) must be kept in sync with entries in .gitignore DEPDIR=.dep diff --git a/debugger/Makefile b/debugger/Makefile index a6c18c3b3..73d050e7e 100644 --- a/debugger/Makefile +++ b/debugger/Makefile @@ -15,7 +15,6 @@ ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common include $(ROOTDIR)/Makefile.best_binaries diff --git a/lex/Makefile b/lex/Makefile index 5d3f04592..5601d4f7a 100644 --- a/lex/Makefile +++ b/lex/Makefile @@ -17,7 +17,6 @@ ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common CAMLYACC ?= $(ROOTDIR)/yacc/ocamlyacc diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile index e2e911c2c..8addaadb2 100644 --- a/ocamldoc/Makefile +++ b/ocamldoc/Makefile @@ -15,7 +15,6 @@ ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common include $(ROOTDIR)/Makefile.best_binaries diff --git a/ocamltest/Makefile b/ocamltest/Makefile index a12c713ee..5ea564379 100644 --- a/ocamltest/Makefile +++ b/ocamltest/Makefile @@ -17,7 +17,6 @@ ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common include $(ROOTDIR)/Makefile.best_binaries diff --git a/otherlibs/Makefile b/otherlibs/Makefile index a85547538..e5df38319 100644 --- a/otherlibs/Makefile +++ b/otherlibs/Makefile @@ -14,7 +14,6 @@ #************************************************************************** ROOTDIR=.. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common OTHERLIBRARIES ?= bigarray dynlink raw_spacetime_lib str systhreads \ diff --git a/otherlibs/Makefile.otherlibs.common b/otherlibs/Makefile.otherlibs.common index 81d256309..9fb7109da 100644 --- a/otherlibs/Makefile.otherlibs.common +++ b/otherlibs/Makefile.otherlibs.common @@ -16,7 +16,6 @@ # Common Makefile for otherlibs ROOTDIR=../.. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common include $(ROOTDIR)/Makefile.best_binaries diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile index 2072867e9..7875ec084 100644 --- a/otherlibs/dynlink/Makefile +++ b/otherlibs/dynlink/Makefile @@ -21,7 +21,6 @@ ROOTDIR = ../.. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common include $(ROOTDIR)/Makefile.best_binaries diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile index e848c9fcd..7909e3cc5 100644 --- a/otherlibs/systhreads/Makefile +++ b/otherlibs/systhreads/Makefile @@ -15,7 +15,6 @@ ROOTDIR=../.. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common include $(ROOTDIR)/Makefile.best_binaries diff --git a/runtime/Makefile b/runtime/Makefile index c62c1e0fe..a992dc685 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -15,7 +15,6 @@ ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common # Lists of source files diff --git a/stdlib/Makefile b/stdlib/Makefile index 965da1203..72566001b 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -15,7 +15,6 @@ ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common TARGET_BINDIR ?= $(BINDIR) diff --git a/tools/Makefile b/tools/Makefile index 39ec0e7a6..0a2ef191e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -16,7 +16,6 @@ MAKEFLAGS := -r -R ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common ifeq ($(SYSTEM),unix) diff --git a/yacc/Makefile b/yacc/Makefile index 257ee420c..3c4425a86 100644 --- a/yacc/Makefile +++ b/yacc/Makefile @@ -17,7 +17,6 @@ ROOTDIR = .. --include $(ROOTDIR)/Makefile.build_config include $(ROOTDIR)/Makefile.common OC_CPPFLAGS += -I$(ROOTDIR)/runtime