|
| 1 | +PREFIX := /usr/local |
| 2 | +DATADIR := ${PREFIX}/share |
| 3 | +MANDIR := $(DATADIR)/man |
| 4 | +GO ?= go |
| 5 | +GOMD2MAN ?= go-md2man |
| 6 | +ifeq ($(shell uname -s),FreeBSD) |
| 7 | +SED=gsed |
| 8 | +else |
| 9 | +SED=sed |
| 10 | +endif |
| 11 | +# This must never include the 'hack' directory |
| 12 | +export PATH := $(shell $(GO) env GOPATH)/bin:$(PATH) |
| 13 | + |
| 14 | +docs: $(patsubst %.md,%,$(wildcard *[15].md)) |
| 15 | + |
| 16 | +%.1: %.1.md |
| 17 | +### sed is used to filter http/s links as well as relative links |
| 18 | +### replaces "\" at the end of a line with two spaces |
| 19 | +### this ensures that manpages are rendered correctly |
| 20 | + @$(SED) -e 's/\((podman-bootc[^)]*\.md\(#.*\)\?)\)//g' \ |
| 21 | + -e 's/\[\(podman-bootc[^]]*\)\]/\1/g' \ |
| 22 | + -e 's/\[\([^]]*\)](http[^)]\+)/\1/g' \ |
| 23 | + -e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' \ |
| 24 | + -e 's/\\$$/ /g' $< | \ |
| 25 | + $(GOMD2MAN) -in /dev/stdin -out $@ |
| 26 | + |
| 27 | +%.5: %.5.md |
| 28 | +### sed is used to filter http/s links as well as relative links |
| 29 | +### replaces "\" at the end of a line with two spaces |
| 30 | +### this ensures that manpages are rendered correctly |
| 31 | + @$(SED) -e 's/\((podman-bootc[^)]*\.md\(#.*\)\?)\)//g' \ |
| 32 | + -e 's/\[\(podman-bootc[^]]*\)\]/\1/g' \ |
| 33 | + -e 's/\[\([^]]*\)](http[^)]\+)/\1/g' \ |
| 34 | + -e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' \ |
| 35 | + -e 's/\\$$/ /g' $< | \ |
| 36 | + $(GOMD2MAN) -in /dev/stdin -out $@ |
| 37 | + |
| 38 | +.PHONY: install |
| 39 | +install: docs |
| 40 | + install -d ${DESTDIR}/${MANDIR}/man1 |
| 41 | + install -m 0644 podman-bootc*.1 ${DESTDIR}/${MANDIR}/man1 |
| 42 | + install -m 0644 links/podman-bootc*.1 ${DESTDIR}/${MANDIR}/man1 |
| 43 | + install -d ${DESTDIR}/${MANDIR}/man5 |
| 44 | + install -m 0644 podman-bootc*.5 ${DESTDIR}/${MANDIR}/man5 |
| 45 | + |
| 46 | + install -d ${DESTDIR}/${DATADIR}/podman-bootc |
| 47 | + install -m 0644 podman-bootc.conf ${DESTDIR}/${DATADIR}/podman-bootc |
| 48 | + |
| 49 | + |
| 50 | +.PHONY: install-tools |
| 51 | +install-tools: |
| 52 | + go install github.com/cpuguy83/go-md2man@latest |
| 53 | + |
| 54 | +.PHONY: clean |
| 55 | +clean: |
| 56 | + $(RM) -f podman-bootc*.1 podman-bootc*.5 |
0 commit comments