-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (24 loc) · 793 Bytes
/
Copy pathMakefile
File metadata and controls
33 lines (24 loc) · 793 Bytes
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
ifndef NTHREADS
NTHREADS=$(shell nproc --all 2>/dev/null || sysctl -n hw.logicalcpu)
endif
CFLAGS=-std=c17 -O2 -m64 -march=native -mtune=native -flto
CFLAGS+=-Wall -Wextra -Wconversion -Wformat -Wformat=2 -Wimplicit-fallthrough -Wvla
CFLAGS+=-DNTHREADS=$(NTHREADS)
ifdef DEBUG
CFLAGS+=-g -fno-omit-frame-pointer -fsanitize=address,undefined -fstack-protector-strong -fstack-clash-protection
CFLAGS+=-D_FORTIFY_SOURCE=3
endif
all: bin/ bin/create-sample bin/analyze bin/hash bin/memory_bandwidth
bin/:
mkdir -p bin/
bin/create-sample: create-sample.c
$(CC) $(CFLAGS) $^ -lm -o $@
bin/analyze: analyze.c
$(CC) $(CFLAGS) $^ -o $@
bin/hash: hash.c
$(CC) $(CFLAGS) $^ -o $@
bin/memory_bandwidth: memory_bandwidth.c
$(CC) $(CFLAGS) -std=gnu17 $^ -o $@
.PHONY: clean
clean:
rm -r bin/