Skip to content

Commit 861c178

Browse files
committed
Adopt Makefile from ramalama project
Signed-off-by: Martin Skøtt <[email protected]>
1 parent e848ee2 commit 861c178

10 files changed

+62
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ binary_name = podman-bootc
22
output_dir = bin
33
build_tags = exclude_graphdriver_btrfs,btrfs_noversion,exclude_graphdriver_devicemapper,containers_image_openpgp,remote
44

5-
all: out_dir
5+
all: out_dir docs
66
go build -tags $(build_tags) $(GOOPTS) -o $(output_dir)/$(binary_name)
77

88
out_dir:
@@ -18,5 +18,10 @@ integration_tests:
1818
e2e_test: all
1919
ginkgo -tags $(build_tags) ./test/...
2020

21+
.PHONY: docs
22+
docs:
23+
make -C docs
24+
2125
clean:
2226
rm -f $(output_dir)/*
27+
make -C docs clean

docs/Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)