1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- # Environment vars
- DIST_DIR := dist
- # Computed vars
- SRC_HTMLS := $(shell find src -name '*.src.html')
- SRC_MDS := $(shell find src -name '*.src.md')
- SRC_TEMPLATES := $(shell find src/templates -name '*.html')
- GEN_HTMLS := $(SRC_HTMLS:%.src.html=%.gen.html)
- GEN_MDS := $(SRC_MDS:%.src.md=%.gen.html)
- GEN_FILES := $(GEN_HTMLS) $(GEN_MDS)
- INCLUDED_FILES := $(shell find src/include -type f)
- DOWNLOAD_FILES := $(shell find src/download -type f)
- EMBEDDED_FILES := $(shell find src -name '*.png' -type f)
- DIST_GEN_FILES := $(GEN_FILES:src/%.gen.html=$(DIST_DIR)/%.html)
- DIST_INC_FILES := $(INCLUDED_FILES:src/%=$(DIST_DIR)/%)
- DIST_DWN_FILES := $(DOWNLOAD_FILES:src/%=$(DIST_DIR)/%)
- DIST_EMB_FILES := $(EMBEDDED_FILES:src/%=$(DIST_DIR)/%)
- DIST_FILES := $(DIST_GEN_FILES) $(DIST_INC_FILES) $(DIST_DWN_FILES) $(DIST_EMB_FILES) $(DIST_DIR)/favicon.ico
- PANDOC_GEN := pandoc --standalone --wrap=none --template src/templates/main.html --metadata-file src/meta.yml
- .PHONY: build
- build: $(GEN_FILES)
- $(info HTML generated)
- %.gen.html: %.src.html %.meta.yml $(SRC_TEMPLATES)
- $(PANDOC_GEN) --metadata-file $*.meta.yml --output $@ $<
- %.gen.html: %.src.md %.meta.yml $(SRC_TEMPLATES)
- $(PANDOC_GEN) --metadata-file $*.meta.yml --output $@ $<
- .PHONY: dist
- dist: $(DIST_DIR)
- $(info Distributed folder generated)
- $(DIST_DIR): $(DIST_FILES)
- $(DIST_DIR)/%.html: src/%.gen.html
- mkdir --parents $(dir $@)
- cp $< $@
- $(DIST_DIR)/%: src/%
- mkdir --parents $(dir $@)
- cp $< $@
- .PHONY: clean
- clean:
- rm -f $(GEN_FILES)
- .PHONY: clean-dist
- clean-dist:
- rm -rf $(DIST_DIR)/*
- .PHONY: clean-all
- clean-all: clean clean-dist
- .PHONY: debug
- debug:
- $(info SRC_HTMLS $(SRC_HTMLS))
- $(info SRC_MDS $(SRC_MDS))
- $(info SRC_TEMPLATES $(SRC_TEMPLATES))
- $(info GEN_HTMLS $(GEN_HTMLS))
- $(info GEN_MDS $(GEN_MDS))
- $(info GEN_FILES $(GEN_FILES))
- $(info INCLUDED_FILES $(INCLUDED_FILES))
- $(info DOWNLOAD_FILES $(DOWNLOAD_FILES))
- $(info EMBEDDED_FILES $(EMBEDDED_FILES))
- $(info DIST_FILES $(DIST_FILES))
|