-
Notifications
You must be signed in to change notification settings - Fork 600
Makefile: Fix native pandoc invocation #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,20 @@ | ||
|
|
||
| DOCKER ?= $(shell command -v docker) | ||
| PANDOC ?= $(shell command -v pandoc) | ||
| DOCKER ?= $(shell command -v docker 2>/dev/null) | ||
| PANDOC ?= $(shell command -v pandoc 2>/dev/null) | ||
| ifeq "$(strip $(PANDOC))" '' | ||
| ifneq "$(strip $(DOCKER))" '' | ||
| PANDOC = $(DOCKER) run \ | ||
| -it \ | ||
| --rm \ | ||
| -v $(shell pwd)/:/input/:ro \ | ||
| -v $(shell pwd)/output/:/output/ \ | ||
| -u $(shell id -u) \ | ||
| vbatts/pandoc | ||
| PANDOC_SRC := /input/ | ||
| PANDOC_DST := / | ||
| endif | ||
| endif | ||
|
|
||
| # These docs are in an order that determines how they show up in the PDF/HTML docs. | ||
| DOC_FILES := \ | ||
| version.md \ | ||
|
|
@@ -25,25 +39,18 @@ default: docs | |
| .PHONY: docs | ||
| docs: output/docs.pdf output/docs.html | ||
|
|
||
| ifeq "$(strip $(PANDOC))" '' | ||
| output/docs.pdf output/docs.html: | ||
| $(error cannot build $@ without either pandoc or docker) | ||
| else | ||
| output/docs.pdf: $(DOC_FILES) | ||
| mkdir -p output/ && \ | ||
| $(DOCKER) run \ | ||
| -it \ | ||
| --rm \ | ||
| -v $(shell pwd)/:/input/:ro \ | ||
| -v $(shell pwd)/output/:/output/ \ | ||
| -u $(shell id -u) \ | ||
| $(PANDOC) -f markdown_github -t latex -o /$@ $(patsubst %,/input/%,$(DOC_FILES)) | ||
| $(PANDOC) -f markdown_github -t latex -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have local pandoc, should also set PANDOC_DST and PANDOC_SRC, otherwise they'll be empty.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty strings are the values we want for a native pandoc, but I can explicitly set them to empty strings if you like. Let me know if that's what you want. |
||
|
|
||
| output/docs.html: $(DOC_FILES) | ||
| mkdir -p output/ && \ | ||
| $(DOCKER) run \ | ||
| -it \ | ||
| --rm \ | ||
| -v $(shell pwd)/:/input/:ro \ | ||
| -v $(shell pwd)/output/:/output/ \ | ||
| -u $(shell id -u) \ | ||
| $(PANDOC) -f markdown_github -t html5 -o /$@ $(patsubst %,/input/%,$(DOC_FILES)) | ||
| $(PANDOC) -f markdown_github -t html5 -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES)) | ||
| endif | ||
|
|
||
| code-of-conduct.md: | ||
| curl -o $@ https://raw.githubusercontent.com/opencontainers/tob/d2f9d68c1332870e40693fe077d311e0742bc73d/code-of-conduct.md | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pickup my second patch in #440 ? I think it would be better to name it as
runtime-spec.pdf/html, it's what I have to do now before send it to someone else who don't have source code, WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Do you want oci-runtime-spec-v{version}.{extension}? If we're adding context in the filename, we might as well be thorough ;).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets do that in another PR. I have mulled on a better name and a way to do include the version (git tag + abbreviated commit?) but haven't arrived at a clean enough conclusion yet.