From af13e1d32524c6f4cc3fe675bf8c89129444ab92 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Mon, 22 Aug 2016 14:04:59 -0700 Subject: [PATCH] Error if someone uses the sub-makefile directly --- Makefile | 2 +- Makefile.generated_files | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4a1f05694eb..25318fb089a 100644 --- a/Makefile +++ b/Makefile @@ -278,4 +278,4 @@ $(notdir $(abspath $(wildcard federation/cmd/*/))): generated_files # make generated_files .PHONY: generated_files generated_files: - $(MAKE) -f Makefile.$@ $@ + $(MAKE) -f Makefile.$@ $@ CALLED_FROM_MAIN_MAKEFILE=1 diff --git a/Makefile.generated_files b/Makefile.generated_files index f8848f0d811..b564c476715 100644 --- a/Makefile.generated_files +++ b/Makefile.generated_files @@ -12,6 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Don't allow users to call this directly. There are too many variables this +# assumes to inherit from the main Makefile. This is not a user-facing file. +ifeq ($(CALLED_FROM_MAIN_MAKEFILE),) + $(error Please use the main Makefile, e.g. `make generated_files`) +endif + # Don't allow an implicit 'all' rule. This is not a user-facing file. ifeq ($(MAKECMDGOALS),) $(error This Makefile requires an explicit rule to be specified)