generated from igor/bunige-document
48 lines
1.1 KiB
Makefile
48 lines
1.1 KiB
Makefile
# Modifier le nom et le nombre des fichiers contenant les sources du document
|
|
|
|
SOURCES_FOLDER := source
|
|
PDF_FOLDER := pdf
|
|
STATIC_FOLDER := static
|
|
|
|
SOURCE_FILES := $(wildcard $(SOURCES_FOLDER)/*.md)
|
|
HTML_FILES := $(patsubst $(SOURCES_FOLDER)/%.md,%.html,$(SOURCE_FILES))
|
|
PDF_FILES := $(patsubst $(SOURCES_FOLDER)/%.md,$(PDF_FOLDER)/%.pdf,$(SOURCE_FILES))
|
|
HTML_TEMPLATE := $(STATIC_FOLDER)/template.html
|
|
CSS_FILE := $(STATIC_FOLDER)/style.css
|
|
|
|
.PHONY: all
|
|
all: $(PDF_FILES)
|
|
|
|
%.html: $(SOURCES_FOLDER)/%.md
|
|
pandoc \
|
|
--css=$(CSS_FILE) --template=$(HTML_TEMPLATE) \
|
|
--to=html --standalone \
|
|
--out=$@ $<
|
|
|
|
.PHONY: html
|
|
html: $(HTML_FILES)
|
|
|
|
$(PDF_FOLDER)/%.pdf: $(SOURCES_FOLDER)/%.md
|
|
mkdir -p $(PDF_FOLDER)
|
|
pandoc \
|
|
--to=pdf --pdf-engine=pagedjs-cli \
|
|
--embed-resource -V noscript=true \
|
|
--css=$(CSS_FILE) --template=$(HTML_TEMPLATE) \
|
|
--toc \
|
|
--out=$@ $<
|
|
|
|
.PHONY: pdf
|
|
pdf: $(PDF_FILES)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(filter-out template.html,$(wildcard *.html))
|
|
|
|
.PHONY: serve
|
|
serve:
|
|
watchexec -r -w . "python -m http.server"
|
|
|
|
.PHONY: watch
|
|
watch:
|
|
watchexec -r -w . --ignore $(TARGET) -- make $(TARGET)
|