Skip to content

Commit 3068330

Browse files
committed
tooling: Verify options are set to 0 or 1
1 parent 57f32b3 commit 3068330

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Makefile.all

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ SHELL := /bin/bash
99
GNUMAKEFLAGS := --no-print-directory
1010
SUBMAKEFLAGS :=
1111

12+
define assert_numeric_bool
13+
$(if $(filter-out 0 1,${$1}), $(error Unexpected value for parameter $1, expect either 0 or 1))
14+
endef
15+
1216
## USE_NPROC
1317
## Usage: make USE_NPROC=1 <targets>
1418
## Default: 0
@@ -22,6 +26,8 @@ SUBMAKEFLAGS :=
2226
## make USE_NPROC=1 NPROC=3 <targets>
2327
##
2428
USE_NPROC := 0
29+
$(call assert_numeric_bool, USE_NPROC)
30+
2531
ifeq (${USE_NPROC},1)
2632
NPROC := $(shell nproc 2>/dev/null)
2733
ifdef NPROC
@@ -79,12 +85,14 @@ CONAN_OPTIONS :=
7985
## Default: 1
8086
##
8187
WITH_ENGINE := 1
88+
$(call assert_numeric_bool, WITH_ENGINE)
8289

8390
## WITH_VTD
8491
## Usage: make WITH_VTD=1 <targets>
8592
## Default: 0
8693
##
8794
WITH_VTD := 0
95+
$(call assert_numeric_bool, WITH_VTD)
8896

8997
## BUILD_TESTS
9098
## Usage: make BUILD_TESTS=0 package
@@ -95,6 +103,7 @@ WITH_VTD := 0
95103
## to showcase how to correctly pass options to all packages.
96104
##
97105
BUILD_TESTS := 1
106+
$(call assert_numeric_bool, WITH_TESTS)
98107

99108
# --------------------------------------------------------------------------- #
100109

0 commit comments

Comments
 (0)