From 9a26e0a94ba8bc98cfeefd447e02687c1d91ef40 Mon Sep 17 00:00:00 2001 From: "M.K" Date: Wed, 6 Jan 2021 03:57:50 +0100 Subject: [PATCH] Makefiles: Validate LUA selection or refer to the other Makefile. (#3269) --- app/Makefile | 11 ++++++++--- app/lua/Makefile | 14 ++++++++++++++ app/lua/luac_cross/Makefile | 14 ++++++++++++++ app/lua53/Makefile | 12 ++++++++++++ app/lua53/host/Makefile | 12 ++++++++++++ 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/app/Makefile b/app/Makefile index 7bd19b95..e85f1427 100644 --- a/app/Makefile +++ b/app/Makefile @@ -16,10 +16,15 @@ TARGET = eagle FLAVOR = debug # Handle Lua Directory selector -ifeq ("$(LUA)","53") +ifeq ("$(LUA)","") + LUA_DIR := lua +else ifeq ("$(LUA)","51") + LUA_DIR := lua +else ifeq ("$(LUA)","53") LUA_DIR := lua53 else - LUA_DIR := lua + $(error Unsupported value "$(LUA)" for variable "LUA", \ + expected "51", "53" or unset/empty) endif ifndef PDIR # { @@ -158,7 +163,7 @@ DDEFINES += \ # Required for each makefile to inherit from the parent # INCLUDES := -I $(PDIR)libc -I $(PDIR)$(LUA_DIR) -I $(PDIR)platform \ - $(INCLUDES) -I $(PDIR) -I $(PDIR)include + $(INCLUDES) -I $(PDIR) -I $(PDIR)include PDIR := ../$(PDIR) sinclude $(PDIR)Makefile diff --git a/app/lua/Makefile b/app/lua/Makefile index aeb66d17..d3a9e76e 100644 --- a/app/lua/Makefile +++ b/app/lua/Makefile @@ -18,6 +18,20 @@ endif STD_CFLAGS=-std=gnu11 -Wimplicit -Wall + +# Validate LUA setting +ifeq ("$(LUA)","") +else ifeq ("$(LUA)","51") + # ok +else ifeq ("$(LUA)","53") + $(error Your variable LUA="$(LUA)" looks like you probably want \ + app/lua53/Makefile instead) +else + $(error Unsupported value "$(LUA)" for variable "LUA", \ + expected empty/unset (recommended) or "51") +endif + + ############################################################# # Configuration i.e. compile options etc. # Target specific stuff (defines etc.) goes in here! diff --git a/app/lua/luac_cross/Makefile b/app/lua/luac_cross/Makefile index 3835e11a..e617da73 100644 --- a/app/lua/luac_cross/Makefile +++ b/app/lua/luac_cross/Makefile @@ -15,6 +15,20 @@ CCFLAGS += -Wall TARGET = host + +# Validate LUA setting +ifeq ("$(LUA)","") +else ifeq ("$(LUA)","51") + # ok +else ifeq ("$(LUA)","53") + $(error Your variable LUA="$(LUA)" looks like you probably want \ + app/lua53/host/Makefile instead) +else + $(error Unsupported value "$(LUA)" for variable "LUA", \ + expected empty/unset (recommended) or "51") +endif + + VERBOSE ?= V ?= $(VERBOSE) ifeq ("$(V)","1") diff --git a/app/lua53/Makefile b/app/lua53/Makefile index f907aebb..47c39abb 100644 --- a/app/lua53/Makefile +++ b/app/lua53/Makefile @@ -18,6 +18,18 @@ endif STD_CFLAGS=-std=gnu11 -Wimplicit -Wall + +# Validate LUA setting +ifeq ("$(LUA)","53") + # ok +else ifeq ("$(LUA)","51") + $(error Your variable LUA="$(LUA)" looks like you probably want \ + app/lua/Makefile instead) +else + $(error Expected environment variable "LUA" to be "53", not "$(LUA)") +endif + + ############################################################# # Configuration i.e. compile options etc. # Target specific stuff (defines etc.) goes in here! diff --git a/app/lua53/host/Makefile b/app/lua53/host/Makefile index 5667b3c4..b83ef275 100644 --- a/app/lua53/host/Makefile +++ b/app/lua53/host/Makefile @@ -23,6 +23,18 @@ else # MAKEFLAGS += --silent -w endif # $(V)==1 + +# Validate LUA setting +ifeq ("$(LUA)","53") + # ok +else ifeq ("$(LUA)","51") + $(error Your variable LUA="$(LUA)" looks like you probably want \ + app/lua/luac_cross/Makefile instead) +else + $(error Expected environment variable "LUA" to be "53", not "$(LUA)") +endif + + DEBUG ?= ifeq ("$(DEBUG)","1") FLAVOR = debug