mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
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:
127
Makefile.ship
127
Makefile.ship
@@ -1157,6 +1157,23 @@ LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
@@ -1207,6 +1224,24 @@ LD_STATIC= ${DARWIN_ARCH}
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use clang's -fsanitize for calc testing,
|
||||
# which requires a common set of flags to be passed to
|
||||
# every compile and link, then call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-fsanitize=undefined -fsanitize=address'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
@@ -1270,6 +1305,23 @@ LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
@@ -1315,6 +1367,23 @@ LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
@@ -1354,6 +1423,23 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
@@ -1391,6 +1477,23 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
@@ -1531,6 +1634,23 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
@@ -1742,6 +1862,7 @@ CUSTOM_PASSDOWN= \
|
||||
CHMOD=${CHMOD} \
|
||||
CMP=${CMP} \
|
||||
CO=${CO} \
|
||||
COMMON_ADD="${COMMON_ADD}" \
|
||||
COMMON_CFLAGS="${COMMON_CFLAGS} -I.." \
|
||||
COMMON_LDFLAGS="${COMMON_LDFLAGS}" \
|
||||
CP=${CP} \
|
||||
@@ -1796,6 +1917,7 @@ HELP_PASSDOWN= \
|
||||
CHMOD=${CHMOD} \
|
||||
CMP=${CMP} \
|
||||
CO=${CO} \
|
||||
COMMON_ADD="${COMMON_ADD}" \
|
||||
COMMON_CFLAGS="${COMMON_CFLAGS}" \
|
||||
COMMON_LDFLAGS="${COMMON_LDFLAGS}" \
|
||||
CP=${CP} \
|
||||
@@ -2168,11 +2290,11 @@ calc.usage: calc.1 ${MAKE_FILE}
|
||||
sample: ${SAMPLE_TARGETS}
|
||||
|
||||
sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
|
||||
${CC} sample_rand.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
|
||||
${CC} sample_rand.o ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
|
||||
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
|
||||
|
||||
sample_many${EXT}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
|
||||
${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
|
||||
${CC} sample_many.o ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
|
||||
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
|
||||
|
||||
###
|
||||
@@ -3937,6 +4059,7 @@ env:
|
||||
@echo 'CMP=${CMP}'; echo ''
|
||||
@echo 'CO=${CO}'; echo ''
|
||||
@echo 'COL=${COL}'; echo ''
|
||||
@echo 'COMMON_ADD=${COMMON_ADD}'; echo ''
|
||||
@echo 'COMMON_CFLAGS=${COMMON_CFLAGS}'; echo ''
|
||||
@echo 'COMMON_LDFLAGS=${COMMON_LDFLAGS}'; echo ''
|
||||
@echo 'CP=${CP}'; echo ''
|
||||
|
Reference in New Issue
Block a user