~technomancy/fennel-lang.org

ref: c9a7db72fe3fd06b5eec936984713f034acd9511 fennel-lang.org/makefile -rw-r--r-- 3.1 KiB
c9a7db72Phil Hagelberg Remove broken contributors link until we can get it fixed. 2 months ago
                                                                                
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
84
85
86
87
88
89
90
91
92
93
94
95
96
.DEFAULT_GOAL := build

TAGS := $(shell git --git-dir=./fennel/.git tag -l | grep '^[0-9]' | grep -v - | tac)
TAGDIRS := main $(foreach tag, $(TAGS), v${tag})

# which fennel/$.md files build a tag index
TAGSOURCES := changelog reference api

HTML := tutorial.html api.html reference.html lua-primer.html changelog.html \
	setup.html rationale.html
LUA := fennelview.lua

# This requires pandoc 2.0+
PANDOC ?= pandoc --syntax-definition fennel-syntax.xml \
	-H head.html -A foot.html -T "Fennel" \
	--lua-filter=promote-h1-to-title.lua

fennel/fennel: ; make -C fennel fennel

index.html: main.fnl sample.html fennel/fennel
	fennel/fennel main.fnl $(TAGDIRS) > index.html
%.lua: fennel/%.fnl fennel/fennel ; fennel/fennel --compile $< > $@

%.html: fennel/%.md ; $(PANDOC) --toc -o $@ $^

# Special overrides; for instance rationale does not need a TOC
rationale.html: fennel/rationale.md ; $(PANDOC) -o $@ $^

# TODO: for now all main and tags are generated the same;
# there might be time, when we have "generations" of fennel

%/tag-intro.md: fennel/fennel ; fennel/fennel tag-intro.fnl $@ > $@
%/repl.md: repl.md ; cp $^ $@
%/init.lua: init.lua ; cp $^ $@
%/repl.fnl: repl.fnl ; cp $^ $@
%/fennelview.lua: %/fennel/fennelview.fnl %/fennel/fennel
	$*/fennel/fennel --compile $< > $@

v%/fennel:
	git clone --branch $* fennel $@
	make -C $(@D) fennel
	touch setup.md # not all tags have this

main/fennel:
	git clone --branch main fennel $@
	make -C $(@D) fennel

v%/index.html: v%/tag-intro.md v%/repl.md $(foreach md, $(TAGSOURCES), \
		v%/fennel/${md}.md)
	$(PANDOC) -o $@ $^

main/index.html: main/tag-intro.md main/repl.md \
		$(foreach md, $(TAGSOURCES), main/fennel/${md}.md)
	$(PANDOC) -o $@ $^ && rm main/tag-intro.md

tagdirs: ; $(foreach tagdir, $(TAGDIRSS), mkdir -p ${tagdir})
cleantagdirs: ; $(foreach tagdir, $(TAGDIRS), rm -rf ${tagdir})
tags: tagdirs $(foreach tagdir, $(TAGDIRS), ${tagdir}/fennel)
TAGDOCS := $(foreach tagdir, $(TAGDIRS), \
	$(foreach file, index.html init.lua repl.fnl fennelview.lua, \
		${tagdir}/${file}))

build: html lua tagdocs
html: $(HTML) index.html
tagdocs: tags $(TAGDOCS)
lua: $(LUA)
clean: cleantagdirs ; rm -f $(HTML) index.html $(LUA)

upload: $(HTML) $(LUA) $(TAGDIRS) index.html init.lua repl.fnl fennel.css \
		fengari-web.js repl-worker.js repl-worker.lua .htaccess fennel
	rsync -r $^ fenneler@fennel-lang.org:fennel-lang.org/

conf/%.html: conf/%.fnl fennel/fennel ; fennel/fennel $< > $@

conf/thanks.html: conf/thanks.fnl fennel/fennel ; fennel/fennel $< > $@
conf/signup.cgi: conf/signup.fnl fennel/fennel
	echo "#!/usr/bin/env lua" > $@
	fennel/fennel --compile $< >> $@
	chmod 755 $@

uploadconf: conf/*.html conf/*.jpg conf/.htaccess fennelview.lua conf/signup.cgi
	rsync $^ fenneler@fennel-lang.org:conf.fennel-lang.org/

uploadv: conf/v
	rsync -r $^ fenneler@fennel-lang.org:conf.fennel-lang.org/

pullsignups:
	ls signups/ | wc -l
	rsync -rv fenneler@fennel-lang.org:conf.fennel-lang.org/signups/*fnl signups/
	ls signups/ | wc -l
	fennel signups.fnl

server: ; python -m SimpleHTTPServer 3003

.PHONY: build html tagdirs tagdocs lua clean cleantagdirs server \
		upload uploadv uploadconf pullsignups