makefile 2.93 KB
Newer Older
Michael Murtaugh's avatar
Michael Murtaugh committed
1

2 3
all: README.html

4 5 6 7 8 9 10 11 12 13

################
# RULES TO MAKE THE TOOLS

bin = bin/channel bin/contours bin/houghlines bin/texture

bin: $(bin)

bin/channel:
	$(MAKE) -C channel all
14
	mkdir -p bin
15 16 17 18
	cp channel/channel bin

bin/contours:
	$(MAKE) -C contours all
19
	mkdir -p bin
20 21 22 23 24
	cp contours/contours bin

bin/houghlines:
	mkdir -p houghlines/build
	cd houghlines/build && cmake .. && make
25
	mkdir -p bin
26 27 28 29 30
	cp houghlines/build/houghlines bin

bin/texture:
	mkdir -p texture/build
	cd texture/build && cmake .. && make
31
	mkdir -p bin
32 33 34 35 36
	cp texture/build/texture bin

########################

# markdown to HTML (for docs)
37 38 39 40
%.html: %.md
	pandoc --self-contained $< -o $@


41 42
#################################
# RULES to USE the tools
43

44
# contours
45
%.contours.svg: %.png
46
	bin/contours $< > $@
47
%.contours.svg: %.jpg
48
	bin/contours $< > $@
49

50
# texture (& lexicality, textline, para, block
51
%.texture.svg: %.png
52
	bin/texture $< $*.texture.svg $*.lexicality.svg $*.textline.svg $*.para.svg $*.block.svg
53
%.texture.svg: %.jpg
54
	bin/texture $< $*.texture.svg $*.lexicality.svg $*.textline.svg $*.para.svg $*.block.svg
55

56
# channel
57
%.red.png: %.png
58
	bin/channel $< $*.red.png $*.green.png $*.blue.png
59
%.red.png: %.jpg
60
	bin/channel $< $*.red.png $*.green.png $*.blue.png
61
%.green.png: %.png
62
	bin/channel $< $*.red.png $*.green.png $*.blue.png
63
%.green.png: %.jpg
64
	bin/channel $< $*.red.png $*.green.png $*.blue.png
65
%.blue.png: %.png
66
	bin/channel $< $*.red.png $*.green.png $*.blue.png
67
%.blue.png: %.jpg
68
	bin/channel $< $*.red.png $*.green.png $*.blue.png
69

70 71 72
# houghlines
# Z3.hough.png <= Z3.png
# Z3.hough.X0Y0.png <= Z3.hough.png
73
%.hough.svg: %.jpg
74
	bin/houghlines $< > $@
75
%.hough.svg: %.png
76
	bin/houghlines $< > $@
77

78 79 80 81 82 83 84 85 86
# gradient: NEEDS WORK
# %.gradient.png: %.jpg
# 	python imagegradient/imagegradient.py --output $*.gradient.png --svg $*.gradient.svg $<
%.gradient.svg: %.jpg
	python imagegradient/imagegradient.py --svg $*.gradient.svg $< 
# %.gradient.png: %.png
# 	python imagegradient/imagegradient.py --output $*.gradient.png --svg $*.gradient.svg $<
%.gradient.svg: %.png
	python imagegradient/imagegradient.py --svg $*.gradient.svg $<
87

88 89 90
################################
# VIEWER rules
# pyramid rules
91 92 93

TILESIZE=128

Michael Murtaugh's avatar
Michael Murtaugh committed
94 95 96
.PRECIOUS: %/Z0.png %/Z1.png %/Z2.png %/Z3.png %/Z4.png %/Z5.png
%/Z0.png: %.png
	mkdir -p $*
97
	python viewer/pyramid.py $< --tilesize $(TILESIZE) --output "$*/Z{z}.png"
Michael Murtaugh's avatar
Michael Murtaugh committed
98 99 100

%/Z0.png: %.jpg
	mkdir -p $*
101
	python viewer/pyramid.py $< --tilesize $(TILESIZE) --output "$*/Z{z}.png"
Michael Murtaugh's avatar
Michael Murtaugh committed
102 103 104 105 106 107 108

# SVG to png
%.png: %.svg
	inkscape --export-background-opacity=0.0 --export-png=$@ $<

# tile rule
%.X0Y0.png : %.png
109
	python viewer/tile.py $< --tilesize $(TILESIZE) --output "$*.X{x}Y{y}.png"
Michael Murtaugh's avatar
Michael Murtaugh committed
110 111

# make the map
112
%.html: %.png
Michael Murtaugh's avatar
Michael Murtaugh committed
113 114
	mkdir -p $*
	python viewer/makeviewer.py \
115
		--tilesize $(TILESIZE) \
Michael Murtaugh's avatar
Michael Murtaugh committed
116 117 118 119 120
		--template viewer/map.html \
		--output $@ $<
%.html: %.jpg
	mkdir -p $*
	python viewer/makeviewer.py \
121
		--tilesize $(TILESIZE) \
Michael Murtaugh's avatar
Michael Murtaugh committed
122 123 124 125
		--template viewer/map.html \
		--output $@ $<

%/error.jpg:
126
	convert -size $(TILESIZE)x$(TILESIZE) canvas:red $@