summaryrefslogtreecommitdiff
path: root/examples/Makefile
blob: 88812c1537f3e6c3ba0ba1c7d8b5701ba34c2b0d (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
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
# gipfelweb: static, CSS-only web galleries of gipfel-annotated
# images. Port of the historical examples/ pipeline to the Rust
# stack: gipfel-cli replaces the C binary, ImageMagick replaces
# netpbm + jhead (convert preserves the gipfel comment and EXIF).
#
# usage: put annotated *.jpg files (optionally per-image %.opts with
# extra gipfel-cli arguments and %.title with a display title) in a
# directory and run
#
#   make -f /path/to/gipfel/examples/Makefile gipfelweb
#
# variables:
#   GIPFEL_CLI  path to the gipfel-cli binary
#   DATA        hill database used for the peak view
#   GIPFEL2HTML html generator script

here        := $(dir $(lastword $(MAKEFILE_LIST)))
GIPFEL_CLI  ?= $(abspath $(here)../target/release/gipfel-cli)
DATA        ?= $(abspath $(here)../gipfel.dat)
GIPFEL2HTML ?= $(here)gipfel2html

images    := $(wildcard *.jpg)
slides    := $(addprefix gipfelweb/slides/, $(images))
thumbs    := $(addprefix gipfelweb/thumbs/, $(images))
positions := $(addprefix gipfelweb/gipfel/, $(addsuffix .pos, $(basename $(images))))
imgpos    := $(addprefix gipfelweb/gipfel/, $(addsuffix .imgs, $(basename $(images))))
hillpos   := $(addprefix gipfelweb/gipfel/, $(addsuffix .hills, $(basename $(images))))
html      := $(addprefix gipfelweb/, $(addsuffix .html, $(basename $(images))))

all:
	echo "make gipfelweb - create a HTML based view of gipfel oriented"
	echo "images in the current directory."

gipfelweb: dirs style $(slides) $(thumbs) $(imgpos) $(hillpos) $(html) gipfelweb/index.html

clean:
	rm -rf gipfelweb/gipfel

clobber:
	rm -rf gipfelweb

dirs:
	mkdir -p gipfelweb/slides
	mkdir -p gipfelweb/thumbs
	mkdir -p gipfelweb/gipfel

style: gipfelweb/style.css

gipfelweb/style.css: $(here)style.css
	cp $< $@

gipfelweb/slides/%.jpg: %.jpg
	convert $< -filter Lanczos -resize 20000x500\> -quality 94 $@

gipfelweb/thumbs/%.jpg: %.jpg
	convert $< -filter Point -resize 400x50\> -quality 80 $@

gipfelweb/gipfel/%.pos: %.jpg
	$(GIPFEL_CLI) export-position $< > $@

gipfelweb/gipfel/%.imgs: gipfelweb/slides/%.jpg %.opts gipfelweb/gipfel/index.gipfel
	$(GIPFEL_CLI) `cat $*.opts` export-hills $< -d $(DATA) -e gipfelweb/gipfel/index.gipfel > $@

gipfelweb/gipfel/%.imgs: gipfelweb/slides/%.jpg gipfelweb/gipfel/index.gipfel
	$(GIPFEL_CLI) export-hills $< -d $(DATA) -e gipfelweb/gipfel/index.gipfel > $@

gipfelweb/gipfel/%.hills: gipfelweb/slides/%.jpg %.opts
	$(GIPFEL_CLI) `cat $*.opts` export-hills $< -d $(DATA) > $@

gipfelweb/gipfel/%.hills: gipfelweb/slides/%.jpg
	$(GIPFEL_CLI) export-hills $< -d $(DATA) > $@

gipfelweb/gipfel/index.gipfel: $(positions)
	cat $(positions) > gipfelweb/gipfel/index.gipfel

gipfelweb/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.imgs gipfelweb/gipfel/%.hills %.title $(thumbs) gipfelweb/style.css
	$(GIPFEL2HTML) page $* > $@

gipfelweb/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.imgs gipfelweb/gipfel/%.hills $(thumbs) gipfelweb/style.css
	$(GIPFEL2HTML) page $* > $@

gipfelweb/index.html: $(thumbs) $(html)
	$(GIPFEL2HTML) gallery $(basename $(images)) > $@