aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-01-02 15:41:00 +0100
committerGravatar Christian Hesse <mail@eworm.de>2019-01-02 15:41:00 +0100
commite27a4e8f0ecd38723b811e8f260f5e0e109b4c01 (patch)
treeeb91cf626fe62d5f60d3e21423a721fe5a986603
parentbc36fb74c38525084316b46633af971aa2ab0baf (diff)
Makefile: update for extended functionality
This can handle new and multiple markdown files.
-rw-r--r--Makefile25
1 files changed, 17 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index b5f49af..2544698 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,25 @@
-GENERATE = *.capsman *.local
+# Makefile to generate data:
+# template scripts -> final scripts
+# markdown files -> html files
-all: $(GENERATE) README.html
+TEMPLATE = $(wildcard *.template)
+CAPSMAN = $(TEMPLATE:.template=.capsman)
+LOCAL = $(TEMPLATE:.template=.local)
-README.html: README.md
- markdown README.md > README.html
+MARKDOWN = $(wildcard *.md)
+HTML = $(MARKDOWN:.md=.html)
-%.local: *.template Makefile
+all: $(CAPSMAN) $(LOCAL) $(HTML)
+
+%.html: %.md Makefile
+ markdown $< > $@
+
+%.local: %.template Makefile
sed -e '/\/ caps-man/d' -e 's|%PATH%|interface wireless|' -e 's|%TEMPL%|$(suffix $@)|' \
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
- < $(basename $@).template > $@
+ < $< > $@
-%.capsman: *.template Makefile
+%.capsman: %.template Makefile
sed -e '/\/ interface wireless/d' -e 's/%PATH%/caps-man/' -e 's/%TEMPL%/$(suffix $@)/' \
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
- < $(basename $@).template > $@
+ < $< > $@