... | ... |
@@ -1,12 +1,18 @@ |
1 | 1 |
## Project specific variables |
2 | 2 |
PROG = sockchat |
3 |
+CSTD = c99 |
|
3 | 4 |
|
4 | 5 |
## Custom variable defaults |
5 | 6 |
BUILD ?= debug |
6 | 7 |
|
7 | 8 |
## Built-in variable defaults |
8 |
-CFLAGS += -std=c99 |
|
9 |
-CFLAGS += -Wall -Wextra -Werror -pedantic |
|
9 |
+WFLAGS += -Werror |
|
10 |
+WFLAGS += -Wpedantic -Wall -Wextra |
|
11 |
+WFLAGS += -Wconversion -Wno-sign-conversion |
|
12 |
+WFLAGS += -Wshadow |
|
13 |
+WFLAGS += -Wimplicit-fallthrough |
|
14 |
+WFLAGS += -Wvla |
|
15 |
+CFLAGS += $(WFLAGS) -std=$(CSTD) |
|
10 | 16 |
|
11 | 17 |
## Standard variable defaults |
12 | 18 |
PREFIX ?= /usr/local |
... | ... |
@@ -17,6 +23,7 @@ INSTALL_PROGRAM ?= $(INSTALL) |
17 | 23 |
## Build type |
18 | 24 |
ifeq ($(BUILD),debug) |
19 | 25 |
CFLAGS += -g |
26 |
+ CFLAGS += -fsanitize=signed-integer-overflow |
|
20 | 27 |
else ifeq ($(BUILD),release) |
21 | 28 |
CFLAGS += -DNDEBUG -O3 |
22 | 29 |
LDFLAGS += -s |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,38 @@ |
1 |
+## Project specific variables |
|
2 |
+PROG = sockchat |
|
3 |
+ |
|
4 |
+## Custom variable defaults |
|
5 |
+BUILD ?= debug |
|
6 |
+ |
|
7 |
+## Built-in variable defaults |
|
8 |
+CFLAGS += -Wall -Wextra -Werror -pedantic |
|
9 |
+ |
|
10 |
+## Standard variable defaults |
|
11 |
+PREFIX ?= /usr/local |
|
12 |
+DESTDIR ?= |
|
13 |
+INSTALL ?= install |
|
14 |
+INSTALL_PROGRAM ?= $(INSTALL) |
|
15 |
+ |
|
16 |
+## Build type |
|
17 |
+ifeq ($(BUILD),debug) |
|
18 |
+ CFLAGS += -g |
|
19 |
+else ifeq ($(BUILD),release) |
|
20 |
+ CFLAGS += -DNDEBUG -O3 |
|
21 |
+ LDFLAGS += -s |
|
22 |
+endif |
|
23 |
+ |
|
24 |
+## Standard targets |
|
25 |
+ |
|
26 |
+.PHONY: all |
|
27 |
+all: $(PROG) |
|
28 |
+ |
|
29 |
+.PHONY: install |
|
30 |
+install: all |
|
31 |
+ $(INSTALL_PROGRAM) -D -t $(DESTDIR)$(PREFIX)/bin $(PROG) |
|
32 |
+ |
|
33 |
+.PHONY: clean |
|
34 |
+clean: |
|
35 |
+ |
|
36 |
+.PHONY: distclean |
|
37 |
+distclean: clean |
|
38 |
+ $(RM) $(PROG) |