-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathMakefile
73 lines (58 loc) · 2.4 KB
/
Makefile
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
TITLE = high-performance-go-workshop
LANG = en
OUTPUT = $(CURDIR)/output
COMMON = $(CURDIR)/common
SRCDIR = $(CURDIR)/src
EXAMPLEDIR = $(CURDIR)/examples
SRCFILES = $(wildcard $(SRCDIR)/*/*.go)
SITE = $(OUTPUT)/$(TITLE)
DOCBOOK = /opt/local/share/xsl/docbook-xsl-ns
STYLESHEET = $(DOCBOOK)/xhtml5/chunk.xsl
ICONS = $(DOCBOOK)/images
IMAGES = $(SITE)/images
DIRS = $(SITE) $(IMAGES) $(SITE)/$(LANG) $(OUTPUT)
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --contains --always)
GIT_DATE := $(shell git log -1 --format=%cd)
site: $(SITE)/$(TITLE).html $(IMAGES)/image-20180818145606919.png $(IMAGES)/jalopnik.png $(IMAGES)/cpu-performance.png $(IMAGES)/int_graph.png $(IMAGES)/stuttering.png $(IMAGES)/mandelbrot.png $(IMAGES)/cmos-inverter.png $(IMAGES)/power-density.png $(IMAGES)/gate-length.png $(IMAGES)/highrescpudies_fullyc_020-1105.png $(IMAGES)/mandelbrot.png $(IMAGES)/profile001.svg
mv $(SITE)/$(TITLE).html $(SITE)/gophercon-2019.html
rsync -az -e "ssh -o StrictHostKeyChecking=no -o ControlMaster=auto -o 'ControlPath=~/.ssh/cm_socket/%r@%h:%p' -o ControlPersist=yes" $(SITE) dave.cheney.net:/export/sites/cheney.net/dave/htdocs/
pdf: $(OUTPUT)/$(TITLE).pdf
epub: $(OUTPUT)/$(TITLE).epub
$(SITE)/%.html: $(LANG)/%.asciidoc $(CURDIR)/Makefile
docker run -it -v $(CURDIR):/documents -v $(OUTPUT):$(OUTPUT) asciidoctor/docker-asciidoctor \
asciidoctor -b html5 \
--failure-level=WARN \
-a revnumber=$(GIT_VERSION) \
-a exampledir=$(EXAMPLEDIR) \
-o $@ \
$<
$(OUTPUT)/%.pdf: $(LANG)/%.asciidoc $(wildcard $(COMMON)/*.asciidoc) $(CURDIR)/Makefile | $(OUTPUT)
docker run -it -v $(CURDIR):/documents -v $(OUTPUT):$(OUTPUT) asciidoctor/docker-asciidoctor \
asciidoctor-pdf \
-a revnumber=$(GIT_VERSION) \
-a exampledir=$(EXAMPLEDIR) \
-o $@ \
$<
$(OUTPUT)/%.epub: $(LANG)/%.asciidoc $(wildcard $(COMMON)/*.asciidoc) $(CURDIR)/Makefile | $(OUTPUT)
docker run -it -v $(CURDIR):/documents -v $(OUTPUT):$(OUTPUT) asciidoctor/docker-asciidoctor \
asciidoctor-epub3 \
-a revnumber=$(GIT_VERSION) \
-a exampledir=$(EXAMPLEDIR) \
-o $@ \
$<
$(SITE)/%.css: $(COMMON)/%.css | $(SITE)
install $< $@
$(IMAGES)/%.png: images/%.png | $(IMAGES)
install $< $@
$(IMAGES)/%.svg: images/%.svg | $(IMAGES)
install $< $@
fmt: $(SRCFILES)
gofmt -w -s $^
build: fmt | $(SRCFILES:.go=.o)
%.o: %.go
go tool compile -o $@ $<
$(DIRS):
install -d $@
clean:
rm -rf $(OUTPUT) $(SRCFILES:.go=.o)
.PHONY: rsync epub pdf