build: use perl instead of GNU date for KBUILD_BUILD_TIMESTAMP
authorFelix Fietkau <nbd@nbd.name>
Tue, 23 Aug 2016 09:05:56 +0000 (11:05 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 23 Aug 2016 09:56:13 +0000 (11:56 +0200)
Fixes warning on non-Linux systems

Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/kernel-defaults.mk

index bae8cd0ee3ecac28cdf140d039d8b0061755c7b5..2c4bcec4746178da9a25181eefe4726c4a67b6da 100644 (file)
@@ -5,6 +5,12 @@
 # See /LICENSE for more information.
 #
 
+ifneq ($(SOURCE_DATE_EPOCH),)
+  ifndef DUMP
+    KBUILD_BUILD_TIMESTAMP:=$(shell perl -e 'print scalar gmtime($(SOURCE_DATE_EPOCH))')
+  endif
+endif
+
 KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
        HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
        CROSS_COMPILE="$(KERNEL_CROSS)" \
@@ -12,7 +18,7 @@ KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
        KBUILD_HAVE_NLS=no \
        KBUILD_BUILD_USER="$(call qstrip,$(CONFIG_KERNEL_BUILD_USER))" \
        KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
-       $(if $(SOURCE_DATE_EPOCH),KBUILD_BUILD_TIMESTAMP="$(shell date -u --date="@$(SOURCE_DATE_EPOCH)")") \
+       KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
        KBUILD_BUILD_VERSION="0" \
        CONFIG_SHELL="$(BASH)" \
        $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \