summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-II/2-SeamCarving/Makefile
blob: 335e05efbad047b08f3828cc5211febaed40bdec (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

CC	= javac
ALGS4	= ../../algs4
BIN	= SeamCarver
SRCS	= SeamCarver.java
CLASSES	= PrintEnergy.class PrintSeams.class ResizeDemo.class SCUtility.class ShowEnergy.class ShowSeams.class
CLASSPATH	= -classpath '.:$(ALGS4)/algs4.jar:$(ALGS4)/stdlib.jar'

.SUFFIXES:
.SUFFIXES: .java .class
.PHONY: clean $(BIN)

.java.class:
	$(CC) -Xlint $(CLASSPATH) $<
	$(ALGS4)/bin/checkstyle $<

$(BIN): $(BIN).class

check.sh:
	echo -e "#! /bin/bash\nF=./data/\$${1}\njava $(CLASSPATH) PrintSeams \$${F}.png > \$${F}.txt && diff -B \$${F}.txt \$${F}.printseams.txt && rm \$${F}.txt" > check.sh
	chmod +x check.sh

check: $(BIN) $(CLASSES) check.sh
	./check.sh 3x7
	./check.sh 4x6
	./check.sh 5x6
	./check.sh 6x5
	./check.sh 7x3
	./check.sh 10x12
	./check.sh 12x10
	./check.sh HJocean
	./check.sh HJoceanTransposed

test: $(BIN) $(CLASSES)
	java $(CLASSPATH) ResizeDemo ./data/HJocean.png 200 100

zip: $(BIN)
	$(ALGS4)/bin/findbugs $(BIN).class
	rm -f *.zip
	zip seamCarving.zip $(SRCS)

clean:
	rm -f *.class *.zip check.sh $(BIN)