even better
[apps/madtty.git] / am / cflags.mk
1 ifneq (,$(filter gcc%,$(CC)))
2     _gccversion:=$(shell $(CC) -dumpversion)
3     _gccmachine:=$(shell $(CC) -dumpmachine)
4     _cobjs := .objs-$(_gccmachine:-linux-gnu=)-$(_gccversion)
5
6     # Use pipes and not temp files.
7     CFLAGS += -pipe
8     # optimize even more
9     CFLAGS += -O2
10     # let the type char be unsigned by default
11     CFLAGS += -funsigned-char
12     CFLAGS += -fstrict-aliasing
13     # turn on all common warnings
14     CFLAGS += -Wall
15     # turn on extra warnings
16     CFLAGS += $(if $(filter 4.%,$(GCCVERSION)),-W,-Wextra)
17     # treat warnings as errors
18     CFLAGS += -Werror
19     CFLAGS += -Wchar-subscripts
20     # warn about undefined preprocessor identifiers
21     CFLAGS += -Wundef
22     # warn about local variable shadowing another local variable
23     CFLAGS += -Wshadow
24     # warn about casting of pointers to increased alignment requirements
25     CFLAGS += -Wcast-align
26     # make string constants const
27     CFLAGS += -Wwrite-strings
28     # warn about implicit conversions with side effects
29     # fgets, calloc and friends take an int, not size_t...
30     #CFLAGS += -Wconversion
31     # warn about comparisons between signed and unsigned values
32     CFLAGS += -Wsign-compare
33     # warn about unused declared stuff
34     CFLAGS += -Wunused
35     # don not warn about unused return value
36     CFLAGS += -Wno-unused-value
37     # warn about variable use before initialization
38     CFLAGS += -Wuninitialized
39     # warn about pointer arithmetic on void* and function pointers
40     CFLAGS += -Wpointer-arith
41     # warn about multiple declarations
42     CFLAGS += -Wredundant-decls
43     # warn if the format string is not a string literal
44     CFLAGS += -Wformat-nonliteral
45     # do not warn about strftime format with y2k issues
46     CFLAGS += -Wno-format-y2k
47
48     CFLAGS += -I$(DEPTH)
49 else
50     CFLAGS += -Wall
51     _cobjs := .objs
52 endif
53
54 LDFLAGS += -Wl,--warn-common