From 338ecdd57823a8bdcdfe513cf2d0c7e7c08f502f Mon Sep 17 00:00:00 2001 From: r-p-e Date: Sun, 15 Sep 2013 21:27:18 +0200 Subject: [PATCH] Simplify the selection of date command - use egrep patterns to detect BSDs in one ifeq - use seconds-since-epoch as input for BSD date (-r option) - get seconds-since-epoch from git log with "%at" format string --- Makefile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a7a193fcc21..1581332f419 100644 --- a/Makefile +++ b/Makefile @@ -39,15 +39,11 @@ ifneq ($(shell which git),) GIT_DATE := $(shell git log -n 1 --format="%ai") endif -ifeq ($(OS), FreeBSD) -DATE := $(shell date -j -f "%Y-%m-%d %H:%M:%s" "$(GIT_DATE)" +%Y%m%d%H%M) -else -ifeq ($(OS), Darwin) -DATE := $(shell date -j -f "%Y-%m-%d %H:%M:%S" "$(GIT_DATE)" +%Y%m%d%H%M) +ifeq ($(shell echo $(OS) | egrep -c 'Darwin|FreeBSD|OpenBSD'),1) +DATE := $(shell date -j -r $(shell git log -n 1 --format="%at") +%Y%m%d%H%M) else DATE := $(shell date --utc --date="$(GIT_DATE)" +%Y%m%d%H%M) endif -endif # RPM build parameters RPMSPECDIR= packaging/rpm