2001-11-02 21:34:20 +00:00
|
|
|
# $FreeBSD$
|
2003-11-05 12:20:16 +00:00
|
|
|
|
|
|
|
# Part of a unified Makefile for building kernels. This part contains all
|
|
|
|
# of the definitions that need to be before %BEFORE_DEPEND.
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2008-06-25 21:33:28 +00:00
|
|
|
.include <bsd.own.mk>
|
2006-07-17 18:43:16 +00:00
|
|
|
|
2010-07-15 23:32:53 +00:00
|
|
|
# backwards compat option for older systems.
|
2012-08-15 03:21:56 +00:00
|
|
|
MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
|
2010-07-15 23:32:53 +00:00
|
|
|
|
2001-11-02 21:34:20 +00:00
|
|
|
# Can be overridden by makeoptions or /etc/make.conf
|
|
|
|
KERNEL_KO?= kernel
|
|
|
|
KERNEL?= kernel
|
|
|
|
KODIR?= /boot/${KERNEL}
|
2008-02-02 07:52:24 +00:00
|
|
|
LDSCRIPT_NAME?= ldscript.$M
|
|
|
|
LDSCRIPT?= $S/conf/${LDSCRIPT_NAME}
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2011-02-11 05:50:28 +00:00
|
|
|
M= ${MACHINE_CPUARCH}
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2002-03-01 01:21:29 +00:00
|
|
|
AWK?= awk
|
2012-09-13 09:01:52 +00:00
|
|
|
CP?= cp
|
2003-06-14 17:28:13 +00:00
|
|
|
LINT?= lint
|
2001-11-02 21:34:20 +00:00
|
|
|
NM?= nm
|
|
|
|
OBJCOPY?= objcopy
|
|
|
|
SIZE?= size
|
|
|
|
|
2011-04-19 18:09:21 +00:00
|
|
|
.if defined(DEBUG)
|
2005-01-22 00:58:34 +00:00
|
|
|
_MINUS_O= -O
|
2009-01-12 16:54:41 +00:00
|
|
|
CTFFLAGS+= -g
|
2011-04-19 18:09:21 +00:00
|
|
|
.else
|
2011-08-15 13:33:14 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "powerpc"
|
|
|
|
_MINUS_O= -O # gcc miscompiles some code at -O2
|
|
|
|
.else
|
2005-01-22 00:58:34 +00:00
|
|
|
_MINUS_O= -O2
|
2011-04-19 18:09:21 +00:00
|
|
|
.endif
|
2011-08-15 13:33:14 +00:00
|
|
|
.endif
|
2011-04-19 18:09:21 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
Revert r232473. I have been convinced by Doug Barton and Bjoern Zeeb
that it is better to error out when people attempt to build using the
wrong bsd.*.mk files, than to silently ignore the problem.
This means, that after this commit, if you want to build kernel modules
by hand (or via a port) from a head source tree, you *must* make sure
the files in /usr/share/mk are in sync with that tree. If that isn't
possible, for example when you are running on an older FreeBSD branch,
you can:
- Run "make buildenv" from your head source tree, to have the correct
environment setup. (It's advisable to have run "make buildworld", or
at a minimum "make toolchain" first.)
- Alternatively, set MAKESYSPATH to the share/mk directory under your
head source tree. If your build tools are too old, other problems may
still occur.
- Alternatively, use "make -m" and specify the share/mk directory under
your head source tree. Again, build tools that are too old may still
result in trouble.
MFC after: 2 weeks
2012-03-03 23:49:53 +00:00
|
|
|
.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang"
|
2004-03-19 16:36:29 +00:00
|
|
|
COPTFLAGS?=-O2 -frename-registers -pipe
|
2011-04-19 18:09:21 +00:00
|
|
|
.else
|
2011-12-24 19:01:31 +00:00
|
|
|
COPTFLAGS?=-O2 -pipe
|
|
|
|
.endif
|
|
|
|
.else
|
2005-01-22 00:58:34 +00:00
|
|
|
COPTFLAGS?=${_MINUS_O} -pipe
|
2011-04-19 18:09:21 +00:00
|
|
|
.endif
|
|
|
|
.if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
|
2004-01-22 10:01:47 +00:00
|
|
|
COPTFLAGS+= -fno-strict-aliasing
|
|
|
|
.endif
|
2001-11-02 21:34:20 +00:00
|
|
|
.if !defined(NO_CPU_COPTFLAGS)
|
|
|
|
COPTFLAGS+= ${_CPUCFLAGS}
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
.endif
|
2006-06-29 21:15:25 +00:00
|
|
|
C_DIALECT= -std=c99
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
NOSTDINC= -nostdinc
|
|
|
|
|
2009-05-27 16:16:56 +00:00
|
|
|
INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2005-10-24 04:40:37 +00:00
|
|
|
# This hack lets us use the OpenBSD altq code without spamming a new
|
|
|
|
# include path into contrib'ed source files.
|
2004-06-13 17:29:10 +00:00
|
|
|
INCLUDES+= -I$S/contrib/altq
|
|
|
|
|
2005-09-11 07:33:43 +00:00
|
|
|
.if make(depend) || make(kernel-depend)
|
|
|
|
|
|
|
|
# ... and the same for ipfilter
|
|
|
|
INCLUDES+= -I$S/contrib/ipfilter
|
|
|
|
|
|
|
|
# ... and the same for pf
|
|
|
|
INCLUDES+= -I$S/contrib/pf
|
|
|
|
|
2008-12-01 16:53:01 +00:00
|
|
|
# ... and the same for ath
|
|
|
|
INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath_hal
|
2005-09-11 07:33:43 +00:00
|
|
|
|
|
|
|
# ... and the same for the NgATM stuff
|
|
|
|
INCLUDES+= -I$S/contrib/ngatm
|
|
|
|
|
2012-01-03 00:22:08 +00:00
|
|
|
# ... and the same for twa
|
2005-09-11 07:33:43 +00:00
|
|
|
INCLUDES+= -I$S/dev/twa
|
|
|
|
|
2012-01-03 00:22:08 +00:00
|
|
|
# ... and the same for XFS
|
2005-12-12 01:14:59 +00:00
|
|
|
INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs
|
|
|
|
|
2011-02-18 08:00:26 +00:00
|
|
|
# ... and the same for cxgb and cxgbe
|
|
|
|
INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe
|
2008-09-23 03:16:54 +00:00
|
|
|
|
2005-09-11 07:33:43 +00:00
|
|
|
.endif
|
|
|
|
|
2006-06-29 21:15:25 +00:00
|
|
|
CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS}
|
2005-10-05 10:05:55 +00:00
|
|
|
CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
|
Revert r232473. I have been convinced by Doug Barton and Bjoern Zeeb
that it is better to error out when people attempt to build using the
wrong bsd.*.mk files, than to silently ignore the problem.
This means, that after this commit, if you want to build kernel modules
by hand (or via a port) from a head source tree, you *must* make sure
the files in /usr/share/mk are in sync with that tree. If that isn't
possible, for example when you are running on an older FreeBSD branch,
you can:
- Run "make buildenv" from your head source tree, to have the correct
environment setup. (It's advisable to have run "make buildworld", or
at a minimum "make toolchain" first.)
- Alternatively, set MAKESYSPATH to the share/mk directory under your
head source tree. If your build tools are too old, other problems may
still occur.
- Alternatively, use "make -m" and specify the share/mk directory under
your head source tree. Again, build tools that are too old may still
result in trouble.
MFC after: 2 weeks
2012-03-03 23:49:53 +00:00
|
|
|
.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang"
|
2004-01-22 10:01:47 +00:00
|
|
|
CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT}
|
Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library:
o) Increase inline unit / large function growth limits for MIPS to accommodate
the needs of the Simple Executive, which uses a shocking amount of inlining.
o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and
the Octeon SoC.
o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific
board numbers, specifically to support the MR320.
o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd,
which improperly uses an evaluation board's board number and breaks board
detection at runtime. This board is sold by Portwell as the CAM-0100.
o) Add support for the RTC available on some Octeon boards.
o) Add support for the Octeon PCI bus. Note that rman_[sg]et_virtual for IO
ports can not work unless building for n64.
o) Clean up the CompactFlash driver to use Simple Executive macros and
structures where possible (it would be advisable to use the Simple Executive
API to set the PIO mode, too, but that is not done presently.) Also use
structures from FreeBSD's ATA layer rather than structures copied from
Linux.
o) Print available Octeon SoC features on boot.
o) Add support for the Octeon timecounter.
o) Use the Simple Executive's routines rather than local copies for doing reads
and writes to 64-bit addresses and use its macros for various device
addresses rather than using local copies.
o) Rename octeon_board_real to octeon_is_simulation to reduce differences with
Cavium-provided code originally written for Linux. Also make it use the
same simplified test that the Simple Executive and Linux both use rather
than our complex one.
o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus
to use normal interrupt allocation and setup routines.
o) Use the Simple Executive's bootmem facility to allocate physical memory for
the kernel, rather than assuming we know which addresses we can steal.
NB: This may reduce the amount of RAM the kernel reports you as having if
you are leaving large temporary allocations made by U-Boot allocated
when starting FreeBSD.
o) Add a port of the Cavium-provided Ethernet driver for Linux. This changes
Ethernet interface naming from rgmxN to octeN. The new driver has vast
improvements over the old one, both in performance and functionality, but
does still have some features which have not been ported entirely and there
may be unimplemented code that can be hit in everyday use. I will make
every effort to correct those as they are reported.
o) Support loading the kernel on non-contiguous cores.
o) Add very conservative support for harvesting randomness from the Octeon
random number device.
o) Turn SMP on by default.
o) Clean up the style of the Octeon kernel configurations a little and make
them compile with -march=octeon.
o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple
Executive.
o) Modify the Simple Executive to build on FreeBSD and to build without
executive-config.h or cvmx-config.h. In the future we may want to
revert part of these changes and supply executive-config.h and
cvmx-config.h and access to the options contained in those files via
kernel configuration files.
o) Modify the Simple Executive USB routines to support getting and setting
of the USB PID.
2010-07-20 19:25:11 +00:00
|
|
|
.if ${MACHINE_CPUARCH} != "mips"
|
2004-07-28 06:07:02 +00:00
|
|
|
CFLAGS+= --param inline-unit-growth=100
|
|
|
|
CFLAGS+= --param large-function-growth=1000
|
Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library:
o) Increase inline unit / large function growth limits for MIPS to accommodate
the needs of the Simple Executive, which uses a shocking amount of inlining.
o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and
the Octeon SoC.
o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific
board numbers, specifically to support the MR320.
o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd,
which improperly uses an evaluation board's board number and breaks board
detection at runtime. This board is sold by Portwell as the CAM-0100.
o) Add support for the RTC available on some Octeon boards.
o) Add support for the Octeon PCI bus. Note that rman_[sg]et_virtual for IO
ports can not work unless building for n64.
o) Clean up the CompactFlash driver to use Simple Executive macros and
structures where possible (it would be advisable to use the Simple Executive
API to set the PIO mode, too, but that is not done presently.) Also use
structures from FreeBSD's ATA layer rather than structures copied from
Linux.
o) Print available Octeon SoC features on boot.
o) Add support for the Octeon timecounter.
o) Use the Simple Executive's routines rather than local copies for doing reads
and writes to 64-bit addresses and use its macros for various device
addresses rather than using local copies.
o) Rename octeon_board_real to octeon_is_simulation to reduce differences with
Cavium-provided code originally written for Linux. Also make it use the
same simplified test that the Simple Executive and Linux both use rather
than our complex one.
o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus
to use normal interrupt allocation and setup routines.
o) Use the Simple Executive's bootmem facility to allocate physical memory for
the kernel, rather than assuming we know which addresses we can steal.
NB: This may reduce the amount of RAM the kernel reports you as having if
you are leaving large temporary allocations made by U-Boot allocated
when starting FreeBSD.
o) Add a port of the Cavium-provided Ethernet driver for Linux. This changes
Ethernet interface naming from rgmxN to octeN. The new driver has vast
improvements over the old one, both in performance and functionality, but
does still have some features which have not been ported entirely and there
may be unimplemented code that can be hit in everyday use. I will make
every effort to correct those as they are reported.
o) Support loading the kernel on non-contiguous cores.
o) Add very conservative support for harvesting randomness from the Octeon
random number device.
o) Turn SMP on by default.
o) Clean up the style of the Octeon kernel configurations a little and make
them compile with -march=octeon.
o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple
Executive.
o) Modify the Simple Executive to build on FreeBSD and to build without
executive-config.h or cvmx-config.h. In the future we may want to
revert part of these changes and supply executive-config.h and
cvmx-config.h and access to the options contained in those files via
kernel configuration files.
o) Modify the Simple Executive USB routines to support getting and setting
of the USB PID.
2010-07-20 19:25:11 +00:00
|
|
|
.else
|
|
|
|
# XXX Actually a gross hack just for Octeon because of the Simple Executive.
|
2010-11-28 08:09:20 +00:00
|
|
|
CFLAGS+= --param inline-unit-growth=10000
|
Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library:
o) Increase inline unit / large function growth limits for MIPS to accommodate
the needs of the Simple Executive, which uses a shocking amount of inlining.
o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and
the Octeon SoC.
o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific
board numbers, specifically to support the MR320.
o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd,
which improperly uses an evaluation board's board number and breaks board
detection at runtime. This board is sold by Portwell as the CAM-0100.
o) Add support for the RTC available on some Octeon boards.
o) Add support for the Octeon PCI bus. Note that rman_[sg]et_virtual for IO
ports can not work unless building for n64.
o) Clean up the CompactFlash driver to use Simple Executive macros and
structures where possible (it would be advisable to use the Simple Executive
API to set the PIO mode, too, but that is not done presently.) Also use
structures from FreeBSD's ATA layer rather than structures copied from
Linux.
o) Print available Octeon SoC features on boot.
o) Add support for the Octeon timecounter.
o) Use the Simple Executive's routines rather than local copies for doing reads
and writes to 64-bit addresses and use its macros for various device
addresses rather than using local copies.
o) Rename octeon_board_real to octeon_is_simulation to reduce differences with
Cavium-provided code originally written for Linux. Also make it use the
same simplified test that the Simple Executive and Linux both use rather
than our complex one.
o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus
to use normal interrupt allocation and setup routines.
o) Use the Simple Executive's bootmem facility to allocate physical memory for
the kernel, rather than assuming we know which addresses we can steal.
NB: This may reduce the amount of RAM the kernel reports you as having if
you are leaving large temporary allocations made by U-Boot allocated
when starting FreeBSD.
o) Add a port of the Cavium-provided Ethernet driver for Linux. This changes
Ethernet interface naming from rgmxN to octeN. The new driver has vast
improvements over the old one, both in performance and functionality, but
does still have some features which have not been ported entirely and there
may be unimplemented code that can be hit in everyday use. I will make
every effort to correct those as they are reported.
o) Support loading the kernel on non-contiguous cores.
o) Add very conservative support for harvesting randomness from the Octeon
random number device.
o) Turn SMP on by default.
o) Clean up the style of the Octeon kernel configurations a little and make
them compile with -march=octeon.
o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple
Executive.
o) Modify the Simple Executive to build on FreeBSD and to build without
executive-config.h or cvmx-config.h. In the future we may want to
revert part of these changes and supply executive-config.h and
cvmx-config.h and access to the options contained in those files via
kernel configuration files.
o) Modify the Simple Executive USB routines to support getting and setting
of the USB PID.
2010-07-20 19:25:11 +00:00
|
|
|
CFLAGS+= --param large-function-growth=100000
|
2010-11-28 08:09:20 +00:00
|
|
|
CFLAGS+= --param max-inline-insns-single=10000
|
Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library:
o) Increase inline unit / large function growth limits for MIPS to accommodate
the needs of the Simple Executive, which uses a shocking amount of inlining.
o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and
the Octeon SoC.
o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific
board numbers, specifically to support the MR320.
o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd,
which improperly uses an evaluation board's board number and breaks board
detection at runtime. This board is sold by Portwell as the CAM-0100.
o) Add support for the RTC available on some Octeon boards.
o) Add support for the Octeon PCI bus. Note that rman_[sg]et_virtual for IO
ports can not work unless building for n64.
o) Clean up the CompactFlash driver to use Simple Executive macros and
structures where possible (it would be advisable to use the Simple Executive
API to set the PIO mode, too, but that is not done presently.) Also use
structures from FreeBSD's ATA layer rather than structures copied from
Linux.
o) Print available Octeon SoC features on boot.
o) Add support for the Octeon timecounter.
o) Use the Simple Executive's routines rather than local copies for doing reads
and writes to 64-bit addresses and use its macros for various device
addresses rather than using local copies.
o) Rename octeon_board_real to octeon_is_simulation to reduce differences with
Cavium-provided code originally written for Linux. Also make it use the
same simplified test that the Simple Executive and Linux both use rather
than our complex one.
o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus
to use normal interrupt allocation and setup routines.
o) Use the Simple Executive's bootmem facility to allocate physical memory for
the kernel, rather than assuming we know which addresses we can steal.
NB: This may reduce the amount of RAM the kernel reports you as having if
you are leaving large temporary allocations made by U-Boot allocated
when starting FreeBSD.
o) Add a port of the Cavium-provided Ethernet driver for Linux. This changes
Ethernet interface naming from rgmxN to octeN. The new driver has vast
improvements over the old one, both in performance and functionality, but
does still have some features which have not been ported entirely and there
may be unimplemented code that can be hit in everyday use. I will make
every effort to correct those as they are reported.
o) Support loading the kernel on non-contiguous cores.
o) Add very conservative support for harvesting randomness from the Octeon
random number device.
o) Turn SMP on by default.
o) Clean up the style of the Octeon kernel configurations a little and make
them compile with -march=octeon.
o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple
Executive.
o) Modify the Simple Executive to build on FreeBSD and to build without
executive-config.h or cvmx-config.h. In the future we may want to
revert part of these changes and supply executive-config.h and
cvmx-config.h and access to the options contained in those files via
kernel configuration files.
o) Modify the Simple Executive USB routines to support getting and setting
of the USB PID.
2010-07-20 19:25:11 +00:00
|
|
|
.endif
|
2010-07-22 21:31:35 +00:00
|
|
|
.endif
|
2007-07-05 07:04:17 +00:00
|
|
|
WERROR?= -Werror
|
2001-11-02 21:34:20 +00:00
|
|
|
|
|
|
|
# XXX LOCORE means "don't declare C stuff" not "for locore.s".
|
|
|
|
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
|
|
|
|
|
2012-03-04 00:42:18 +00:00
|
|
|
.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
|
2012-02-28 18:30:18 +00:00
|
|
|
CLANG_NO_IAS= -no-integrated-as
|
|
|
|
.endif
|
|
|
|
|
2002-07-13 19:36:14 +00:00
|
|
|
.if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
|
2006-10-26 11:53:25 +00:00
|
|
|
CFLAGS+= -DGPROF -falign-functions=16
|
2001-11-02 21:34:20 +00:00
|
|
|
.if ${PROFLEVEL} >= 2
|
2002-07-13 22:28:34 +00:00
|
|
|
CFLAGS+= -DGPROF4 -DGUPROF
|
2012-01-21 11:42:40 +00:00
|
|
|
PROF= -pg -mprofiler-epilogue
|
2002-07-13 22:28:34 +00:00
|
|
|
.else
|
2012-01-21 11:42:40 +00:00
|
|
|
PROF= -pg
|
2001-11-02 21:34:20 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
2002-07-13 22:28:34 +00:00
|
|
|
DEFINED_PROF= ${PROF}
|
2002-02-20 23:35:56 +00:00
|
|
|
|
2001-11-02 21:34:20 +00:00
|
|
|
# Put configuration-specific C flags last (except for ${PROF}) so that they
|
|
|
|
# can override the others.
|
|
|
|
CFLAGS+= ${CONF_CFLAGS}
|
|
|
|
|
2003-06-14 17:28:13 +00:00
|
|
|
# Optional linting. This can be overridden in /etc/make.conf.
|
|
|
|
LINTFLAGS= ${LINTOBJKERNFLAGS}
|
|
|
|
|
2002-02-20 23:35:56 +00:00
|
|
|
NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
|
|
|
|
NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
|
|
|
|
PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}
|
2002-10-19 22:24:43 +00:00
|
|
|
NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2002-10-19 16:47:13 +00:00
|
|
|
NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
|
|
|
|
${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2012-08-31 21:10:38 +00:00
|
|
|
NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC}
|
2012-08-31 21:27:23 +00:00
|
|
|
NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \
|
|
|
|
-o ${.TARGET} ${.ALLSRC:M*.fw}
|
2012-08-31 20:54:30 +00:00
|
|
|
|
2012-03-27 21:23:56 +00:00
|
|
|
# Special flags for managing the compat compiles for ZFS
|
|
|
|
ZFS_CFLAGS= -DFREEBSD_NAMECACHE -DBUILDING_ZFS -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs -I$S/cddl/contrib/opensolaris/uts/common/zmod -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common/zfs -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas
|
|
|
|
ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS}
|
|
|
|
ZFS_C= ${CC} -c ${ZFS_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
|
|
|
|
ZFS_S= ${CC} -c ${ZFS_ASM_CFLAGS} ${WERROR} ${.IMPSRC}
|
|
|
|
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no"
|
2011-11-29 18:52:02 +00:00
|
|
|
NORMAL_CTFCONVERT= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
2011-11-30 18:11:49 +00:00
|
|
|
.elif ${MAKE_VERSION} >= 5201111300
|
|
|
|
NORMAL_CTFCONVERT=
|
2011-11-29 08:38:47 +00:00
|
|
|
.else
|
2011-11-30 18:11:49 +00:00
|
|
|
NORMAL_CTFCONVERT= @:
|
2011-11-29 08:38:47 +00:00
|
|
|
.endif
|
2008-05-23 03:53:49 +00:00
|
|
|
|
2003-06-14 17:28:13 +00:00
|
|
|
NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
|
|
|
|
|
2011-03-21 09:40:01 +00:00
|
|
|
# Infiniband C flags. Correct include paths and omit errors that linux
|
|
|
|
# does not honor.
|
|
|
|
OFEDINCLUDES= -I$S/ofed/include/
|
|
|
|
OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -fms-extensions
|
|
|
|
OFEDCFLAGS= ${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
|
|
|
|
OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF}
|
|
|
|
OFED_C= ${OFED_C_NOIMP} ${.IMPSRC}
|
|
|
|
|
2004-06-27 23:03:43 +00:00
|
|
|
GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/}
|
2005-03-29 11:23:25 +00:00
|
|
|
SYSTEM_CFILES= config.c env.c hints.c vnode_if.c
|
2001-11-02 21:34:20 +00:00
|
|
|
SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
|
2003-02-28 21:59:14 +00:00
|
|
|
SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
|
|
|
|
SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
|
|
|
|
SYSTEM_OBJS+= hack.So
|
2012-08-31 21:27:23 +00:00
|
|
|
SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} --no-warn-mismatch \
|
2002-01-10 03:52:01 +00:00
|
|
|
-warn-common -export-dynamic -dynamic-linker /red/herring \
|
2001-11-02 21:34:20 +00:00
|
|
|
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
|
|
|
|
SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
|
2003-12-29 11:34:33 +00:00
|
|
|
${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
|
2008-02-02 07:52:24 +00:00
|
|
|
SYSTEM_DEP+= ${LDSCRIPT}
|
2001-11-02 21:34:20 +00:00
|
|
|
|
2002-01-05 06:21:06 +00:00
|
|
|
# MKMODULESENV is set here so that port makefiles can augment
|
|
|
|
# them.
|
|
|
|
|
2011-04-30 17:51:39 +00:00
|
|
|
MKMODULESENV+= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
|
2010-07-15 23:32:53 +00:00
|
|
|
MKMODULESENV+= MACHINE_CPUARCH=${MACHINE_CPUARCH}
|
2002-02-17 21:00:20 +00:00
|
|
|
.if (${KERN_IDENT} == LINT)
|
|
|
|
MKMODULESENV+= ALL_MODULES=LINT
|
|
|
|
.endif
|
2002-01-05 06:21:06 +00:00
|
|
|
.if defined(MODULES_OVERRIDE)
|
|
|
|
MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
|
|
|
|
.endif
|
2010-12-27 23:52:40 +00:00
|
|
|
.if defined(WITHOUT_MODULES)
|
|
|
|
MKMODULESENV+= WITHOUT_MODULES="${WITHOUT_MODULES}"
|
|
|
|
.endif
|
2002-01-05 06:21:06 +00:00
|
|
|
.if defined(DEBUG)
|
2004-02-13 10:40:54 +00:00
|
|
|
MKMODULESENV+= DEBUG_FLAGS="${DEBUG}"
|
2002-01-05 06:21:06 +00:00
|
|
|
.endif
|
2012-09-12 14:19:40 +00:00
|
|
|
|
|
|
|
# Are various things configured?
|
|
|
|
DDB_ENABLED!= grep DDB opt_ddb.h || true ; echo
|
|
|
|
DTR_ENABLED!= grep KDTRACE_FRAME opt_kdtrace.h || true ; echo
|
|
|
|
HWPMC_ENABLED!= grep HWPMC opt_hwpmc_hooks.h || true ; echo
|