forked from openjdk/valhalla-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
29 lines (20 loc) · 766 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
OUT_DIR = web
IN_DIR = site
CSS = style.css
WILDCARD = $(patsubst $(IN_DIR)/%, %, $(wildcard $(IN_DIR)/*.$(1) $(IN_DIR)/**/*.$(1) $(IN_DIR)/**/**/*.$(1) ))
ASSET_EXTS = html jpg jpg gif svg png
MD_SOURCES = $(call WILDCARD,md)
ASSET_SOURCES = $(foreach X, $(ASSET_EXTS), $(call WILDCARD,$(X)))
GENERATED_FILES = $(patsubst %.md, $(OUT_DIR)/%.html, $(MD_SOURCES))
COPIED_FILES = $(patsubst %,$(OUT_DIR)/%, $(ASSET_SOURCES))
site: $(GENERATED_FILES) $(COPIED_FILES)
tar czf site.tar.gz -C $(OUT_DIR) --xform s:'./':: .
$(GENERATED_FILES) : $(OUT_DIR)/%.html : $(IN_DIR)/%.md
mkdir -p $(dir $@)
pandoc -f markdown $< -o $@ -H $(CSS)
$(COPIED_FILES) : $(OUT_DIR)/% : $(IN_DIR)/%
mkdir -p $(dir $@)
cp $< $@
clean:
rm -rf $(OUT_DIR)
.PHONY: all site clean