-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·47 lines (37 loc) · 1.15 KB
/
Makefile
File metadata and controls
executable file
·47 lines (37 loc) · 1.15 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
CC=g++
CC64=CC
CFLAGS=-O2 -march=native -std=c++0x -D_hypot=hypot
OMPFLAGS=-fopenmp
C64FLAGS=$(CFLAGS)
BOOST_GRAPH=-Ilibs/boost/graph/include
BOOST_ANY=-L/lib/libboost*
DEBUGFLAGS=-g -O0 -std=c++0x
PROFILEFLAGS=-pg
OBJS=uspr uspr_neighbors
.PHONY: debug
.PHONY: profile
.PHONY: test
.PHONY: test_trees/%.test
.PHONY: clean
.PHONY: all
.PHONY: default
all: $(OBJS)
all-tests := $(addsuffix .test_out, $(basename $(wildcard test_trees/*.test)))
boost-any := $(addprefix -I, $(basename $(wildcard boost/libs/*/include/)))
LFLAGS=$(boost-any)
uspr: uspr.cpp *.h
$(CC) $(LFLAGS) $(CFLAGS) -o uspr uspr.cpp
uspr_neighbors: uspr_neighbors.cpp *.h
$(CC) $(LFLAGS) $(CFLAGS) -o uspr_neighbors uspr_neighbors.cpp
debug:
$(CC) $(LFLAGS) $(DEBUGFLAGS) -o uspr uspr.cpp
profile:
$(CC) $(LFLAGS) $(DEBUGFLAGS) $(PROFILEFLAGS) -o uspr uspr.cpp
test: $(all-tests)
@echo "Success, all tests passed."
test_trees/%.test_out : test_trees/%.tre test_trees/%.test uspr
@./uspr <$< 2>&1 > $@ && diff -1 $(addsuffix .test, $(basename $<)) $@ || \
(echo "Test $@ failed" && exit 1)
@echo "Test $@ passed"
clean:
@rm $(OBJS) test_trees/*.test_out 2> /dev/null || echo > /dev/null