Added COMMON_ADD Makefile facility

Added the makefile variable ${COMMON_ADD} that will add flags
to all compile and link commands. The ${COMMON_ADD} flags are
appended to both ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}.  This
facility is available to nearly all platforms except those with
very old make comamnds that do not understand the += operator.

Example on masOS (Darwin), one may invoke clang's -fsanitize
facility by:

    make clobber all COMMON_ADD='-fsanitize=undefined -fsanitize=address'

Another example.  To force C warnings to be treated as errors:

    make COMMON_ADD='-Werror'
This commit is contained in:
Landon Curt Noll
2017-05-23 02:08:33 -07:00
parent 44ffb0eec9
commit 188fd372ea
3 changed files with 256 additions and 2 deletions

View File

@@ -119,6 +119,16 @@ RPM_TOP= ${HOME}/rpm/calc
CCWERR= -Werror -Wextra -pedantic
#################################
# clang -fsanitize test options #
#################################
ifeq ($(target),Darwin)
COMMON_ADD= -fsanitize=undefined -fsanitize=address
else
COMMON_ADD=
endif
##############################################################################
#-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-#
##############################################################################
@@ -173,6 +183,7 @@ XVAR= \
DARWIN_ARCH='${DARWIN_ARCH}' \
CCWERR='${CCWERR}' \
NROFF='${NROFF}' \
COMMON_ADD='${COMMON_ADD}' \
Q='${Q}' \
V='${V}'