aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile58
1 files changed, 34 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index d21713c2..5db0a303 100644
--- a/Makefile
+++ b/Makefile
@@ -2,35 +2,45 @@
# template scripts -> final scripts
# markdown files -> html files
-CAPSMAN = $(wildcard *.capsman.rsc)
-LOCAL = $(wildcard *.local.rsc)
-WIFI = $(wildcard *.wifi.rsc)
+ALL_RSC := $(wildcard *.rsc */*.rsc)
+GEN_RSC := $(wildcard *.capsman.rsc *.local.rsc *.wifi.rsc)
-MARKDOWN = $(wildcard *.md doc/*.md doc/mod/*.md)
-HTML = $(MARKDOWN:.md=.html)
+MARKDOWN := $(wildcard *.md doc/*.md doc/mod/*.md)
+HTML := $(MARKDOWN:.md=.html)
-all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML)
+DATE ?= $(shell date --rfc-email)
+VERSION ?= $(shell git symbolic-ref --short HEAD 2>/dev/null)/$(shell git rev-list --count HEAD 2>/dev/null)/$(shell git rev-parse --short=8 HEAD 2>/dev/null)
+export DATE VERSION
-%.html: %.md Makefile
- markdown $< | sed 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' > $@
+.PHONY: all checksums commitinfo docs rsc clean
-%.capsman.rsc: %.template.rsc Makefile
- sed -e '/\/interface\/wifi\//d' -e '/\/interface\/wireless\//d' -e 's|%TEMPL%|.capsman|' \
- -e '/^# NOT \/caps-man\/ #$$/,/^# NOT \/caps-man\/ #$$/d' \
- -e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
- < $< > $@
+all: checksums docs rsc
-%.local.rsc: %.template.rsc Makefile
- sed -e '/\/caps-man\//d' -e '/\/interface\/wifi\//d' -e 's|%TEMPL%|.local|' \
- -e '/^# NOT \/interface\/wireless\/ #$$/,/^# NOT \/interface\/wireless\/ #$$/d' \
- -e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
- < $< > $@
+checksums: checksums.json
-%.wifi.rsc: %.template.rsc Makefile
- sed -e '/\/caps-man\//d' -e '/\/interface\/wireless\//d' -e 's|%TEMPL%|.wifi|' \
- -e '/^# NOT \/interface\/wifi\/ #$$/,/^# NOT \/interface\/wifi\/ #$$/d' \
- -e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
- < $< > $@
+checksums.json: contrib/checksums.sh $(ALL_RSC)
+ contrib/checksums.sh > $@
+
+commitinfo: global-functions.rsc
+ contrib/commitinfo.sh $< > $<~
+ mv $<~ $<
+
+docs: $(HTML)
+
+%.html: %.md general/style.css contrib/html.sh contrib/html.sh.d/head.html contrib/html.sh.d/foot.html
+ contrib/html.sh $< > $@
+
+rsc: $(GEN_RSC)
+
+%.capsman.rsc: %.template.rsc contrib/template-capsman.sh
+ contrib/template-capsman.sh $< > $@
+
+%.local.rsc: %.template.rsc contrib/template-local.sh
+ contrib/template-local.sh $< > $@
+
+%.wifi.rsc: %.template.rsc contrib/template-wifi.sh
+ contrib/template-wifi.sh $< > $@
clean:
- rm -f $(HTML)
+ rm -f $(HTML) checksums.json
+ make -C contrib/ clean