-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.bsd
83 lines (63 loc) · 1.83 KB
/
Makefile.bsd
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.SUFFIXES:
MYSERVER=my.blog.site
PGOT-LOC=pgot -i ":src/inc" -d '{"siteurl":"$(.CURDIR)/bld/loc","dfile":"index.html"}'
PGOT-PUB=pgot -i ":src/inc" -d '{"siteurl":"https://$(MYSERVER)","dfile":""}'
CHUF=chuf '|||md+' '|||md-' markdown
INC!=find src -type f -name '*.igot'
GOTS!=find src -type f -name '*.got'
GOTL:=$(GOTS:src/%.got=bld/loc/%.html)
GOTP:=$(GOTS:src/%.got=bld/pub/%.html)
RAWS!=find -L src -type f -name '*.raw'
RAWL:=$(RAWS:src/%.raw=bld/loc/%)
RAWP:=$(RAWS:src/%.raw=bld/pub/%)
CPYS!=find -L src -type f -name '*.cpy'
CPYL:=$(CPYS:src/%.cpy=bld/loc/%)
CPYP:=$(CPYS:src/%.cpy=bld/pub/%)
all loc: $(RAWL) $(CPYL) $(GOTL)
pub: $(RAWP) $(CPYP) $(GOTP)
$(RAWL): $(@:bld/loc/%=src/%.raw)
@mkdir -p $(@D)
@echo "raw -> $@"
@cp $? $@
$(RAWP): $(@:bld/pub/%=src/%.raw)
@mkdir -p $(@D)
@echo "raw -> $@"
@cp $? $@
$(CPYL): $(@:bld/loc/%=src/%.cpy)
@mkdir -p $(@D)
@echo "cpy -> $@"
@cp $? $@
$(CPYP): $(@:bld/pub/%=src/%.cpy)
@mkdir -p $(@D)
@echo "cpy -> $@"
@cp $? $@
$(GOTL): $(@:bld/loc/%.html=src/%.got) $(INC)
@mkdir -p $(@D)
@echo "got -> $@"
@$(PGOT-LOC) $? | $(CHUF) > $@
$(GOTP): $(@:bld/pub/%.html=src/%.got) $(INC)
@mkdir -p $(@D)
@echo "pgot -> $@"
@$(PGOT-PUB) $? | $(CHUF) > $@
cogit: bld/cogit.tar cogit-files.txt
@ echo "Moving cogit tarball to release folder"
mkdir -p ../makehtml-release
mv bld/cogit.tar ../makehtml-release/makehtml-cogit-$(shell date +"%Y-%m-%d").tar
CGTMP=cg.tmp
CGSRT=cgsrt.tmp
bld/cogit.tar: $(CGSRT)
@mkdir -p $(@D)
@echo "generating $@"
@tar -T $< -cf $@
cogit-files.txt: $(CGSRT)
@echo "generating $@"
@while read CGFILE; do sha256sum -b "$$CGFILE"; done < $< > $@
$(CGSRT): $(RAW)
@find src -type f -name '*.raw' > $(CGTMP)
@sort < $(CGTMP) > $@
@rm -f $(CGTMP)
clean:
rm -Rf bld *.tmp
lint: loc
@grep -n -r '<no value>' bld/loc/ || true
.PHONY: all loc pub clean lint