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
This commit is contained in:
parent
f93ef96a08
commit
338ecdd578
1 changed files with 2 additions and 6 deletions
8
Makefile
8
Makefile
|
@ -39,15 +39,11 @@ ifneq ($(shell which git),)
|
||||||
GIT_DATE := $(shell git log -n 1 --format="%ai")
|
GIT_DATE := $(shell git log -n 1 --format="%ai")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS), FreeBSD)
|
ifeq ($(shell echo $(OS) | egrep -c 'Darwin|FreeBSD|OpenBSD'),1)
|
||||||
DATE := $(shell date -j -f "%Y-%m-%d %H:%M:%s" "$(GIT_DATE)" +%Y%m%d%H%M)
|
DATE := $(shell date -j -r $(shell git log -n 1 --format="%at") +%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)
|
|
||||||
else
|
else
|
||||||
DATE := $(shell date --utc --date="$(GIT_DATE)" +%Y%m%d%H%M)
|
DATE := $(shell date --utc --date="$(GIT_DATE)" +%Y%m%d%H%M)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
# RPM build parameters
|
# RPM build parameters
|
||||||
RPMSPECDIR= packaging/rpm
|
RPMSPECDIR= packaging/rpm
|
||||||
|
|
Loading…
Add table
Reference in a new issue