1 # Hide full compilation line:
5 # To see full command lines, use make V=1
15 # rmdir only if dir is empty, tolerate failure
21 TARFLAGS ?= -v --ignore-failed-read -r
23 CROSS ?= arm-none-eabi-
32 UDEV_PREFIX ?= /etc/udev/rules.d
33 INSTALLBINRELPATH ?= bin
34 INSTALLSHARERELPATH ?= share/proxmark3
35 INSTALLFWRELPATH ?= share/proxmark3/firmware
36 INSTALLTOOLSRELPATH ?= share/proxmark3/tools
37 INSTALLDOCSRELPATH ?= share/doc/proxmark3
39 platform = $(shell uname)
40 DETECTED_OS=$(platform)
42 ifeq ($(platform),Darwin)
44 RANLIB= /usr/bin/ranlib
50 DEFCFLAGS = -Wall -O3 -fstrict-aliasing -pipe
51 # Some more warnings we want as errors:
52 DEFCFLAGS += -Wbad-function-cast -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wshadow -Wundef -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wtype-limits -Wold-style-definition
53 # Some more warnings we need first to eliminate, so temporarely tolerated:
54 DEFCFLAGS += -Wcast-align -Wno-error=cast-align
55 DEFCFLAGS += -Wswitch-enum -Wno-error=switch-enum
57 ifeq ($(platform),Darwin)
58 # their readline has strict-prototype issues
59 DEFCFLAGS += -Wno-strict-prototypes
61 DEFCFLAGS += -Wstrict-prototypes
64 # Next ones are activated only if GCCEXTRA=1 or CLANGEXTRA=1
66 EXTRACFLAGS += -Wunused-parameter -Wno-error=unused-parameter
67 EXTRACFLAGS += -Wsign-compare -Wno-error=sign-compare
68 EXTRACFLAGS += -Wconversion -Wno-error=conversion -Wno-error=sign-conversion -Wno-error=float-conversion
70 # unknown to clang or old gcc:
71 # First we activate Wextra then we explicitly list those we know about
72 # Those without -Wno-error are supposed to be completely solved
73 GCCEXTRACFLAGS = -Wextra
74 GCCEXTRACFLAGS += -Wclobbered -Wno-error=clobbered
75 GCCEXTRACFLAGS += -Wcast-function-type
76 GCCEXTRACFLAGS += -Wimplicit-fallthrough=3 -Wno-error=implicit-fallthrough
77 GCCEXTRACFLAGS += -Wmissing-parameter-type
78 GCCEXTRACFLAGS += -Wold-style-declaration -Wno-error=old-style-declaration
79 GCCEXTRACFLAGS += -Woverride-init
80 GCCEXTRACFLAGS += -Wshift-negative-value
81 GCCEXTRACFLAGS += -Wunused-but-set-parameter -Wno-error=unused-but-set-parameter
83 DEFCFLAGS += $(GCCEXTRACFLAGS) $(EXTRACFLAGS)
85 # unknown to gcc or old clang:
86 # First we activate Wextra then we explicitly list those we know about
87 # Those without -Wno-error are supposed to be completely solved
88 CLANGEXTRACFLAGS = -Wextra
89 CLANGEXTRACFLAGS += -Wtautological-type-limit-compare
90 CLANGEXTRACFLAGS += -Wnull-pointer-arithmetic
91 CLANGEXTRACFLAGS += -Woverride-init
92 CLANGEXTRACFLAGS += -Wshift-negative-value
93 CLANGEXTRACFLAGS += -Wimplicit-fallthrough
94 ifeq ($(CLANGEXTRA),1)
95 DEFCFLAGS += $(CLANGEXTRACFLAGS) $(EXTRACFLAGS)
97 ifeq ($(CLANGEVERYTHING),1)
98 DEFCFLAGS += -Weverything -Wno-error
101 DEFCFLAGS += -Wno-error