File: Makefile

package info (click to toggle)
fuse-umfuse-fat 0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,432 kB
  • sloc: ansic: 22,517; makefile: 40
file content (31 lines) | stat: -rw-r--r-- 1,118 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
MAKEFLAGS += --silent
PANDOC=pandoc
PANDOCOK := $(shell command -v ${PANDOC} 2> /dev/null)
PANDOCMINVER=3.1.7

ifdef PANDOCOK
PANDOCVER := $(shell ${PANDOC} -v | head -1 | cut -d ' ' -f 2)
PANDOCVEROK := $(shell printf '%s\n' ${PANDOCMINVER} ${PANDOCVER} | sort -C -V; echo $$?)
endif

none:

% : %.md
ifdef PANDOCOK
ifeq (${PANDOCVEROK}, 1)
		echo "${PANDOC} ${PANDOCVER} < ${PANDOCMINVER}. $@ can create font warnings with man/groff" >&2
endif
# copy copyright notice
		grep "^\.\\\\\"" $< > $@ || true
# run pandoc
		$(eval SECTION := $(subst .,,$(suffix $@)))
		$(eval BASENAME := $(basename $@))
		$(eval TITLE := $(shell echo "${BASENAME}\(${SECTION}\)" | tr [:lower:] [:upper:]))
		$(eval HEADER := "General Commands Manual")
		$(PANDOC) -standalone -M title=${TITLE} -M section=${SECTION} -M header=${HEADER} -M footer=${PANDOC_ORG} -M "date=`LC_ALL=C date -d@$(SOURCE_DATE_EPOCH) +\"%B %Y\"`" --to man $< >> $@
# workaround for boldface rendering
		sed -i -e 's/\\f\[CR\]/\\f\[CB\]/g' $@ || true
		echo "$@ manpage updated" >&2
else
		echo "${PANDOC} is not available. Manpage $@ cannot be updated" >&2
endif