1 ###################### 2# 3# Settings 4# 5# 6 7LIBNAME = libnmea.so 8LIBNAMESTATIC = libnmea.a 9 10 11###################### 12# 13# Highlevel configuration options for all 14# 15# 16 17# activate debugging with 1 or deactivate with 0 18DEBUG ?= 1 19 20# set NOSTRIP to non-zero to inhibit stripping the binaries 21NOSTRIP ?= 0 22 23# shows full compiler/linker calls if activated 24VERBOSE ?= 0 25 26ifeq ($(VERBOSE),0) 27MAKECMDPREFIX = @ 28else 29MAKECMDPREFIX = 30endif 31 32###################### 33# 34# Lowlevel options and rules 35# 36 37ifeq ($(DEBUG),0) 38 ifeq ($(NOSTRIP),0) 39 STRIP ?= strip 40 else 41 STRIP ?= : 42 endif 43else 44STRIP ?= : 45endif 46 47 48# we expect the version to be like 'v0.5.3-27-g0c2727a' and then strip the 'v', 49# and the '-27-g0c2727a' parts 50VERSION=3.0.0 51 52# protect against no version number 53ifeq ($(strip $(VERSION)),) 54VERSION=0.0.0 55endif 56 57CC ?= gcc 58 59GCCVERSIONGTEQ6 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 6) 60 61COMMONCFLAGS += -Wall -Wextra -Wold-style-definition -Wdeclaration-after-statement -Wmissing-prototypes \ 62 -Wstrict-prototypes -Wmissing-declarations -Wsign-compare -Waggregate-return -Wmissing-noreturn \ 63 -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wendif-labels -Wwrite-strings \ 64 -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wshadow -Wformat -Wsequence-point -Wcast-align \ 65 -Wnested-externs -Winline -Wdisabled-optimization -funit-at-a-time -fPIC -ggdb -Wformat=2 -Winit-self \ 66 -Wswitch-default -Wswitch-enum -Wconversion -Wdouble-promotion \ 67 -Werror=format-security -Wformat-security -Wformat-y2k -Wredundant-decls -Wundef -Wunreachable-code \ 68 -Wunused-parameter 69 70GCCCFLAGS += $(COMMONCFLAGS) -fearly-inlining -finline-functions-called-once -finline-limit=350 -Wtrampolines \ 71 -Wsync-nand -Wlogical-op -Wjump-misses-init -Werror 72 73ifeq "$(GCCVERSIONGTEQ6)" "1" 74GCCCFLAGS += -Wnull-dereference -Wshift-negative-value -Wshift-overflow -Wtautological-compare 75GCCCFLAGS += -Wmisleading-indentation -Wduplicated-cond 76endif 77 78CLANGCFLAGS := $(COMMONCFLAGS) 79 80ifdef COV 81CFLAGS += -fprofile-arcs -ftest-coverage 82LDFLAG += -lgov 83endif 84 85ifneq ($(CC),clang) 86CFLAGS += $(GCCCFLAGS) 87else 88CFLAGS += $(CLANGCFLAGS) 89endif 90 91ifeq ($(DEBUG),0) 92CFLAGS += -O2 93else 94CFLAGS += -O0 95endif 96 97LDFLAGS = -shared -Wl,--warn-common -fPIC 98 99# 32/64 cross compilation 100ifdef M32 101CFLAGS += -m32 102LDFLAGS += -m32 103endif 104ifdef M64 105CFLAGS += -m64 106LDFLAGS += -m64 107endif 108 109 110export COV 111export DEBUG 112export M32 113export M64 114export VERBOSE 115