nix-book/Makefile
2023-06-12 16:38:54 +01:00

27 lines
752 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.RECIPEPREFIX = >
# The operator != is not negation; it executes a shell script and sets a variable to its output.
STATIC_ADOC_FILES != find source -name '*.adoc'
GENERATED_ADOC_FILES != find source -name '*.adoc0' | sed 's/\.adoc0/.adoc/'
ADOC_FILES = $(STATIC_ADOC_FILES) $(GENERATED_ADOC_FILES)
MAIN_ADOC_FILE = source/book.adoc
.PHONY: debug
debug :
> @echo "STATIC_ADOC_FILES=$(STATIC_ADOC_FILES)"
> @echo "GENERATED_ADOC_FILES=$(GENERATED_ADOC_FILES)"
> @echo "ADOC_FILES=$(ADOC_FILES)"
.PHONY: html
html : index.html
%.adoc : %.adoc0
> run-code-inline < $< 2>&1 | tee $@
index.html : source/book.adoc $(ADOC_FILES)
> asciidoctor -b html5 -d book -o $(MAIN_ADOC_FILE) $<
.PHONY: clean
clean :
> echo removing $(GENERATED_ADOC_FILES)