From 6d2d5c68372a2e10f747b01cb4d1316ba8fd11eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 7 Feb 2020 10:25:51 +0100 Subject: [PATCH] [build] Add confirmation before building official softwares --- Makefile | 4 ++-- build/rules.mk | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8f8af5d51..8594beee0 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,11 @@ endef define rule_for ifeq ($(strip $(5)),with_local_version) -$(addprefix $$(BUILD_DIR)/,$(strip $(2))): $(addprefix $$(BUILD_DIR)/,$(strip $(3))) +$(addprefix $$(BUILD_DIR)/,$(strip $(2))): $(addprefix $$(BUILD_DIR)/,$(strip $(3))) | $(if $(findstring official,${MAKECMDGOALS}),official_authorization) @ echo "$(shell printf "%-8s" $(strip $(1)))$$(@:$$(BUILD_DIR)/%=%)" $(Q) $(4) endif -$(addprefix $$(BUILD_DIR)/,$(strip $(2))): $(strip $(3)) | $$$$(@D)/. +$(addprefix $$(BUILD_DIR)/,$(strip $(2))): $(strip $(3)) | $$$$(@D)/. $(if $(findstring official,${MAKECMDGOALS}),official_authorization) @ echo "$(shell printf "%-8s" $(strip $(1)))$$(@:$$(BUILD_DIR)/%=%)" $(Q) $(4) endef diff --git a/build/rules.mk b/build/rules.mk index 2092a831e..242dc13ea 100644 --- a/build/rules.mk +++ b/build/rules.mk @@ -1,5 +1,9 @@ # Define standard compilation rules +.PHONY: official_authorization +official_authorization: + @echo "CAUTION: You are about to build an official NumWorks firmware. Distribution of such firmware by a third party is prohibited. Are you sure you want to proceed? Please type "yes" to confirm." && read ans && [ $${ans:-no} = yes ] + $(eval $(call rule_for, \ AS, %.o, %.s, \ $$(CC) $$(SFLAGS) -c $$< -o $$@ \