-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakefileMPI
59 lines (40 loc) · 1.67 KB
/
MakefileMPI
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
CC = mpicc
CFLAGS = -Wall -DNDEBUG -fopenmp -pthread -lz -O3
OBJ_DIR = obj
TEST_DIR = tests
TEST_OBJ_DIR = $(TEST_DIR)/$(OBJ_DIR)
BIN_DIR = bin
DEPS = common.h db.h frontier.h game.h gameconstants.h mgz.h misc.h solver.h solvermpi.h tier.h tiersolver.h tiertree.h
_TEST_DEPS = db_test.h game_test.h tests.h tier_test.h tiersolver_test.h
TEST_DEPS = $(patsubst %, $(TEST_DIR)/%, $(_TEST_DEPS))
_CORE_OBJ = common.o db.o frontier.o game.o gameconstants.o mgz.o misc.o solver.o solvermpi.o tier.o tiersolver.o tiertree.o
CORE_OBJ = $(patsubst %, $(OBJ_DIR)/%, $(_CORE_OBJ))
# Main solver.
SOLVER_OBJ = $(OBJ_DIR)/mainmpi.o
_TEST_OBJ = db_test.o game_test.o tier_test.o tiersolver_test.o
TEST_OBJ = $(patsubst %, $(TEST_OBJ_DIR)/%, $(_TEST_OBJ))
# Module that querys the DB forever from STDIN.
QUERY_OBJ = $(TEST_OBJ_DIR)/query.o
# Module that runs an experimental program.
EXPERIMENT_OBJ = $(TEST_OBJ_DIR)/experiment.o
# Module that runs all tests.
TESTS_OBJ = $(TEST_OBJ_DIR)/tests.o
all: rule_solver rule_other
rule_solver: $(BIN_DIR)/solve
rule_other: $(BIN_DIR)/query $(BIN_DIR)/experiment $(BIN_DIR)/tests
.PHONY: clean
clean:
rm -f $(OBJ_DIR)/*.o $(TEST_OBJ_DIR)/*.o $(BIN_DIR)/* *~ core
$(BIN_DIR)/solve: $(CORE_OBJ) $(SOLVER_OBJ)
$(CC) -o $@ $^ $(CFLAGS)
$(BIN_DIR)/query: $(CORE_OBJ) $(TEST_OBJ) $(QUERY_OBJ)
$(CC) -o $@ $^ $(CFLAGS)
$(BIN_DIR)/tests: $(CORE_OBJ) $(TEST_OBJ) $(TESTS_OBJ)
$(CC) -o $@ $^ $(CFLAGS)
$(BIN_DIR)/experiment: $(CORE_OBJ) $(TEST_OBJ) $(EXPERIMENT_OBJ)
$(CC) -o $@ $^ $(CFLAGS)
# TODO: fine-grained headers
$(OBJ_DIR)/%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
$(TEST_OBJ_DIR)/%.o: $(TEST_DIR)/%.c $(DEPS) $(TEST_DEPS)
$(CC) -c -o $@ $< $(CFLAGS)