2018-06-21 14:24:38 +03:00
|
|
|
# $NetBSD: bsd.sys.mk,v 1.283 2018/06/21 11:24:38 kamil Exp $
|
1995-10-22 03:45:53 +03:00
|
|
|
#
|
2001-11-12 00:41:00 +03:00
|
|
|
# Build definitions used for NetBSD source tree builds.
|
1995-12-13 04:25:05 +03:00
|
|
|
|
2003-07-28 06:38:33 +04:00
|
|
|
.if !defined(_BSD_SYS_MK_)
|
|
|
|
_BSD_SYS_MK_=1
|
2001-11-18 01:55:24 +03:00
|
|
|
|
2014-01-16 05:19:46 +04:00
|
|
|
.if !empty(.INCLUDEDFROMFILE:MMakefile*)
|
|
|
|
error1:
|
|
|
|
@(echo "bsd.sys.mk should not be included from Makefiles" >& 2; exit 1)
|
|
|
|
.endif
|
|
|
|
.if !defined(_BSD_OWN_MK_)
|
|
|
|
error2:
|
|
|
|
@(echo "bsd.own.mk must be included before bsd.sys.mk" >& 2; exit 1)
|
|
|
|
.endif
|
2014-01-10 20:16:57 +04:00
|
|
|
|
2016-02-20 19:36:08 +03:00
|
|
|
# XXX: LLVM does not support -iremap and -fdebug-*
|
|
|
|
.if ${MKREPRO:Uno} == "yes" && ${MKLLVM:Uno} != "yes"
|
2015-12-22 19:46:56 +03:00
|
|
|
.export NETBSDSRCDIR DESTDIR X11SRCDIR
|
2016-01-10 19:22:57 +03:00
|
|
|
|
2016-01-09 05:06:22 +03:00
|
|
|
.if !empty(DESTDIR)
|
2016-01-10 19:22:57 +03:00
|
|
|
CPPFLAGS+= -Wp,-iremap,${DESTDIR}:
|
2016-01-09 05:06:22 +03:00
|
|
|
REPROFLAGS+= -fdebug-prefix-map=\$$DESTDIR=
|
|
|
|
.endif
|
2016-01-10 19:22:57 +03:00
|
|
|
|
2016-12-24 00:11:45 +03:00
|
|
|
CPPFLAGS+= -Wp,-fno-canonical-system-headers
|
2016-01-10 19:22:57 +03:00
|
|
|
CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src
|
|
|
|
CPPFLAGS+= -Wp,-iremap,${X11SRCDIR}:/usr/xsrc
|
2018-06-13 18:46:26 +03:00
|
|
|
|
2016-01-10 06:59:34 +03:00
|
|
|
REPROFLAGS+= -fdebug-prefix-map=\$$NETBSDSRCDIR=/usr/src
|
2016-01-09 05:06:22 +03:00
|
|
|
REPROFLAGS+= -fdebug-prefix-map=\$$X11SRCDIR=/usr/xsrc
|
2018-06-11 04:34:03 +03:00
|
|
|
.if defined(MAKEOBJDIRPREFIX)
|
2018-06-13 18:46:26 +03:00
|
|
|
NETBSDOBJDIR= ${MAKEOBJDIRPREFIX}${NETBSDSRCDIR}
|
2018-06-18 02:37:22 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(NETBSDOBJDIR)
|
2018-06-13 18:46:26 +03:00
|
|
|
.export NETBSDOBJDIR
|
|
|
|
REPROFLAGS+= -fdebug-prefix-map=\$$NETBSDOBJDIR=/usr/obj
|
2018-06-11 04:34:03 +03:00
|
|
|
.endif
|
2018-06-13 18:46:26 +03:00
|
|
|
|
2016-12-24 20:44:22 +03:00
|
|
|
LINTFLAGS+= -R${NETBSDSRCDIR}=/usr/src -R${X11SRCDIR}=/usr/xsrc
|
2018-05-19 20:44:44 +03:00
|
|
|
LINTFLAGS+= -R${DESTDIR}=
|
2016-01-10 19:22:57 +03:00
|
|
|
|
2018-06-13 18:46:26 +03:00
|
|
|
# XXX: Cannot handle MAKEOBJDIR, yet.
|
2018-05-24 05:06:31 +03:00
|
|
|
REPROFLAGS+= -fdebug-regex-map='/usr/src/(.*)/obj$$=/usr/obj/\1'
|
|
|
|
REPROFLAGS+= -fdebug-regex-map='/usr/src/(.*)/obj/(.*)=/usr/obj/\1/\2'
|
|
|
|
REPROFLAGS+= -fdebug-regex-map='/usr/src/(.*)/obj\..*=/usr/obj/\1'
|
|
|
|
REPROFLAGS+= -fdebug-regex-map='/usr/src/(.*)/obj\..*/(.*)=/usr/obj/\1/\2'
|
2016-01-10 19:22:57 +03:00
|
|
|
|
2016-01-09 05:06:22 +03:00
|
|
|
CFLAGS+= ${REPROFLAGS}
|
|
|
|
CXXFLAGS+= ${REPROFLAGS}
|
2010-12-25 21:56:44 +03:00
|
|
|
.endif
|
|
|
|
|
2014-05-27 20:14:03 +04:00
|
|
|
# NetBSD sources use C99 style, with some GCC extensions.
|
2018-01-22 20:33:01 +03:00
|
|
|
# Coverity does not like -std=gnu99
|
|
|
|
.if !defined(COVERITY_TOP_CONFIG)
|
2014-05-27 20:14:03 +04:00
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "clang":? -std=gnu99 :}
|
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -std=gnu99 :}
|
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "pcc":? -std=gnu99 :}
|
2018-01-22 20:33:01 +03:00
|
|
|
.endif
|
2011-05-17 05:12:34 +04:00
|
|
|
|
1999-07-08 05:55:38 +04:00
|
|
|
.if defined(WARNS)
|
2011-05-26 16:56:24 +04:00
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign :}
|
1999-07-08 05:55:38 +04:00
|
|
|
.if ${WARNS} > 0
|
2001-11-13 23:25:38 +03:00
|
|
|
CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
|
|
|
|
#CFLAGS+= -Wmissing-declarations -Wredundant-decls -Wnested-externs
|
2002-11-25 06:03:13 +03:00
|
|
|
# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3,
|
2003-08-22 22:07:21 +04:00
|
|
|
# but our sources aren't up for it yet. Also, add -Wno-traditional because
|
|
|
|
# gcc includes #elif in the warnings, which is 'this code will not compile
|
|
|
|
# in a traditional environment' warning, as opposed to 'this code behaves
|
|
|
|
# differently in traditional and ansi environments' which is the warning
|
|
|
|
# we wanted, and now we don't get anymore.
|
2011-05-23 00:24:46 +04:00
|
|
|
CFLAGS+= -Wno-sign-compare
|
2017-01-12 19:47:18 +03:00
|
|
|
# Don't suppress warnings coming from constructs in system headers.
|
|
|
|
# Our system headers should be clean and we want to warn about things like:
|
|
|
|
# isdigit((char)1)
|
2017-01-17 14:09:10 +03:00
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "gcc" :? -Wsystem-headers :}
|
2014-05-27 20:16:01 +04:00
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "gcc" :? -Wno-traditional :}
|
2008-07-22 03:30:48 +04:00
|
|
|
.if !defined(NOGCCERROR)
|
|
|
|
# Set assembler warnings to be fatal
|
2017-01-10 20:16:19 +03:00
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "gcc" :? -Wa,--fatal-warnings :}
|
2008-07-22 03:30:48 +04:00
|
|
|
.endif
|
2016-06-14 16:26:45 +03:00
|
|
|
|
2008-03-03 09:33:17 +03:00
|
|
|
# Set linker warnings to be fatal
|
2008-04-22 16:47:59 +04:00
|
|
|
# XXX no proper way to avoid "FOO is a patented algorithm" warnings
|
|
|
|
# XXX on linking static libs
|
|
|
|
.if (!defined(MKPIC) || ${MKPIC} != "no") && \
|
|
|
|
(!defined(LDSTATIC) || ${LDSTATIC} != "-static")
|
2011-06-29 12:10:05 +04:00
|
|
|
# XXX there are some strange problems not yet resolved
|
2012-08-10 20:11:43 +04:00
|
|
|
. if !defined(HAVE_GCC) || defined(HAVE_LLVM)
|
2008-03-03 09:33:17 +03:00
|
|
|
LDFLAGS+= -Wl,--fatal-warnings
|
2011-06-29 12:10:05 +04:00
|
|
|
. endif
|
2005-06-04 16:17:45 +04:00
|
|
|
.endif
|
2008-04-22 16:47:59 +04:00
|
|
|
.endif
|
2016-04-12 21:50:45 +03:00
|
|
|
|
|
|
|
LDFLAGS+= -Wl,--warn-shared-textrel
|
|
|
|
|
1999-07-08 05:55:38 +04:00
|
|
|
.if ${WARNS} > 1
|
2002-05-31 01:44:07 +04:00
|
|
|
CFLAGS+= -Wreturn-type -Wswitch -Wshadow
|
2001-11-01 10:17:17 +03:00
|
|
|
.endif
|
|
|
|
.if ${WARNS} > 2
|
2001-11-13 23:25:38 +03:00
|
|
|
CFLAGS+= -Wcast-qual -Wwrite-strings
|
2006-10-23 02:17:30 +04:00
|
|
|
CFLAGS+= -Wextra -Wno-unused-parameter
|
2011-05-26 16:56:24 +04:00
|
|
|
# Readd -Wno-sign-compare to override -Wextra with clang
|
|
|
|
CFLAGS+= -Wno-sign-compare
|
2005-08-10 02:16:19 +04:00
|
|
|
CXXFLAGS+= -Wabi
|
|
|
|
CXXFLAGS+= -Wold-style-cast
|
2005-08-09 19:24:26 +04:00
|
|
|
CXXFLAGS+= -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \
|
2011-05-25 19:02:25 +04:00
|
|
|
-Wno-deprecated -Woverloaded-virtual -Wsign-promo -Wsynth
|
|
|
|
CXXFLAGS+= ${${ACTIVE_CXX} == "gcc":? -Wno-non-template-friend -Wno-pmf-conversions :}
|
1999-07-08 05:55:38 +04:00
|
|
|
.endif
|
2012-03-15 06:00:52 +04:00
|
|
|
.if ${WARNS} > 3 && (defined(HAVE_GCC) || defined(HAVE_LLVM))
|
2012-03-21 01:48:20 +04:00
|
|
|
.if ${WARNS} > 4
|
|
|
|
CFLAGS+= -Wold-style-definition
|
|
|
|
.endif
|
2016-03-13 02:08:58 +03:00
|
|
|
.if ${WARNS} > 5
|
2013-07-16 21:48:52 +04:00
|
|
|
CFLAGS+= -Wconversion
|
|
|
|
.endif
|
2011-08-23 09:22:25 +04:00
|
|
|
CFLAGS+= -Wsign-compare -Wformat=2
|
2012-03-15 06:00:52 +04:00
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -Wno-format-zero-length :}
|
2011-09-20 13:11:06 +04:00
|
|
|
.endif
|
|
|
|
.if ${WARNS} > 3 && defined(HAVE_LLVM)
|
|
|
|
CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wpointer-sign -Wmissing-noreturn :}
|
2005-02-20 04:31:44 +03:00
|
|
|
.endif
|
2014-06-13 05:17:45 +04:00
|
|
|
.if (defined(HAVE_GCC) \
|
2013-07-19 02:06:09 +04:00
|
|
|
&& (${MACHINE_ARCH} == "coldfire" || \
|
2017-08-02 00:50:36 +03:00
|
|
|
${MACHINE_CPU} == "sh3" || \
|
|
|
|
${MACHINE_CPU} == "m68k"))
|
2011-10-31 18:20:11 +04:00
|
|
|
# XXX GCC 4.5 for sh3 and m68k (which we compile with -Os) is extra noisy for
|
2011-07-09 00:59:53 +04:00
|
|
|
# cases it should be better with
|
2011-07-08 07:29:52 +04:00
|
|
|
CFLAGS+= -Wno-uninitialized
|
2013-11-06 23:57:17 +04:00
|
|
|
CFLAGS+= -Wno-maybe-uninitialized
|
|
|
|
.endif
|
2011-07-08 07:29:52 +04:00
|
|
|
.endif
|
2000-10-04 23:27:45 +04:00
|
|
|
|
2018-06-02 06:02:30 +03:00
|
|
|
.if ${MKRELRO:Uno} != "no"
|
|
|
|
LDFLAGS+= -Wl,-z,relro
|
|
|
|
.endif
|
|
|
|
.if ${MKRELRO:Uno} == "full"
|
|
|
|
LDFLAGS+= -Wl,-z,now
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${MKSANITIZER:Uno} == "yes"
|
2018-06-21 14:24:38 +03:00
|
|
|
SANITIZERFLAGS+= -fsanitize=${USE_SANITIZER}
|
|
|
|
.else
|
|
|
|
SANITIZERFLAGS+= # empty
|
2018-06-02 06:02:30 +03:00
|
|
|
.endif
|
|
|
|
|
|
|
|
|
2011-05-25 19:01:08 +04:00
|
|
|
CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}}
|
|
|
|
|
2001-11-15 00:49:53 +03:00
|
|
|
CPPFLAGS+= ${AUDIT:D-D__AUDIT__}
|
2011-05-30 17:47:01 +04:00
|
|
|
_NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no}
|
2011-05-30 17:56:34 +04:00
|
|
|
CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS}
|
2001-10-19 20:28:54 +04:00
|
|
|
LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include}
|
1998-07-27 17:16:52 +04:00
|
|
|
|
2016-03-13 20:56:56 +03:00
|
|
|
.if !defined(NOSSP) && (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec")
|
2018-01-22 20:34:01 +03:00
|
|
|
. if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels / kern modules
|
2007-05-31 01:27:54 +04:00
|
|
|
CPPFLAGS+= -D_FORTIFY_SOURCE=2
|
2018-01-22 20:34:01 +03:00
|
|
|
. endif
|
2018-01-22 20:33:01 +03:00
|
|
|
. if !defined(COVERITY_TOP_CONFIG)
|
2011-05-23 00:49:16 +04:00
|
|
|
COPTS+= -fstack-protector -Wstack-protector
|
2014-01-28 23:41:52 +04:00
|
|
|
|
2016-03-22 11:17:27 +03:00
|
|
|
# GCC 4.8 on m68k erroneously does not protect functions with
|
2014-01-28 23:41:52 +04:00
|
|
|
# variables needing special alignement, see
|
|
|
|
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59674
|
|
|
|
# (the underlying issue for sh and vax may be different, needs more
|
|
|
|
# investigation, symptoms are similar but for different sources)
|
2018-02-02 04:02:39 +03:00
|
|
|
# also true for GCC 5, assume GCC 6 too.
|
2018-01-22 20:34:01 +03:00
|
|
|
. if "${ACTIVE_CC}" == "gcc" && \
|
2018-02-02 04:02:39 +03:00
|
|
|
( ${HAVE_GCC} == "5" || \
|
|
|
|
${HAVE_GCC} == "6" ) && \
|
2016-03-22 11:17:27 +03:00
|
|
|
( ${MACHINE_CPU} == "sh3" || \
|
|
|
|
${MACHINE_ARCH} == "vax" || \
|
|
|
|
${MACHINE_CPU} == "m68k" || \
|
|
|
|
${MACHINE_CPU} == "or1k" )
|
2014-01-28 23:41:52 +04:00
|
|
|
COPTS+= -Wno-error=stack-protector
|
2018-01-22 20:34:01 +03:00
|
|
|
. endif
|
2014-01-28 23:41:52 +04:00
|
|
|
|
2012-09-23 21:22:22 +04:00
|
|
|
COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :}
|
2011-05-23 00:49:16 +04:00
|
|
|
COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :}
|
2018-01-22 20:34:01 +03:00
|
|
|
. endif
|
2006-11-09 20:06:54 +03:00
|
|
|
.endif
|
2007-05-29 17:55:31 +04:00
|
|
|
|
2011-05-23 00:52:12 +04:00
|
|
|
.if ${MKSOFTFLOAT:Uno} != "no"
|
2017-03-23 02:11:07 +03:00
|
|
|
# sh3 defaults to soft-float and specifies hard-float a different way
|
|
|
|
.if ${MACHINE_CPU} != "sh3"
|
2014-08-10 21:44:26 +04:00
|
|
|
COPTS+= ${${ACTIVE_CC} == "gcc":? -msoft-float :}
|
2001-06-18 21:04:44 +04:00
|
|
|
FOPTS+= -msoft-float
|
2017-03-23 02:11:07 +03:00
|
|
|
.endif
|
2013-07-19 02:06:09 +04:00
|
|
|
.elif ${MACHINE_ARCH} == "coldfire"
|
|
|
|
COPTS+= -mhard-float
|
|
|
|
FOPTS+= -mhard-float
|
2001-06-18 21:04:44 +04:00
|
|
|
.endif
|
|
|
|
|
2016-07-07 23:52:53 +03:00
|
|
|
#.if !empty(MACHINE_ARCH:Mearmv7*)
|
|
|
|
#COPTS+= -mthumb
|
|
|
|
#FOPTS+= -mthumb
|
|
|
|
#.endif
|
|
|
|
|
2011-05-23 00:52:12 +04:00
|
|
|
.if ${MKIEEEFP:Uno} != "no"
|
2002-01-28 02:33:51 +03:00
|
|
|
.if ${MACHINE_ARCH} == "alpha"
|
|
|
|
CFLAGS+= -mieee
|
|
|
|
FFLAGS+= -mieee
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2002-07-20 15:43:34 +04:00
|
|
|
.if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc"
|
|
|
|
CFLAGS+= -Wa,-Av8plus
|
|
|
|
.endif
|
|
|
|
|
2009-12-15 07:03:55 +03:00
|
|
|
.if !defined(NOGCCERROR)
|
2009-12-14 04:00:46 +03:00
|
|
|
.if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
|
2012-09-23 23:20:44 +04:00
|
|
|
CPUFLAGS+= -Wa,--fatal-warnings
|
2009-12-14 04:00:46 +03:00
|
|
|
.endif
|
2009-12-15 07:03:55 +03:00
|
|
|
.endif
|
2009-12-14 04:00:46 +03:00
|
|
|
|
|
|
|
#.if ${MACHINE} == "sbmips"
|
|
|
|
#CFLAGS+= -mips64 -mtune=sb1
|
|
|
|
#.endif
|
|
|
|
|
|
|
|
#.if (${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") && \
|
|
|
|
# (defined(MKPIC) && ${MKPIC} == "no")
|
|
|
|
#CPUFLAGS+= -mno-abicalls -fno-PIC
|
|
|
|
#.endif
|
2003-05-30 22:43:23 +04:00
|
|
|
CFLAGS+= ${CPUFLAGS}
|
2004-10-19 05:05:40 +04:00
|
|
|
AFLAGS+= ${CPUFLAGS}
|
2003-05-30 22:43:23 +04:00
|
|
|
|
2016-01-31 18:30:14 +03:00
|
|
|
.if !defined(NOPIE) && (!defined(LDSTATIC) || ${LDSTATIC} != "-static")
|
2008-10-16 18:36:42 +04:00
|
|
|
# Position Independent Executable flags
|
2016-03-30 16:05:09 +03:00
|
|
|
PIE_CFLAGS?= -fPIE
|
|
|
|
PIE_LDFLAGS?= -pie ${${ACTIVE_CC} == "gcc":? -shared-libgcc :}
|
|
|
|
PIE_AFLAGS?= -fPIE
|
2010-04-21 20:09:11 +04:00
|
|
|
.endif
|
2008-10-16 18:36:42 +04:00
|
|
|
|
2002-05-02 17:13:53 +04:00
|
|
|
ELF2ECOFF?= elf2ecoff
|
2001-11-18 01:48:48 +03:00
|
|
|
MKDEP?= mkdep
|
2013-10-28 05:47:13 +04:00
|
|
|
MKDEPCXX?= mkdep
|
2002-04-03 09:32:58 +04:00
|
|
|
OBJCOPY?= objcopy
|
2005-05-24 01:58:21 +04:00
|
|
|
OBJDUMP?= objdump
|
2006-11-10 20:22:19 +03:00
|
|
|
PAXCTL?= paxctl
|
2002-04-03 09:32:58 +04:00
|
|
|
STRIP?= strip
|
2003-07-10 14:33:58 +04:00
|
|
|
|
2005-09-02 07:57:10 +04:00
|
|
|
.SUFFIXES: .o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h}
|
2003-07-22 10:53:21 +04:00
|
|
|
|
|
|
|
# C
|
|
|
|
.c.o:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_COMPILE}
|
2003-07-22 10:53:21 +04:00
|
|
|
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
2010-03-02 23:49:18 +03:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
2004-04-18 07:19:02 +04:00
|
|
|
|
2003-07-22 10:53:21 +04:00
|
|
|
.c.ln:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_COMPILE}
|
2012-03-17 22:02:41 +04:00
|
|
|
${LINT} ${LINTFLAGS} ${LINTFLAGS.${.IMPSRC:T}} \
|
2004-01-27 06:31:48 +03:00
|
|
|
${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
|
|
|
|
${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
|
|
|
|
-i ${.IMPSRC}
|
1998-09-14 00:56:38 +04:00
|
|
|
|
2003-10-20 04:24:22 +04:00
|
|
|
# C++
|
|
|
|
.cc.o .cpp.o .cxx.o .C.o:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_COMPILE}
|
2003-10-20 04:24:22 +04:00
|
|
|
${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
|
|
|
|
1997-10-28 15:40:16 +03:00
|
|
|
# Objective C
|
|
|
|
# (Defined here rather than in <sys.mk> because `.m' is not just
|
|
|
|
# used for Objective C source)
|
|
|
|
.m.o:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_COMPILE}
|
2006-05-12 03:47:34 +04:00
|
|
|
${COMPILE.m} ${OBJCOPTS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC}
|
2010-03-02 23:49:18 +03:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
1997-10-28 15:40:16 +03:00
|
|
|
|
1998-09-14 00:56:38 +04:00
|
|
|
# Host-compiled C objects
|
2002-04-23 04:15:45 +04:00
|
|
|
# The intermediate step is necessary for Sun CC, which objects to calling
|
|
|
|
# object files anything but *.o
|
1998-09-14 00:56:38 +04:00
|
|
|
.c.lo:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_COMPILE}
|
2003-11-16 19:10:50 +03:00
|
|
|
${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
2002-04-23 04:15:45 +04:00
|
|
|
mv ${.TARGET}.o ${.TARGET}
|
1998-09-14 00:56:38 +04:00
|
|
|
|
2005-09-02 07:57:10 +04:00
|
|
|
# C++
|
|
|
|
.cc.lo .cpp.lo .cxx.lo .C.lo:
|
|
|
|
${_MKTARGET_COMPILE}
|
|
|
|
${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
|
|
|
mv ${.TARGET}.o ${.TARGET}
|
|
|
|
|
2003-10-19 06:11:29 +04:00
|
|
|
# Assembly
|
|
|
|
.s.o:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_COMPILE}
|
2003-10-19 06:11:29 +04:00
|
|
|
${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
2010-03-02 23:49:18 +03:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
2003-11-08 09:06:50 +03:00
|
|
|
|
2003-10-19 06:11:29 +04:00
|
|
|
.S.o:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_COMPILE}
|
2003-10-19 06:11:29 +04:00
|
|
|
${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
2010-03-02 23:49:18 +03:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
2003-10-19 06:11:29 +04:00
|
|
|
|
1995-10-22 03:45:53 +03:00
|
|
|
# Lex
|
2008-09-20 02:54:55 +04:00
|
|
|
LFLAGS+= ${LPREFIX.${.IMPSRC:T}:D-P${LPREFIX.${.IMPSRC:T}}}
|
|
|
|
LFLAGS+= ${LPREFIX:D-P${LPREFIX}}
|
2001-10-19 20:15:40 +04:00
|
|
|
|
1995-10-22 03:45:53 +03:00
|
|
|
.l.c:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_LEX}
|
1995-10-22 03:45:53 +03:00
|
|
|
${LEX.l} -o${.TARGET} ${.IMPSRC}
|
|
|
|
|
|
|
|
# Yacc
|
2008-09-20 02:54:55 +04:00
|
|
|
YFLAGS+= ${YPREFIX.${.IMPSRC:T}:D-p${YPREFIX.${.IMPSRC:T}}} ${YHEADER.${.IMPSRC:T}:D-d}
|
2001-10-19 20:15:40 +04:00
|
|
|
YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d}
|
|
|
|
|
1998-04-01 20:58:33 +04:00
|
|
|
.y.c:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_YACC}
|
1998-11-01 06:46:28 +03:00
|
|
|
${YACC.y} -o ${.TARGET} ${.IMPSRC}
|
2001-10-19 23:07:48 +04:00
|
|
|
|
|
|
|
.ifdef YHEADER
|
2009-12-13 21:40:50 +03:00
|
|
|
.if empty(.MAKEFLAGS:M-n)
|
2001-10-19 23:07:48 +04:00
|
|
|
.y.h: ${.TARGET:.h=.c}
|
|
|
|
.endif
|
2009-12-13 21:40:50 +03:00
|
|
|
.endif
|
2001-11-18 01:55:24 +03:00
|
|
|
|
2012-01-29 01:32:13 +04:00
|
|
|
# Objcopy
|
2014-08-10 09:56:36 +04:00
|
|
|
.if ${MACHINE_ARCH} == aarch64eb
|
|
|
|
# AARCH64 big endian needs to preserve $x/$d symbols for the linker.
|
2014-08-14 22:39:38 +04:00
|
|
|
OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][dx]' -K '[$$][dx]\.*'
|
2016-07-07 23:52:53 +03:00
|
|
|
.elif ${MACHINE_CPU} == "arm"
|
2013-12-17 01:34:16 +04:00
|
|
|
# ARM big endian needs to preserve $a/$d/$t symbols for the linker.
|
2014-08-14 22:39:38 +04:00
|
|
|
OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][adt]' -K '[$$][adt]\.*'
|
2014-08-10 09:56:36 +04:00
|
|
|
.endif
|
2017-04-20 12:29:10 +03:00
|
|
|
|
|
|
|
.if ${MKSTRIPSYM:Uyes} == "yes"
|
2014-08-10 09:56:36 +04:00
|
|
|
OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} ${OBJCOPYLIBFLAGS_EXTRA}
|
2017-04-20 12:29:10 +03:00
|
|
|
.else
|
|
|
|
OBJCOPYLIBFLAGS?=-X ${OBJCOPYLIBFLAGS_EXTRA}
|
|
|
|
.endif
|
2012-01-29 01:32:13 +04:00
|
|
|
|
2003-07-28 06:38:33 +04:00
|
|
|
.endif # !defined(_BSD_SYS_MK_)
|