Skip to content

Commit e1d2e98

Browse files
committed
Makefile: fix the image paths for docs
Signed-off-by: Vincent Batts <[email protected]>
1 parent 0ff8a7c commit e1d2e98

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

Makefile

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,46 @@ DOC_FILES := \
1212

1313
FIGURE_FILES := \
1414
img/media-types.png
15+
OUTPUT ?= output/
1516

1617
default: help
1718

1819
help:
1920
@echo "Usage: make <target>"
2021
@echo
22+
@echo " * 'docs' - produce document in the $(OUTPUT) directory"
2123
@echo " * 'fmt' - format the json with indentation"
2224
@echo " * 'validate' - build the validation tool"
2325

2426
fmt:
2527
for i in *.json ; do jq --indent 2 -M . "$${i}" > xx && cat xx > "$${i}" && rm xx ; done
2628

27-
docs: output/docs.pdf output/docs.html
29+
docs: $(OUTPUT)/docs.pdf $(OUTPUT)/docs.html
2830

29-
output/docs.pdf: $(DOC_FILES) $(FIGURE_FILES)
30-
@mkdir -p output/ && \
31-
cp *.png $(shell pwd)/output && \
31+
$(OUTPUT)/docs.pdf: $(DOC_FILES) $(FIGURE_FILES)
32+
@mkdir -p $(OUTPUT)/ && \
33+
cp -ap img/ $(shell pwd)/$(OUTPUT)/&& \
3234
$(DOCKER) run \
3335
-it \
3436
--rm \
3537
-v $(shell pwd)/:/input/:ro \
36-
-v $(shell pwd)/output/:/output/ \
38+
-v $(shell pwd)/$(OUTPUT)/:/$(OUTPUT)/ \
3739
-u $(shell id -u) \
38-
vbatts/pandoc -f markdown_github -t latex -o /output/docs.pdf $(patsubst %,/input/%,$(DOC_FILES)) && \
40+
--workdir /input \
41+
vbatts/pandoc -f markdown_github -t latex -o /$(OUTPUT)/docs.pdf $(patsubst %,/input/%,$(DOC_FILES)) && \
3942
ls -sh $(shell readlink -f $@)
4043

41-
output/docs.html: $(DOC_FILES) $(FIGURE_FILES)
42-
@mkdir -p output/ && \
43-
cp *.png $(shell pwd)/output && \
44+
$(OUTPUT)/docs.html: $(DOC_FILES) $(FIGURE_FILES)
45+
@mkdir -p $(OUTPUT)/ && \
46+
cp -ap img/ $(shell pwd)/$(OUTPUT)/&& \
4447
$(DOCKER) run \
4548
-it \
4649
--rm \
4750
-v $(shell pwd)/:/input/:ro \
48-
-v $(shell pwd)/output/:/output/ \
51+
-v $(shell pwd)/$(OUTPUT)/:/$(OUTPUT)/ \
4952
-u $(shell id -u) \
50-
vbatts/pandoc -f markdown_github -t html5 -o /output/docs.html $(patsubst %,/input/%,$(DOC_FILES)) && \
53+
--workdir /input \
54+
vbatts/pandoc -f markdown_github -t html5 -o /$(OUTPUT)/docs.html $(patsubst %,/input/%,$(DOC_FILES)) && \
5155
ls -sh $(shell readlink -f $@)
5256

5357
code-of-conduct.md:
@@ -74,16 +78,19 @@ lint:
7478
test:
7579
go test -race ./...
7680

77-
%.png: %.dot
81+
img/%.png: %.dot
7882
dot -Tpng $^ > $@
7983

80-
inline-png-%.md: %.png
84+
inline-png-%.md: img/%.png
8185
@printf '<img src="data:image/png;base64,%s" alt="$*"/>\n' "$(shell base64 $^)" > $@
8286

87+
clean:
88+
rm -rf *~ $(OUTPUT)
8389
.PHONY: \
8490
validate-examples \
8591
oci-image-tool \
8692
check-license \
93+
clean \
8794
lint \
8895
docs \
8996
test

0 commit comments

Comments
 (0)