summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-04-14 03:01:37 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-04-14 03:02:07 -0600
commitfcf7f20e2fc039bafc5e78104e1d9fae2852b50d (patch)
treefc477fbf9ecc3f11d9a20cf73eb7574d0392010a
parentc15894ad17cb0760471c2dd798bfbbea2081b4db (diff)
compat: error out if bc is missing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--src/compat/Kbuild.include6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compat/Kbuild.include b/src/compat/Kbuild.include
index db4b0a6..53a8bde 100644
--- a/src/compat/Kbuild.include
+++ b/src/compat/Kbuild.include
@@ -53,7 +53,11 @@ endif
ifdef CONFIG_HZ
ifeq ($(wildcard $(srctree)/include/generated/timeconst.h),)
-ccflags-y += $(shell echo 'define gcd(a,b){auto t;while(b){t=b;b=a%b;a=t;};return a;};hz=$(CONFIG_HZ);cd=gcd(hz,1000000);print "-DHZ_TO_USEC_NUM=",1000000/cd," -DHZ_TO_USEC_DEN=",hz/cd;halt;' | bc -q)
+HZ_IFDEF := $(shell echo 'define gcd(a,b){auto t;while(b){t=b;b=a%b;a=t;};return a;};hz=$(CONFIG_HZ);cd=gcd(hz,1000000);print "-DHZ_TO_USEC_NUM=",1000000/cd," -DHZ_TO_USEC_DEN=",hz/cd;halt;' | bc -q)
+ifeq ($(HZ_IFDEF),)
+$(error bc(1) is required for building)
+endif
+ccflags-y += $(HZ_IFDEF)
endif
endif