2016-12-02 13:22:25 +03:00
|
|
|
# The minor version is passed to the build. This is used to do some CPP to
|
|
|
|
# solve incompatibilities.
|
2016-12-01 16:21:08 +03:00
|
|
|
PANDOC_MINOR_VERSION=$(shell ghc-pkg latest pandoc | sed 's/.*-//' | cut -d. -f2)
|
2016-12-02 13:22:25 +03:00
|
|
|
|
|
|
|
# We use `?=` to set SOURCE_DATE_EPOCH only if it is not present. Unfortunately
|
|
|
|
# we can't use `git --date=unix` since only very recent git versions support
|
|
|
|
# that, so we need to make a round trip through `date`.
|
|
|
|
SOURCE_DATE_EPOCH?=$(shell date '+%s' \
|
|
|
|
--date="$(shell git log -1 --format=%cd --date=rfc)")
|
|
|
|
|
|
|
|
# Prettify the date.
|
2016-12-05 13:47:49 +03:00
|
|
|
SOURCE_DATE=$(shell env LC_ALL=C date '+%B %d, %Y' -d "@${SOURCE_DATE_EPOCH}")
|
2016-12-01 16:21:08 +03:00
|
|
|
|
2016-11-18 14:38:04 +03:00
|
|
|
extra/patat.1: README.md extra/make-man
|
2016-12-02 13:14:56 +03:00
|
|
|
SOURCE_DATE="$(SOURCE_DATE)" ./extra/make-man >$@
|
2016-11-18 14:38:04 +03:00
|
|
|
|
|
|
|
extra/make-man: extra/make-man.hs
|
2016-12-01 16:43:22 +03:00
|
|
|
ghc -DPANDOC_MINOR_VERSION=${PANDOC_MINOR_VERSION} -Wall -o $@ $<
|
2016-11-18 14:38:04 +03:00
|
|
|
|
|
|
|
man: extra/patat.1
|
|
|
|
|
2016-12-01 16:21:08 +03:00
|
|
|
# Also check if we can generate the manual.
|
|
|
|
test: man
|
2016-11-18 14:38:04 +03:00
|
|
|
bash test.sh
|
|
|
|
|
2016-12-01 16:55:10 +03:00
|
|
|
clean:
|
|
|
|
rm -f extra/patat.1
|
|
|
|
rm -f extra/make-man
|
|
|
|
|
|
|
|
.PHONY: man test clean
|