-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (51 loc) · 2.08 KB
/
Makefile
File metadata and controls
69 lines (51 loc) · 2.08 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
######################################################################################
# DEP = all the objects that we want watched for changes, which will trigger a rebuild
# SRC = all source objects we want included in the final executable
######################################################################################
DEP= forsort-rotate.h forsort-insert.h forsort-basic.h forsort-merge.h forsort-stable.h
SRC= forsort.c \
main.c \
nqsort.c \
timsort.c \
blitsort.c \
WikiSort.c \
timsort_r.c \
grail_sort.c
INCDIR= include
SRCDIR= src
OBJDIR= obj
######################################################################################
# What we want the final executable to be called
######################################################################################
BIN=ts
######################################################################################
# COMPILE TIME OPTION FLAGS
######################################################################################
#CC= gcc
CC=clang
CC_OPT_FLAGS= -O3 -mtune=native -flto -fno-semantic-interposition -mavx512f
LD_OPT_FLAGS= -O3 -mtune=native -flto -fno-semantic-interposition -mavx512f
DEBUG_FLAGS= -Wall # -g -pg --profile -fprofile-arcs -ftest-coverage
LIBS=
######################################################################################
# The rules to make it all work. Should rarely need to edit anything below this line
######################################################################################
CFLAGS= -I$(INCDIR) $(DEBUG_FLAGS) $(CC_OPT_FLAGS)
LDFLAGS= $(DEBUG_FLAGS) $(LD_OPT_FLAGS)
DEPS= $(patsubst %,$(INCDIR)/%,$(DEP)) Makefile
_OBJ=$(SRC:.c=.o)
OBJ= $(patsubst %,$(OBJDIR)/%,$(_OBJ))
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(DEPS) | $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $<
$(BIN): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
$(OBJDIR):
mkdir -p $@
.PHONY: clean benchmark results
clean:
rm -f $(OBJDIR)/*.o gmon.out $(SRCDIR)/*~ core $(INCDIR)/*~ $(BIN) $(OBJDIR)/*.gcda $(OBJDIR)/*.gcno
(test -d $(OBJDIR) && rmdir $(OBJDIR)) || true
benchmark:
./benchmark.sh
results: benchmark
python ./generate_results.py