Index: Mk/Features/debug.mk =================================================================== --- /dev/null +++ Mk/Features/debug.mk @@ -0,0 +1,17 @@ +# DEBUG Support + +.if !defined(_DEBUG_MK_INCLUDED) +_DEBUG_MK_INCLUDED= yes +DEBUG_Include_MAINTAINER= portmgr@FreeBSD.org + +. if !defined(INSTALL_STRIPPED) +STRIP= #none +MAKE_ENV+= DONTSTRIP=yes +STRIP_CMD= ${TRUE} +. endif +DEBUG_FLAGS?= -g +CFLAGS:= ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} +. if defined(INSTALL_TARGET) +INSTALL_TARGET:= ${INSTALL_TARGET:S/^install-strip$/install/g} +. endif +.endif Index: Mk/Features/lto.mk =================================================================== --- Mk/Features/lto.mk +++ Mk/Features/lto.mk @@ -2,6 +2,8 @@ # This file enforces Link Time Optimization for ports. # In order to use it, add USE_LTO=yes to your /etc/make.conf. +.if !defined(_LTO_MK_INCLUDED) +_LTO_MK_INCLUDED= yes LTO_Include_MAINTAINER= pkubaj@FreeBSD.org .if !defined(LTO_UNSAFE) @@ -11,3 +13,4 @@ CXXFLAGS+= ${LTO_FLAGS} LDFLAGS+= ${LTO_FLAGS} .endif +.endif Index: Mk/Features/ssp.mk =================================================================== --- Mk/Features/ssp.mk +++ Mk/Features/ssp.mk @@ -1,5 +1,7 @@ # SSP Support +.if !defined(_SSP_MK_INCLUDED) +_SSP_MK_INCLUDED= yes SSP_Include_MAINTAINER= portmgr@FreeBSD.org .if !defined(SSP_UNSAFE) && \ @@ -9,3 +11,4 @@ CFLAGS+= ${SSP_CFLAGS} LDFLAGS+= ${SSP_CFLAGS} .endif +.endif Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1019,6 +1019,8 @@ # These need to be absolute since we don't know how deep in the ports # tree we are and thus can't go relative. They can, of course, be overridden # by individual Makefiles or local system make configuration. +_LIST_OF_WITH_FEATURES= debug lto ssp +_DEFAULT_WITH_FEATURES= ssp PORTSDIR?= /usr/ports LOCALBASE?= /usr/local LINUXBASE?= /compat/linux @@ -1312,6 +1314,11 @@ . endif . endif +.if defined(USE_LTO) +WITH_LTO= ${USE_LTO} +WARNING+= USE_LTO is precrecated in favor of WITH_LTO +.endif + .include "${PORTSDIR}/Mk/bsd.default-versions.mk" .include "${PORTSDIR}/Mk/bsd.options.mk" @@ -1766,27 +1773,11 @@ . endif . endif -# Reset value from bsd.own.mk. -. if defined(WITH_DEBUG) -. if !defined(INSTALL_STRIPPED) -STRIP= #none -MAKE_ENV+= DONTSTRIP=yes -STRIP_CMD= ${TRUE} -. endif -DEBUG_FLAGS?= -g -CFLAGS:= ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} -. if defined(INSTALL_TARGET) -INSTALL_TARGET:= ${INSTALL_TARGET:S/^install-strip$/install/g} -. endif -. endif - -. if defined(USE_LTO) -.include "${PORTSDIR}/Mk/bsd.lto.mk" -. endif - -. if !defined(WITHOUT_SSP) -.include "${PORTSDIR}/Mk/bsd.ssp.mk" -. endif +. for f in ${_LIST_OF_WITH_FEATURES} +. if defined(WITH_${f:tu}) || ( ${_DEFAULT_WITH_FEATURES:M${f}} && !defined(WITHOUT_${f:tu}) ) +.include "${PORTSDIR}/Mk/Features/$f.mk" +. endif +. endfor # XXX PIE support to be added here MAKE_ENV+= NO_PIE=yes