-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (36 loc) · 1.24 KB
/
Makefile
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
# $ make
# $ make install (copy into bin directory)
CC = clang
LINK = clang
INSTALL = install
GMPLIB = -L/usr/local/lib -lgmp -lmpfr
CFLAGS = -Wall -Wunused -I../include -I. #-march=native -mtune=native -ggdb for debug, -O3 for release
LFLAGS = $(GMPLIB) #-march=native -mtune=native
BIN = bin
OBJ = obj
SRC = src
.PHONY: ensure_dirs clean
all: ensure_dirs $(BIN)/ranked_tree
# Generate object files
$(OBJ)/main.o: $(SRC)/main.c
$(CC) $(CFLAGS) -o $@ -c $^
$(OBJ)/hash_table.o: $(SRC)/hash_table.c
$(CC) $(CFLAGS) -o $@ -c $^
$(OBJ)/traits.o: $(SRC)/traits.c
$(CC) $(CFLAGS) -o $@ -c $^
$(OBJ)/monitored_memory.o: $(SRC)/monitored_memory.c
$(CC) $(CFLAGS) -o $@ -c $^
$(OBJ)/newick_tree.o: $(SRC)/newick_tree.c
$(CC) $(CFLAGS) -o $@ -c $^
$(OBJ)/getopt.o: $(SRC)/getopt.c
$(CC) $(CFLAGS) -o $@ -c $^
$(OBJ)/lca.o: $(SRC)/lca.c
$(CC) $(CFLAGS) -o $@ -c $^
# Build binaries
$(BIN)/ranked_tree: $(OBJ)/newick_tree.o $(OBJ)/main.o $(OBJ)/traits.o $(OBJ)/getopt.o $(OBJ)/monitored_memory.o $(OBJ)/hash_table.o $(OBJ)/lca.o
$(LINK) $(LFLAGS) -o $@ $^
ensure_dirs:
@if [ ! -d $(BIN) ]; then mkdir $(BIN); fi
@if [ ! -d $(OBJ) ]; then mkdir $(OBJ); fi
clean:
rm -rf $(OBJ)/*.o $(BIN)/ranked_tree