summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: fb82b2dba5c4666f39164e03f7089a027dbed794 (plain)
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
# Maintenance of the QUIP module and its generated HTML docs.
# Expects GNU make, run on Unix (so #!/usr/bin/env ... scripts work)
# See ReadMe.rst for further details.
default: html
.PHONY: html

HTMLDIR ?= ../html
# Don't print setup commands as they are run, unless VERBOSE is set:
ifeq ($(VERBOSE),)
Q ?= @
endif

RST := $(wildcard quip-[0-9][0-9][0-9][0-9]*.rst)
RSTHTML := $(RST:%.rst=$(HTMLDIR)/%.html)
HTML := $(HTMLDIR)/quip-0000.html $(RSTHTML)
WEBLINK := favicon.ico \
	cookiebar-x.png cookie_small.png list_arrow.png theqtcompany.png \
	extras.js main.js modernizr.custom.84855.js \
	online.css style.css \
	images
LINK := $(HTMLDIR)/.web $(HTMLDIR)/index.html $(WEBLINK:%=$(HTMLDIR)/%)

html: $(HTML) $(LINK)
$(HTML) $(LINK): $(HTMLDIR)/.ready
$(WEBLINK:%=$(HTMLDIR)/%) $(WEBLINK:%=$(HTMLDIR)/.web/%): $(HTMLDIR)/.web

%/.ready:
	$Q mkdir -p $(@D) && touch $@

$(HTMLDIR)/index.html: $(HTMLDIR)/quip-0000.html
	$Q [ -h $@ ] || (cd $(@D) && ln -s $(<F) $(@F))
$(WEBLINK:%=$(HTMLDIR)/%): $(HTMLDIR)/%: $(HTMLDIR)/.web/%
	$Q [ -h $@ ] || (cd $(@D) && ln -s .web/$(@F) $(@F))
$(HTMLDIR)/.web: planetqt/website
	$Q [ -h $@ ] || (cd $(@D) && ln -s $(abspath $<) $(@F))

$(HTMLDIR)/quip-0000.html: scripts/gen-quip-0000.py scripts/quip2html.py $(RST) template.html
	scripts/gen-quip-0000.py $(RST) | scripts/quip2html.py - >$@
$(RSTHTML): $(HTMLDIR)/%.html: %.rst scripts/quip2html.py template.html
	scripts/quip2html.py $< >$@

.INTERMEDIATE: scripts/template.html
template.html: scripts/template.diff planetqt/template.qt
	$Q patch -l -p0 -i $< -o scripts/$@ && mv scripts/$@ $@
# We only stomp template.html if patch succeeds.

clean:
	$Q rm -f scripts/template.html template.html
	$Q echo "Remove the generated HTML (perhaps in $(HTMLDIR)) yourself"

planetqt/template.qt planetqt/website:
	$Q echo "Please see ReadMe.rst for submodule checkout instructions"; false
# The false is to stop the build dead if planetqt/ is missing.

# TODO: we need a non-heroku site (QTWEBSITE-978)
HTMLURL ?= http://quips-qt-io.herokuapp.com/
check: html
	checklink -qbr $(HTMLURL) 2>&1 | grep -wv 'Use of uninitialized value .*/checklink line'