Merge branch 'ab/makefile-help-devs-more'
CFLAGS now can be tweaked when invoking Make while using DEVELOPER=YesPlease; this did not work well before. * ab/makefile-help-devs-more: Makefile: allow for combining DEVELOPER=1 and CFLAGS="..." Makefile: move the setting of *FLAGS closer to "include" Makefile: Move *_LIBS assignment into its own section Makefile: add/remove comments at top and tweak whitespace Makefile: move "strip" assignment down from flags Makefile: remove an out-of-date commentmaint
commit
3cef67694c
63
Makefile
63
Makefile
|
@ -479,7 +479,11 @@ all::
|
||||||
#
|
#
|
||||||
# Define DEVELOPER to enable more compiler warnings. Compiler version
|
# Define DEVELOPER to enable more compiler warnings. Compiler version
|
||||||
# and family are auto detected, but could be overridden by defining
|
# and family are auto detected, but could be overridden by defining
|
||||||
# COMPILER_FEATURES (see config.mak.dev)
|
# COMPILER_FEATURES (see config.mak.dev). You can still set
|
||||||
|
# CFLAGS="..." in combination with DEVELOPER enables, whether that's
|
||||||
|
# for tweaking something unrelated (e.g. optimization level), or for
|
||||||
|
# selectively overriding something DEVELOPER or one of the DEVOPTS
|
||||||
|
# (see just below) brings in.
|
||||||
#
|
#
|
||||||
# When DEVELOPER is set, DEVOPTS can be used to control compiler
|
# When DEVELOPER is set, DEVOPTS can be used to control compiler
|
||||||
# options. This variable contains keywords separated by
|
# options. This variable contains keywords separated by
|
||||||
|
@ -506,17 +510,8 @@ GIT-VERSION-FILE: FORCE
|
||||||
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
||||||
-include GIT-VERSION-FILE
|
-include GIT-VERSION-FILE
|
||||||
|
|
||||||
# CFLAGS and LDFLAGS are for the users to override from the command line.
|
# Set our default configuration.
|
||||||
|
#
|
||||||
CFLAGS = -g -O2 -Wall
|
|
||||||
LDFLAGS =
|
|
||||||
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
|
|
||||||
ALL_LDFLAGS = $(LDFLAGS)
|
|
||||||
STRIP ?= strip
|
|
||||||
|
|
||||||
# Create as necessary, replace existing, make ranlib unneeded.
|
|
||||||
ARFLAGS = rcs
|
|
||||||
|
|
||||||
# Among the variables below, these:
|
# Among the variables below, these:
|
||||||
# gitexecdir
|
# gitexecdir
|
||||||
# template_dir
|
# template_dir
|
||||||
|
@ -561,6 +556,7 @@ perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
|
||||||
|
|
||||||
export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
|
export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
|
||||||
|
|
||||||
|
# Set our default programs
|
||||||
CC = cc
|
CC = cc
|
||||||
AR = ar
|
AR = ar
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
|
@ -573,29 +569,14 @@ TCLTK_PATH = wish
|
||||||
XGETTEXT = xgettext
|
XGETTEXT = xgettext
|
||||||
MSGFMT = msgfmt
|
MSGFMT = msgfmt
|
||||||
CURL_CONFIG = curl-config
|
CURL_CONFIG = curl-config
|
||||||
PTHREAD_LIBS = -lpthread
|
|
||||||
PTHREAD_CFLAGS =
|
|
||||||
GCOV = gcov
|
GCOV = gcov
|
||||||
|
STRIP = strip
|
||||||
SPATCH = spatch
|
SPATCH = spatch
|
||||||
|
|
||||||
export TCL_PATH TCLTK_PATH
|
export TCL_PATH TCLTK_PATH
|
||||||
|
|
||||||
# user customisation variable for 'sparse' target
|
# Set our default LIBS variables
|
||||||
SPARSE_FLAGS ?=
|
PTHREAD_LIBS = -lpthread
|
||||||
# internal/platform customisation variable for 'sparse'
|
|
||||||
SP_EXTRA_FLAGS =
|
|
||||||
|
|
||||||
SPATCH_FLAGS = --all-includes --patch .
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### --- END CONFIGURATION SECTION ---
|
|
||||||
|
|
||||||
# Those must not be GNU-specific; they are shared with perl/ which may
|
|
||||||
# be built by a different compiler. (Note that this is an artifact now
|
|
||||||
# but it still might be nice to keep that distinction.)
|
|
||||||
BASIC_CFLAGS = -I.
|
|
||||||
BASIC_LDFLAGS =
|
|
||||||
|
|
||||||
# Guard against environment variables
|
# Guard against environment variables
|
||||||
BUILTIN_OBJS =
|
BUILTIN_OBJS =
|
||||||
|
@ -1177,6 +1158,25 @@ ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/s
|
||||||
DC_SHA1_SUBMODULE = auto
|
DC_SHA1_SUBMODULE = auto
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
|
||||||
|
# tweaked by config.* below as well as the command-line, both of
|
||||||
|
# which'll override these defaults.
|
||||||
|
CFLAGS = -g -O2 -Wall
|
||||||
|
LDFLAGS =
|
||||||
|
BASIC_CFLAGS = -I.
|
||||||
|
BASIC_LDFLAGS =
|
||||||
|
|
||||||
|
# library flags
|
||||||
|
ARFLAGS = rcs
|
||||||
|
PTHREAD_CFLAGS =
|
||||||
|
|
||||||
|
# For the 'sparse' target
|
||||||
|
SPARSE_FLAGS ?=
|
||||||
|
SP_EXTRA_FLAGS =
|
||||||
|
|
||||||
|
# For the 'coccicheck' target
|
||||||
|
SPATCH_FLAGS = --all-includes --patch .
|
||||||
|
|
||||||
include config.mak.uname
|
include config.mak.uname
|
||||||
-include config.mak.autogen
|
-include config.mak.autogen
|
||||||
-include config.mak
|
-include config.mak
|
||||||
|
@ -1185,6 +1185,9 @@ ifdef DEVELOPER
|
||||||
include config.mak.dev
|
include config.mak.dev
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
|
||||||
|
ALL_LDFLAGS = $(LDFLAGS)
|
||||||
|
|
||||||
comma := ,
|
comma := ,
|
||||||
empty :=
|
empty :=
|
||||||
space := $(empty) $(empty)
|
space := $(empty) $(empty)
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
ifeq ($(filter no-error,$(DEVOPTS)),)
|
ifeq ($(filter no-error,$(DEVOPTS)),)
|
||||||
CFLAGS += -Werror
|
DEVELOPER_CFLAGS += -Werror
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter pedantic,$(DEVOPTS)),)
|
ifneq ($(filter pedantic,$(DEVOPTS)),)
|
||||||
CFLAGS += -pedantic
|
DEVELOPER_CFLAGS += -pedantic
|
||||||
# don't warn for each N_ use
|
# don't warn for each N_ use
|
||||||
CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
DEVELOPER_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
||||||
endif
|
endif
|
||||||
CFLAGS += -Wall
|
DEVELOPER_CFLAGS += -Wall
|
||||||
CFLAGS += -Wdeclaration-after-statement
|
DEVELOPER_CFLAGS += -Wdeclaration-after-statement
|
||||||
CFLAGS += -Wformat-security
|
DEVELOPER_CFLAGS += -Wformat-security
|
||||||
CFLAGS += -Wno-format-zero-length
|
DEVELOPER_CFLAGS += -Wno-format-zero-length
|
||||||
CFLAGS += -Wold-style-definition
|
DEVELOPER_CFLAGS += -Wold-style-definition
|
||||||
CFLAGS += -Woverflow
|
DEVELOPER_CFLAGS += -Woverflow
|
||||||
CFLAGS += -Wpointer-arith
|
DEVELOPER_CFLAGS += -Wpointer-arith
|
||||||
CFLAGS += -Wstrict-prototypes
|
DEVELOPER_CFLAGS += -Wstrict-prototypes
|
||||||
CFLAGS += -Wunused
|
DEVELOPER_CFLAGS += -Wunused
|
||||||
CFLAGS += -Wvla
|
DEVELOPER_CFLAGS += -Wvla
|
||||||
|
|
||||||
ifndef COMPILER_FEATURES
|
ifndef COMPILER_FEATURES
|
||||||
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
|
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
||||||
CFLAGS += -Wtautological-constant-out-of-range-compare
|
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
|
ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
|
||||||
CFLAGS += -Wextra
|
DEVELOPER_CFLAGS += -Wextra
|
||||||
# if a function is public, there should be a prototype and the right
|
# if a function is public, there should be a prototype and the right
|
||||||
# header file should be included. If not, it should be static.
|
# header file should be included. If not, it should be static.
|
||||||
CFLAGS += -Wmissing-prototypes
|
DEVELOPER_CFLAGS += -Wmissing-prototypes
|
||||||
ifeq ($(filter extra-all,$(DEVOPTS)),)
|
ifeq ($(filter extra-all,$(DEVOPTS)),)
|
||||||
# These are disabled because we have these all over the place.
|
# These are disabled because we have these all over the place.
|
||||||
CFLAGS += -Wno-empty-body
|
DEVELOPER_CFLAGS += -Wno-empty-body
|
||||||
CFLAGS += -Wno-missing-field-initializers
|
DEVELOPER_CFLAGS += -Wno-missing-field-initializers
|
||||||
CFLAGS += -Wno-sign-compare
|
DEVELOPER_CFLAGS += -Wno-sign-compare
|
||||||
CFLAGS += -Wno-unused-parameter
|
DEVELOPER_CFLAGS += -Wno-unused-parameter
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -43,6 +43,6 @@ endif
|
||||||
# not worth fixing since newer compilers correctly stop complaining
|
# not worth fixing since newer compilers correctly stop complaining
|
||||||
ifneq ($(filter gcc4,$(COMPILER_FEATURES)),)
|
ifneq ($(filter gcc4,$(COMPILER_FEATURES)),)
|
||||||
ifeq ($(filter gcc5,$(COMPILER_FEATURES)),)
|
ifeq ($(filter gcc5,$(COMPILER_FEATURES)),)
|
||||||
CFLAGS += -Wno-uninitialized
|
DEVELOPER_CFLAGS += -Wno-uninitialized
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue