2001-05-19 23:18:21 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# This file contains common settings used for building FreeBSD
|
|
|
|
# sources.
|
|
|
|
|
|
|
|
# Enable various levels of compiler warning checks. These may be
|
2014-05-10 16:37:53 +00:00
|
|
|
# overridden (e.g. if using a non-gcc compiler) by defining MK_WARNS=no.
|
2001-05-19 23:18:21 +00:00
|
|
|
|
2018-05-23 07:54:58 +00:00
|
|
|
# for 4.2.1 GCC: http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Warning-Options.html
|
|
|
|
# for current GCC: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
|
|
|
# for clang: https://clang.llvm.org/docs/DiagnosticsReference.html
|
2002-05-10 01:58:16 +00:00
|
|
|
|
2012-09-13 16:00:46 +00:00
|
|
|
.include <bsd.compiler.mk>
|
|
|
|
|
2009-03-14 17:55:16 +00:00
|
|
|
# the default is gnu99 for now
|
2012-03-16 23:19:45 +00:00
|
|
|
CSTD?= gnu99
|
2009-03-14 17:55:16 +00:00
|
|
|
|
2018-05-23 07:54:58 +00:00
|
|
|
.if ${CSTD} == "c89" || ${CSTD} == "c90"
|
2012-03-16 23:19:45 +00:00
|
|
|
CFLAGS+= -std=iso9899:1990
|
2011-04-19 18:09:21 +00:00
|
|
|
.elif ${CSTD} == "c94" || ${CSTD} == "c95"
|
2012-03-16 23:19:45 +00:00
|
|
|
CFLAGS+= -std=iso9899:199409
|
2011-04-19 18:09:21 +00:00
|
|
|
.elif ${CSTD} == "c99"
|
2012-03-16 23:19:45 +00:00
|
|
|
CFLAGS+= -std=iso9899:1999
|
|
|
|
.else # CSTD
|
|
|
|
CFLAGS+= -std=${CSTD}
|
|
|
|
.endif # CSTD
|
2006-08-11 17:28:59 +00:00
|
|
|
# -pedantic is problematic because it also imposes namespace restrictions
|
2012-03-16 23:19:45 +00:00
|
|
|
#CFLAGS+= -pedantic
|
|
|
|
.if defined(WARNS)
|
|
|
|
.if ${WARNS} >= 1
|
2018-05-23 21:26:33 +00:00
|
|
|
CWARNFLAGS+= -Wsystem-headers
|
2014-04-25 19:25:57 +00:00
|
|
|
.if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE})
|
2012-03-16 23:19:45 +00:00
|
|
|
CWARNFLAGS+= -Werror
|
2014-04-25 19:25:57 +00:00
|
|
|
.endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE}
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # WARNS >= 1
|
|
|
|
.if ${WARNS} >= 2
|
|
|
|
CWARNFLAGS+= -Wall -Wno-format-y2k
|
|
|
|
.endif # WARNS >= 2
|
|
|
|
.if ${WARNS} >= 3
|
|
|
|
CWARNFLAGS+= -W -Wno-unused-parameter -Wstrict-prototypes\
|
|
|
|
-Wmissing-prototypes -Wpointer-arith
|
|
|
|
.endif # WARNS >= 3
|
|
|
|
.if ${WARNS} >= 4
|
|
|
|
CWARNFLAGS+= -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow\
|
|
|
|
-Wunused-parameter
|
2014-04-25 19:25:57 +00:00
|
|
|
.if !defined(NO_WCAST_ALIGN) && !defined(NO_WCAST_ALIGN.${COMPILER_TYPE})
|
2012-03-16 23:19:45 +00:00
|
|
|
CWARNFLAGS+= -Wcast-align
|
2014-04-25 19:25:57 +00:00
|
|
|
.endif # !NO_WCAST_ALIGN !NO_WCAST_ALIGN.${COMPILER_TYPE}
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # WARNS >= 4
|
|
|
|
.if ${WARNS} >= 6
|
|
|
|
CWARNFLAGS+= -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls\
|
|
|
|
-Wold-style-definition
|
2014-05-05 22:03:08 +00:00
|
|
|
.if !defined(NO_WMISSING_VARIABLE_DECLARATIONS)
|
2014-05-05 22:03:01 +00:00
|
|
|
CWARNFLAGS.clang+= -Wmissing-variable-declarations
|
2013-04-19 19:45:00 +00:00
|
|
|
.endif
|
2014-09-01 20:18:09 +00:00
|
|
|
.if !defined(NO_WTHREAD_SAFETY)
|
|
|
|
CWARNFLAGS.clang+= -Wthread-safety
|
|
|
|
.endif
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # WARNS >= 6
|
|
|
|
.if ${WARNS} >= 2 && ${WARNS} <= 4
|
2002-01-05 20:17:50 +00:00
|
|
|
# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
|
|
|
|
# XXX always get it right.
|
2012-03-16 23:19:45 +00:00
|
|
|
CWARNFLAGS+= -Wno-uninitialized
|
|
|
|
.endif # WARNS >=2 && WARNS <= 4
|
|
|
|
CWARNFLAGS+= -Wno-pointer-sign
|
2011-12-15 22:08:08 +00:00
|
|
|
# Clang has more warnings enabled by default, and when using -Wall, so if WARNS
|
|
|
|
# is set to low values, these have to be disabled explicitly.
|
2012-04-16 21:23:25 +00:00
|
|
|
.if ${WARNS} <= 6
|
2014-05-10 16:37:44 +00:00
|
|
|
CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int
|
2015-01-28 07:29:38 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30400
|
2017-12-24 16:34:54 +00:00
|
|
|
CWARNFLAGS.clang+= -Wno-unused-const-variable
|
|
|
|
.endif
|
2012-04-16 21:23:25 +00:00
|
|
|
.endif # WARNS <= 6
|
2012-03-16 23:19:45 +00:00
|
|
|
.if ${WARNS} <= 3
|
2014-05-05 22:03:01 +00:00
|
|
|
CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\
|
2013-12-07 22:30:07 +00:00
|
|
|
-Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion
|
2015-01-28 07:29:38 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
|
|
|
|
CWARNFLAGS.clang+= -Wno-unused-local-typedef
|
|
|
|
.endif
|
2017-01-08 14:49:50 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 40000
|
|
|
|
CWARNFLAGS.clang+= -Wno-address-of-packed-member
|
|
|
|
.endif
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # WARNS <= 3
|
|
|
|
.if ${WARNS} <= 2
|
2014-05-05 22:03:01 +00:00
|
|
|
CWARNFLAGS.clang+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # WARNS <= 2
|
|
|
|
.if ${WARNS} <= 1
|
2014-05-05 22:03:01 +00:00
|
|
|
CWARNFLAGS.clang+= -Wno-parentheses
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # WARNS <= 1
|
|
|
|
.if defined(NO_WARRAY_BOUNDS)
|
2014-05-05 22:03:01 +00:00
|
|
|
CWARNFLAGS.clang+= -Wno-array-bounds
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # NO_WARRAY_BOUNDS
|
|
|
|
.endif # WARNS
|
2001-05-19 23:18:21 +00:00
|
|
|
|
2012-03-16 23:19:45 +00:00
|
|
|
.if defined(FORMAT_AUDIT)
|
|
|
|
WFORMAT= 1
|
|
|
|
.endif # FORMAT_AUDIT
|
|
|
|
.if defined(WFORMAT)
|
|
|
|
.if ${WFORMAT} > 0
|
|
|
|
#CWARNFLAGS+= -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
|
|
|
|
CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args
|
2012-04-16 21:23:25 +00:00
|
|
|
.if ${WARNS} <= 3
|
2014-05-05 22:03:01 +00:00
|
|
|
CWARNFLAGS.clang+= -Wno-format-nonliteral
|
2012-04-16 21:23:25 +00:00
|
|
|
.endif # WARNS <= 3
|
2014-04-25 19:25:57 +00:00
|
|
|
.if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE})
|
2012-03-16 23:19:45 +00:00
|
|
|
CWARNFLAGS+= -Werror
|
2014-04-25 19:25:57 +00:00
|
|
|
.endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE}
|
2012-03-16 23:19:45 +00:00
|
|
|
.endif # WFORMAT > 0
|
|
|
|
.endif # WFORMAT
|
2014-04-25 19:25:57 +00:00
|
|
|
.if defined(NO_WFORMAT) || defined(NO_WFORMAT.${COMPILER_TYPE})
|
2012-03-16 23:19:45 +00:00
|
|
|
CWARNFLAGS+= -Wno-format
|
2014-04-25 19:25:57 +00:00
|
|
|
.endif # NO_WFORMAT || NO_WFORMAT.${COMPILER_TYPE}
|
2001-05-19 23:18:21 +00:00
|
|
|
|
2015-12-11 22:55:23 +00:00
|
|
|
# GCC 5.2.0
|
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50200
|
2016-07-24 18:04:12 +00:00
|
|
|
CWARNFLAGS+= -Wno-error=address \
|
|
|
|
-Wno-error=array-bounds \
|
|
|
|
-Wno-error=attributes \
|
|
|
|
-Wno-error=bool-compare \
|
|
|
|
-Wno-error=cast-align \
|
|
|
|
-Wno-error=clobbered \
|
|
|
|
-Wno-error=enum-compare \
|
|
|
|
-Wno-error=extra \
|
|
|
|
-Wno-error=inline \
|
|
|
|
-Wno-error=logical-not-parentheses \
|
|
|
|
-Wno-error=strict-aliasing \
|
|
|
|
-Wno-error=uninitialized \
|
|
|
|
-Wno-error=unused-but-set-variable \
|
|
|
|
-Wno-error=unused-function \
|
|
|
|
-Wno-error=unused-value
|
2015-12-11 22:55:23 +00:00
|
|
|
.endif
|
|
|
|
|
2016-07-22 15:00:38 +00:00
|
|
|
# GCC 6.1.0
|
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100
|
2016-07-24 18:04:12 +00:00
|
|
|
CWARNFLAGS+= -Wno-error=misleading-indentation \
|
|
|
|
-Wno-error=nonnull-compare \
|
|
|
|
-Wno-error=shift-negative-value \
|
|
|
|
-Wno-error=tautological-compare \
|
|
|
|
-Wno-error=unused-const-variable
|
2016-07-22 15:00:38 +00:00
|
|
|
.endif
|
|
|
|
|
2017-07-21 14:50:32 +00:00
|
|
|
# GCC 7.1.0
|
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 70100
|
2018-06-04 16:21:18 +00:00
|
|
|
CWARNFLAGS+= -Wno-error=bool-operation \
|
|
|
|
-Wno-error=deprecated \
|
|
|
|
-Wno-error=expansion-to-defined \
|
|
|
|
-Wno-error=format-overflow \
|
2017-07-21 14:50:32 +00:00
|
|
|
-Wno-error=format-truncation \
|
|
|
|
-Wno-error=implicit-fallthrough \
|
|
|
|
-Wno-error=int-in-bool-context \
|
|
|
|
-Wno-error=memset-elt-size \
|
2018-07-19 12:56:54 +00:00
|
|
|
-Wno-error=noexcept-type \
|
2018-06-04 16:21:18 +00:00
|
|
|
-Wno-error=nonnull \
|
|
|
|
-Wno-error=pointer-compare \
|
|
|
|
-Wno-error=stringop-overflow
|
2017-07-21 14:50:32 +00:00
|
|
|
.endif
|
|
|
|
|
2018-07-03 10:51:59 +00:00
|
|
|
# GCC 8.1.0
|
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80100
|
|
|
|
CWARNFLAGS+= -Wno-error=aggressive-loop-optimizations \
|
|
|
|
-Wno-error=cast-function-type \
|
2018-07-18 11:31:15 +00:00
|
|
|
-Wno-error=catch-value \
|
2018-07-03 10:51:59 +00:00
|
|
|
-Wno-error=multistatement-macros \
|
|
|
|
-Wno-error=restrict \
|
|
|
|
-Wno-error=sizeof-pointer-memaccess \
|
|
|
|
-Wno-error=stringop-truncation
|
|
|
|
.endif
|
|
|
|
|
2015-01-28 18:36:33 +00:00
|
|
|
# How to handle FreeBSD custom printf format specifiers.
|
|
|
|
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
|
|
|
|
FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
|
|
|
|
.else
|
|
|
|
FORMAT_EXTENSIONS= -fformat-extensions
|
|
|
|
.endif
|
|
|
|
|
2006-11-04 04:39:05 +00:00
|
|
|
.if defined(IGNORE_PRAGMA)
|
2012-03-16 23:19:45 +00:00
|
|
|
CWARNFLAGS+= -Wno-unknown-pragmas
|
|
|
|
.endif # IGNORE_PRAGMA
|
2006-11-04 04:39:05 +00:00
|
|
|
|
2015-01-01 08:30:32 +00:00
|
|
|
# We need this conditional because many places that use it
|
|
|
|
# only enable it for some files with CLFAGS.$FILE+=${CLANG_NO_IAS}.
|
|
|
|
# unconditionally, and can't easily use the CFLAGS.clang=
|
|
|
|
# mechanism.
|
|
|
|
.if ${COMPILER_TYPE} == "clang"
|
2012-03-16 23:19:45 +00:00
|
|
|
CLANG_NO_IAS= -no-integrated-as
|
2015-01-01 08:30:32 +00:00
|
|
|
.endif
|
2012-04-16 21:23:25 +00:00
|
|
|
CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\
|
2015-03-21 19:13:13 +00:00
|
|
|
-mllvm -simplifycfg-dup-ret
|
2015-05-30 18:10:43 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 30500 && ${COMPILER_VERSION} < 30700
|
2015-03-21 19:13:13 +00:00
|
|
|
CLANG_OPT_SMALL+= -mllvm -enable-gvn=false
|
2015-03-28 12:23:15 +00:00
|
|
|
.else
|
|
|
|
CLANG_OPT_SMALL+= -mllvm -enable-load-pre=false
|
2015-02-19 20:22:30 +00:00
|
|
|
.endif
|
2014-05-05 22:03:01 +00:00
|
|
|
CFLAGS.clang+= -Qunused-arguments
|
2014-02-21 19:58:45 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "sparc64"
|
|
|
|
# Don't emit .cfi directives, since we must use GNU as on sparc64, for now.
|
2014-05-05 22:03:01 +00:00
|
|
|
CFLAGS.clang+= -fno-dwarf2-cfi-asm
|
2014-02-21 19:58:45 +00:00
|
|
|
.endif # SPARC64
|
2014-02-21 22:38:25 +00:00
|
|
|
# The libc++ headers use c++11 extensions. These are normally silenced because
|
|
|
|
# they are treated as system headers, but we explicitly disable that warning
|
|
|
|
# suppression when building the base system to catch bugs in our headers.
|
|
|
|
# Eventually we'll want to start building the base system C++ code as C++11,
|
|
|
|
# but not yet.
|
2014-05-05 22:03:01 +00:00
|
|
|
CXXFLAGS.clang+= -Wno-c++11-extensions
|
2012-02-28 18:30:18 +00:00
|
|
|
|
2014-07-07 00:27:09 +00:00
|
|
|
.if ${MK_SSP} != "no" && \
|
2011-04-19 18:09:21 +00:00
|
|
|
${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
|
2015-10-17 19:48:17 +00:00
|
|
|
.if (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30500) || \
|
|
|
|
(${COMPILER_TYPE} == "gcc" && \
|
2015-10-18 04:07:40 +00:00
|
|
|
(${COMPILER_VERSION} == 40201 || ${COMPILER_VERSION} >= 40900))
|
2008-06-25 21:33:28 +00:00
|
|
|
# Don't use -Wstack-protector as it breaks world with -Werror.
|
2015-10-04 18:54:02 +00:00
|
|
|
SSP_CFLAGS?= -fstack-protector-strong
|
2015-10-18 04:07:40 +00:00
|
|
|
.else
|
|
|
|
SSP_CFLAGS?= -fstack-protector
|
2015-10-17 19:48:17 +00:00
|
|
|
.endif
|
2015-10-18 04:07:40 +00:00
|
|
|
CFLAGS+= ${SSP_CFLAGS}
|
2014-07-07 00:27:09 +00:00
|
|
|
.endif # SSP && !ARM && !MIPS
|
2008-06-25 21:33:28 +00:00
|
|
|
|
2017-08-23 23:30:25 +00:00
|
|
|
# Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is
|
|
|
|
# enabled.
|
|
|
|
DEBUG_FILES_CFLAGS?= -g
|
|
|
|
|
2016-01-14 10:09:05 +00:00
|
|
|
# Allow user-specified additional warning flags, plus compiler and file
|
2018-07-27 10:44:38 +00:00
|
|
|
# specific flag overrides, unless we've overridden this...
|
2014-05-10 16:37:53 +00:00
|
|
|
.if ${MK_WARNS} != "no"
|
2016-07-28 17:18:02 +00:00
|
|
|
CFLAGS+= ${CWARNFLAGS:M*} ${CWARNFLAGS.${COMPILER_TYPE}}
|
2016-01-14 10:09:05 +00:00
|
|
|
CFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
|
2014-05-05 22:03:08 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
CFLAGS+= ${CFLAGS.${COMPILER_TYPE}}
|
|
|
|
CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}}
|
2012-10-06 20:01:05 +00:00
|
|
|
|
2016-06-22 20:31:49 +00:00
|
|
|
AFLAGS+= ${AFLAGS.${.IMPSRC:T}}
|
2016-03-26 03:46:12 +00:00
|
|
|
ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}}
|
|
|
|
CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
|
|
|
|
CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
|
|
|
|
|
2018-04-19 20:58:09 +00:00
|
|
|
LDFLAGS+= ${LDFLAGS.${LINKER_TYPE}}
|
|
|
|
|
2016-04-18 18:14:02 +00:00
|
|
|
.if defined(SRCTOP)
|
|
|
|
# Prevent rebuilding during install to support read-only objdirs.
|
2016-11-13 00:11:09 +00:00
|
|
|
.if ${.TARGETS:M*install*} == ${.TARGETS} && empty(.MAKE.MODE:Mmeta)
|
2016-04-18 18:14:02 +00:00
|
|
|
CFLAGS+= ERROR-tried-to-rebuild-during-make-install
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2012-10-06 20:01:05 +00:00
|
|
|
# Tell bmake not to mistake standard targets for things to be searched for
|
|
|
|
# or expect to ever be up-to-date.
|
2016-02-26 22:14:00 +00:00
|
|
|
PHONY_NOTMAIN = analyze afterdepend afterinstall all beforedepend beforeinstall \
|
2015-10-14 20:38:51 +00:00
|
|
|
beforelinking build build-tools buildconfig buildfiles \
|
2016-02-07 18:40:04 +00:00
|
|
|
buildincludes check checkdpadd clean cleandepend cleandir \
|
2016-02-26 22:13:35 +00:00
|
|
|
cleanobj configure depend distclean distribute exe \
|
2018-09-17 22:14:53 +00:00
|
|
|
files html includes install installconfig installdirs \
|
|
|
|
installfiles installincludes lint obj objlink objs objwarn \
|
2016-02-26 22:13:35 +00:00
|
|
|
realinstall tags whereobj
|
2012-10-06 20:01:05 +00:00
|
|
|
|
2013-10-12 23:51:00 +00:00
|
|
|
# we don't want ${PROG} to be PHONY
|
|
|
|
.PHONY: ${PHONY_NOTMAIN:N${PROG:U}}
|
2014-05-16 14:51:19 +00:00
|
|
|
.NOTMAIN: ${PHONY_NOTMAIN:Nall}
|
2013-03-04 21:36:34 +00:00
|
|
|
|
|
|
|
.if ${MK_STAGING} != "no"
|
2013-03-14 22:04:53 +00:00
|
|
|
.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*))
|
2013-10-12 23:51:00 +00:00
|
|
|
_SKIP_STAGING?= yes
|
|
|
|
.endif
|
|
|
|
.if ${_SKIP_STAGING:Uno} == "yes"
|
2013-03-08 22:02:08 +00:00
|
|
|
staging stage_libs stage_files stage_as stage_links stage_symlinks:
|
2013-03-04 21:36:34 +00:00
|
|
|
.else
|
|
|
|
# allow targets like beforeinstall to be leveraged
|
|
|
|
DESTDIR= ${STAGE_OBJTOP}
|
2016-03-11 23:45:05 +00:00
|
|
|
.export DESTDIR
|
2013-03-04 21:36:34 +00:00
|
|
|
|
2016-03-11 23:45:02 +00:00
|
|
|
.if target(beforeinstall)
|
2015-11-20 00:22:55 +00:00
|
|
|
.if !empty(_LIBS) || (${MK_STAGING_PROG} != "no" && !defined(INTERNALPROG))
|
2013-03-08 22:02:08 +00:00
|
|
|
staging: beforeinstall
|
2013-03-04 21:36:34 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# normally only libs and includes are staged
|
2015-11-20 00:22:55 +00:00
|
|
|
.if ${MK_STAGING_PROG} != "no" && !defined(INTERNALPROG)
|
2013-03-04 21:36:34 +00:00
|
|
|
STAGE_DIR.prog= ${STAGE_OBJTOP}${BINDIR}
|
|
|
|
|
2016-03-09 03:22:20 +00:00
|
|
|
.if !empty(PROG)
|
2013-03-04 21:36:34 +00:00
|
|
|
.if defined(PROGNAME)
|
|
|
|
STAGE_AS_SETS+= prog
|
|
|
|
STAGE_AS_${PROG}= ${PROGNAME}
|
|
|
|
stage_as.prog: ${PROG}
|
|
|
|
.else
|
|
|
|
STAGE_SETS+= prog
|
|
|
|
stage_files.prog: ${PROG}
|
2015-10-07 00:24:27 +00:00
|
|
|
STAGE_TARGETS+= stage_files
|
2013-03-04 21:36:34 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !empty(_LIBS) && !defined(INTERNALLIB)
|
2014-05-16 14:51:19 +00:00
|
|
|
.if defined(SHLIBDIR) && ${SHLIBDIR} != ${LIBDIR} && ${_LIBS:Uno:M*.so.*} != ""
|
|
|
|
STAGE_SETS+= shlib
|
|
|
|
STAGE_DIR.shlib= ${STAGE_OBJTOP}${SHLIBDIR}
|
|
|
|
STAGE_FILES.shlib+= ${_LIBS:M*.so.*}
|
|
|
|
stage_files.shlib: ${_LIBS:M*.so.*}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(SHLIB_LINK) && commands(${SHLIB_LINK:R}.ld)
|
|
|
|
STAGE_AS_SETS+= ldscript
|
|
|
|
STAGE_AS.ldscript+= ${SHLIB_LINK:R}.ld
|
|
|
|
stage_as.ldscript: ${SHLIB_LINK:R}.ld
|
|
|
|
STAGE_DIR.ldscript = ${STAGE_LIBDIR}
|
|
|
|
STAGE_AS_${SHLIB_LINK:R}.ld:= ${SHLIB_LINK}
|
|
|
|
NO_SHLIB_LINKS=
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if target(stage_files.shlib)
|
|
|
|
stage_libs: ${_LIBS}
|
|
|
|
.if defined(DEBUG_FLAGS) && target(${SHLIB_NAME}.symbols)
|
|
|
|
stage_files.shlib: ${SHLIB_NAME}.symbols
|
|
|
|
.endif
|
|
|
|
.else
|
2013-03-04 21:36:34 +00:00
|
|
|
stage_libs: ${_LIBS}
|
2014-05-16 14:51:19 +00:00
|
|
|
.endif
|
2013-10-12 23:51:00 +00:00
|
|
|
.if defined(SHLIB_NAME) && defined(DEBUG_FLAGS) && target(${SHLIB_NAME}.symbols)
|
|
|
|
stage_libs: ${SHLIB_NAME}.symbols
|
|
|
|
.endif
|
2014-05-16 14:51:19 +00:00
|
|
|
|
2013-03-04 21:36:34 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !empty(INCS) || !empty(INCSGROUPS) && target(buildincludes)
|
2014-05-16 14:51:19 +00:00
|
|
|
.if !defined(NO_BEFOREBUILD_INCLUDES)
|
|
|
|
stage_includes: buildincludes
|
|
|
|
beforebuild: stage_includes
|
|
|
|
.endif
|
2013-03-04 21:36:34 +00:00
|
|
|
.endif
|
|
|
|
|
2013-03-08 00:23:21 +00:00
|
|
|
.for t in stage_libs stage_files stage_as
|
|
|
|
.if target($t)
|
2015-10-07 00:24:27 +00:00
|
|
|
STAGE_TARGETS+= $t
|
2013-03-08 00:23:21 +00:00
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
2013-03-04 21:36:34 +00:00
|
|
|
.if !empty(STAGE_AS_SETS)
|
2015-10-07 00:24:27 +00:00
|
|
|
STAGE_TARGETS+= stage_as
|
2013-03-04 21:36:34 +00:00
|
|
|
.endif
|
|
|
|
|
2018-08-02 21:33:45 +00:00
|
|
|
.if !empty(STAGE_TARGETS) || (${MK_STAGING_PROG} != "no" && !defined(INTERNALPROG))
|
2013-03-04 21:36:34 +00:00
|
|
|
|
|
|
|
.if !empty(LINKS)
|
2015-10-07 00:24:27 +00:00
|
|
|
STAGE_TARGETS+= stage_links
|
2013-10-12 23:51:00 +00:00
|
|
|
.if ${MAKE_VERSION} < 20131001
|
|
|
|
stage_links.links: ${_LIBS} ${PROG}
|
|
|
|
.endif
|
2013-03-04 21:36:34 +00:00
|
|
|
STAGE_SETS+= links
|
|
|
|
STAGE_LINKS.links= ${LINKS}
|
|
|
|
.endif
|
|
|
|
|
2015-11-13 20:25:30 +00:00
|
|
|
.if !empty(SYMLINKS)
|
2015-10-07 00:24:27 +00:00
|
|
|
STAGE_TARGETS+= stage_symlinks
|
2013-03-04 21:36:34 +00:00
|
|
|
STAGE_SETS+= links
|
|
|
|
STAGE_SYMLINKS.links= ${SYMLINKS}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.include <meta.stage.mk>
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2016-04-14 21:04:42 +00:00
|
|
|
.if defined(META_TARGETS)
|
|
|
|
.for _tgt in ${META_TARGETS}
|
|
|
|
.if target(${_tgt})
|
|
|
|
${_tgt}: ${META_DEPS}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif
|