-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·52 lines (40 loc) · 980 Bytes
/
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
CC = gcc
CFILES=$(shell ls *.c)
PROGS=$(CFILES:%.c=%)
#compiler version
CFLAGS =-Wall -Wextra
ifdef OPTIMIZATION_LEVEL
CFLAGS:= $(CFLAGS) -o$(OPTIMIZATION_LEVEL)
else
CFLAGS:= $(CFLAGS) -o0 #no optimization
endif
ifdef CUSTOM_MALLOC
CFLAGS:= $(CFLAGS) -DCUSTOM_MALLOC=1
CFLAGS:= $(CFLAGS) -Xlinker --wrap=malloc -Xlinker --wrap=free
endif
#code version
ifdef DEBUG
CFLAGS:= $(CFLAGS) -DDEBUG=$(DEBUG)
else
CFLAGS:= $(CFLAGS) -DDEBUG=0
endif
ifdef CODE_BASIC
CFLAGS:= $(CFLAGS) -DCODE_BASIC=$(CODE_BASIC)
else
CFLAGS:= $(CFLAGS) -DCODE_BASIC=0
endif
ifdef LOCK_MEMORY
CFLAGS:= $(CFLAGS) -DLOCK_MEMORY=$(LOCK_MEMORY)
else
CFLAGS:= $(CFLAGS) -DLOCK_MEMORY=0
endif
CFLAGS:= $(CFLAGS) -DCACHE_LINE_SIZE=$(shell getconf LEVEL1_DCACHE_LINESIZE)
install:sum_over_arrays_basic
sum_over_arrays_basic:$(CFILES)
$(CC) $(CFLAGS) -o $@ $^ -lm -lrt -pthread
sum_over_arrays_clean:
rm sum_over_arrays_basic
clean:
make sum_over_arrays_clean
clean_all:
make sum_over_arrays_clean