File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
# are we using clang?
2
2
ISCLANG := $(shell if $(CC ) --version | grep LLVM >/dev/null; then echo 1; else echo 0; fi)
3
3
4
- CC += -std=gnu11 -W -Wall -Wshadow
5
- CFLAGS ?= -g $(DEFS )
4
+ CFLAGS ?= -std=gnu11 -W -Wall -Wshadow -g $(DEFS )
6
5
O ?= -O3
7
6
ifeq ($(filter 0 1 2 3 s,$(O ) ) ,$(strip $(O ) ) )
8
7
override O := -O$(O )
9
8
endif
10
9
ifeq ($(SANITIZE ) ,1)
11
- CC += -fsanitize=address -fsanitize=undefined
10
+ ifeq ($(strip $(shell $(CC ) -fsanitize=address -x c -E /dev/null 2>&1 | grep sanitize=) ) ,)
11
+ CFLAGS += -fsanitize=address
12
+ else
13
+ $(info ** WARNING : Your C compiler does not support `-fsanitize=address`.)
14
+ endif
15
+ ifeq ($(strip $(shell $(CC ) -fsanitize=undefined -x c -E /dev/null 2>&1 | grep sanitize=) ) ,)
16
+ CFLAGS += -fsanitize=undefined
17
+ else
18
+ $(info ** WARNING : Your C compiler does not support `-fsanitize=undefined`.)
19
+ $(info ** You may want to install gcc-4.9 or greater.)
20
+ endif
12
21
endif
13
22
14
23
# these rules ensure dependencies are created
44
53
# cancel implicit rules we don't want
45
54
% : % .c
46
55
% .o : % .c
56
+ % : % .o
47
57
48
58
$(BUILDSTAMP ) :
49
59
@mkdir -p $(@D )
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ add: add.o
16
16
addu : addu.o
17
17
$(CC ) $(CFLAGS ) $(O ) -o $@ $^
18
18
19
+ fib : fib.o
20
+ $(CC ) $(CFLAGS ) $(O ) -o $@ $^
21
+
19
22
membench-% : membench.o mb-% .o
20
23
$(CC ) $(CFLAGS ) $(O ) -o $@ $^
21
24
You can’t perform that action at this time.
0 commit comments