-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (66 loc) · 2.63 KB
/
Makefile
File metadata and controls
91 lines (66 loc) · 2.63 KB
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
# Requires:
# - lualatex with tikz package
# - pdftocairo from poppler
# - svg2png
TEXOPTS := --synctex=1 -shell-escape --file-line-error --halt-on-error
THEMES := light dark bw 4c gray # bw = black&white; 4c = four colors
FILE = gaplogo.pdf gaplogo.svg gaplogo.png \
gaplogo-notext.pdf gaplogo-notext.svg gaplogo-notext.png \
gaplogo-notext-small.pdf gaplogo-notext-small.svg gaplogo-notext-small.png \
gaplogo-reduced.pdf gaplogo-reduced.svg gaplogo-reduced.png \
gaplogo-notext32.png gaplogo-notext512.png
DST := $(foreach T,$(THEMES),$(foreach F,$(FILE),output/$(T)/$(F)))
DST += output/icon/icon.pdf output/icon/icon.png output/icon/icon.ico
TEXINPUTS = $(PWD)/:
export TEXINPUTS
all: $(DST)
clean:
rm -f $(DST) */*.aux */*.log */*.synctex.gz
VARIANTS := \
gaplogo: \
gaplogo-notext:\def\NoTextMode{} \
gaplogo-notext-small:\def\NoTextMode{}\def\SmallIconMode{} \
gaplogo-reduced:\def\ReducedMode{}
define MAKE_GAPLOGO_RULE
output/$(1)/$(2).pdf: variant-node-colors.tex gaplogo.sty gaplogo-pic.tex
mkdir -p $$(@D)/.aux
lualatex $$(TEXOPTS) --jobname=$(2) --output-dir=$$(@D)/.aux "\def\Theme{$(1)}$(3)\input{$$<}"
mv $$(@D)/.aux/$(2).pdf $$@
endef
# Generate rules for every combination of theme and variant
$(foreach theme,$(THEMES),\
$(foreach v,$(VARIANTS),\
$(eval $(call MAKE_GAPLOGO_RULE,$(theme),$(word 1,$(subst :, ,$(v))),$(wordlist 2,99,$(subst :, ,$(v)))))\
)\
)
%.png: %.pdf
pdftocairo -png -transp -singlefile -r 1200 $< $(basename $@ .png)
%.svg: %.pdf
pdftocairo -svg $< $@
%/gaplogo-notext32.png: %/gaplogo-notext-small.svg
svg2png --width=32 --height=32 $< $@
%/gaplogo-notext48.png: %/gaplogo-notext-small.svg
svg2png --width=48 --height=48 $< $@
%/gaplogo-notext64.png: %/gaplogo-notext-small.svg
svg2png --width=64 --height=64 $< $@
%/gaplogo-notext128.png: %/gaplogo-notext.svg
svg2png --width=128 --height=128 $< $@
%/gaplogo-notext256.png: %/gaplogo-notext.svg
svg2png --width=256 --height=256 $< $@
%/gaplogo-notext512.png: %/gaplogo-notext.svg
svg2png --width=512 --height=512 $< $@
output/icon/icon.pdf: icon.tex gaplogo.sty gaplogo-pic.tex
mkdir -p $(@D)/.aux
lualatex $(TEXOPTS) --jobname=icon --output-dir=$(@D)/.aux $<
mv $(@D)/.aux/icon.pdf $@
output/icon/icon.png: output/icon/icon.pdf
pdftocairo -png -transp -singlefile -scale-to 512 $< $(basename $@ .png)
output/icon/icon.ico: output/icon/icon.png
magick $< $@
.PHONY: all clean
########################################################################
# Makefile debugging trick:
# call print-VARIABLE to see the runtime value of any variable
########################################################################
print-%:
@echo '$*=$($*)'