Commit Graph

234 Commits

Author SHA1 Message Date
Bryan Drewery
dbced32af5 FAST_DEPEND: Don't enable when .MAKE.MODE=meta.
This is because the .meta files generated from filemon already contain a
list of all files read to generate the object.

X-MFC-With:	r290433
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-11-08 00:50:13 +00:00
Bryan Drewery
3cccdc9d58 FAST_DEPEND: Don't include depend files when using 'make -V'.
This is especially noticeable in the kernel obj directory since it
includes so many files.

X-MFC-With:	r290433
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-11-08 00:50:09 +00:00
Bryan Drewery
cf1eeb33be Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.

Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation.  This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang.  (It appears that ICC also supports this but I
do not have access to test it).  This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'.  This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.

For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected.  In time this may change but for now
I've been conservative.  The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant.  For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.

A .depend file is still generated with the various rules that apply to
the final target, or custom rules.  Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o.  These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.

Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.

The -M flags are removed from CFLAGS when linking since they have no effect.

Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.

The system I used for testing was:
  WITNESS
  Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
  DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
        The arc was fully populated with src tree files.
  RAM: 76GiB
  CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
       2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16

buildworld:
  x buildworld-before
  + buildworld-fastdep
  +-------------------------------------------------------------------------------+
  |+                                                                              |
  |+                                                                              |
  |+                                                                       xx    x|
  |                                                                       |_MA___||
  |A                                                                              |
  +-------------------------------------------------------------------------------+
      N           Min           Max        Median           Avg        Stddev
  x   3       3744.13       3794.31       3752.25     3763.5633     26.935139
  +   3       3153.34       3155.16        3154.2     3154.2333    0.91045776
  Difference at 95.0% confidence
          -609.33 +/- 43.1943
          -16.1902% +/- 1.1477%
          (Student's t, pooled s = 19.0569)

buildkernel:
  x buildkernel-before
  + buildkernel-fastdep
  +-------------------------------------------------------------------------------+
  |+                                                                            x |
  |++                                                                           xx|
  |                                                                             A||
  |A|                                                                             |
  +-------------------------------------------------------------------------------+
      N           Min           Max        Median           Avg        Stddev
  x   3        571.57        573.94        571.79     572.43333     1.3094401
  +   3        369.12        370.57         369.3     369.66333    0.79033748
  Difference at 95.0% confidence
          -202.77 +/- 2.45131
          -35.4225% +/- 0.428227%
          (Student's t, pooled s = 1.0815)

Sponsored by:	EMC / Isilon Storage Division
MFC after:	3 weeks
Relnotes:	yes
2015-11-06 04:45:29 +00:00
Bryan Drewery
0ed70e428d Do as r289391 did for share/mk and make installing to a non-existent directory
an error.

Most of these do a 'mkdir -p' or 'install -d' before installing, but add
the trailing / here for consistency with the userland install.

MFC after:	2 weeks
X-MFC-With:	r289391
Sponsored by:	EMC / Isilon Storage Division
2015-10-17 05:49:07 +00:00
Konstantin Belousov
8598392cd1 Build changes that allow the modules on arm64.
- Move the required kernel compiler flags from Makefile.arm64 to kern.mk.
- Build arm64 modules as PIC; non-PIC relocations in .o for shared object
  output cannot be handled.
- Do not try to install aarch64 symlink.
- A hack for arm64 to avoid ld -r stage.  See the comment for the explanation.
  Some functionality is lost, like ctf handling, but hopefully will be
  restored after newer linker is available.

Reviewed by:	andrew, emaste
Tested by:	andrew (on real hardware)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3796
2015-10-08 17:42:08 +00:00
Ed Maste
05117b57a5 Install kernel debug data under /usr/lib/debug
This avoids needing a large boot partition / file system in order to
accommodate multiple kernels, and provides consistency with userland
debug. This also simplifies the process of moving kernel debug files
to a separate package and installing them on demand.

In addition, change kernel debug file extension to .debug, to match
userland debug files.

When using the supported kernel installation method the
/usr/lib/debug/boot/kernel directory will be renamed (to kernel.old)
as is done with /boot/kernel.

Developers wishing to maintain the historical behavior of installing
debug files in /boot/kernel/ can set KERN_DEBUGDIR="" in src.conf(5).

Reviewed by:	bdrewery, brooks, imp, markj
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D1006
2015-09-24 16:55:22 +00:00
Rui Paulo
1558258bc4 sys/conf: pass NMFLAGS to nm(1) via genassym.sh. 2015-08-14 22:58:32 +00:00
Marcel Moolenaar
cc787e3d0e Change md(4) to use weak symbols as start, end and size for the embedded
root disk. The embedded image is linked into the kernel in the .mfs
section.

Add rules and variables to kern.pre.mk and kern.post.mk that handle the
linking of the image. First objcopy is used to generate an object file.
Then, the object file is linked into the kernel.

Submitted by:	Steve Kiernan <stevek@juniper.net>
Reviewed by:	brooks@
Obtained from: Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D2903
2015-08-13 15:16:34 +00:00
Ruslan Bukin
4f4d15f0d0 Allow DTrace to be compiled-in to the kernel.
This will require for AArch64 as we dont have modules yet.

Sponsored by:	HEIF5
Sponsored by:	ARM Ltd.
Differential Revision:	https://reviews.freebsd.org/D1997
2015-06-10 15:53:39 +00:00
Warner Losh
a0a67cf0c8 Truncate the ctfmerge command line, like we do with SYSTEM_LD. 2014-08-12 23:48:37 +00:00
Simon J. Gerraty
3d2bc9e872 Some objects - such as *_genassym.o are not hooked into
SRCS OBJS or anything else, yet have a dependency on symlinks
such as machine/

Reviewed by: obrien
2013-08-14 22:19:29 +00:00
Warner Losh
7e527d6d70 Remove the links: target. It too is homelessly outdated since it
relies on the outdated defines list.  It likely hasn't been useful in
15 years, and certainly not in the last decade.
2012-10-25 04:55:04 +00:00
Brooks Davis
12a14de08e MFP4 change 214967:
Make the process of embedding MDROOT images less perilous by
	makeing the target that links kernel and embedding the image
	depend on the image.  This means, if the image doesn't exist you
	find out before you try to boot from it and that if you change
	the image you don't have to touch some random source file to
	cause a rebuild.

	Don't hide that we're embedding the image.
2012-08-06 21:24:43 +00:00
David E. O'Brien
cd95660f26 Revert r222186 per instructions for FreeBSD 10.
(a 10-CURRENT share/mk is already required to build a 10-CURRENT kernel
 on 9-STABLE)
2012-07-03 05:01:00 +00:00
Doug Barton
1e8e2a9d7d Unfortunately the change in r237958 resulted in s/install/instclean/ due to
the aggressive pattern matching of the :C modifier. I tested build and
install in 2 phases, however with different solutions, resulting in the
breakage. Mea culpa.

The solution is to break out the all: target. This causes a few lines of
code duplication, but now the all: target works as it should, and the
other targets continue to work as they did before.

While I'm here, add a ===> header line to the start of each port build
to make it easier to find/more clear in the logs.
2012-07-02 22:14:58 +00:00
Doug Barton
cea039dae1 For the ports modules building code, clean WRKDIR before building. This is
important for those that use -DNO_CLEAN routinely, since it will prevent
installing stale stuff, and even more important when the port is upgraded
to a newer version. When the user doesn't use -DNO_CLEAN, this will create
an infinitesimal amount of extra work, but won't hurt anything.

This is necessary because the ports tree has flags that prevent the ususal
'update the build if newer source files exist' logic from doing what it
would do in the base.
2012-07-02 06:22:20 +00:00
Doug Barton
24a5cfd2c7 Improve the functionality of the PORTS_MODULES knob by adding
LOCALBASE/bin and sbin to PATH, allowing dependencies to be found;
adding SRC_BASE and OSVERSION to match the new kernel, and putting
the related builds under MAKEOBJDIRPREFIX so that they only need
to be built once per kernel.

In addition to the PR this includes ideas/contributions from crees
and matthew.

PR:		ports/161452
Submitted by:	Garrett Cooper <yanegomi@gmail.com>
2012-06-14 19:30:31 +00:00
Peter Wemm
88c7c4348b Allow (with a license warning) "options ZFS" to work in static kernels.
The 'make depend' rules have to use custom -I paths for the special compat
includes for the opensolaris/zfs headers.

This option will pull in the couple of files that are shared with dtrace,
but they appear to correctly use the MODULE_VERSION/MODULE_DEPEND rules
so loader should do the right thing, as should kldload.

Reviewed by:	pjd (glanced at)
2012-03-27 21:23:56 +00:00
Max Khon
83cb5bae96 - CTF knob is now implemented using common scheme: MK_CTF=yes/no is
defined based on WITH/WITHOUT_CTF settings, default is WITHOUT_CTF,
NO_CTF overrides WITH_CTF (used by Makefile.inc1)
- CTFCONVERT_CMD/NORMAL_CTFCONVERT are now defined to empty string
if make(1) can handle empty commands
2011-11-30 18:11:49 +00:00
Max Khon
78e7e3ecb5 - fix WITH_CTF when specified in /etc/src.conf [1]
- CTFCONVERT_CMD=... is a hack (should be defined to empty string instead):
make(1) should be taught to ignore empty commands silently in compat mode
(as it does in !compat mode, GNU make also silently ignores empty commands)
and to skip printing empty commands in !compat mode
- config(8) should generate ${NORMAL_CTFCONVERT} invocation without '@':
this will allow to simplify kern.pre.mk even more and lessen the number
of shell invocations during kernel build when CTF is turned off
- WITH_CTF can now be converted to usual MK_CTF=yes/no infrastructure

Pointy hat to:	fjoe [1]
2011-11-29 16:34:44 +00:00
Max Khon
cd49c2e840 Conditionalize ctfconvert/ctfmerge runs on make level (.if/.endif) instead
of executing a shell on every object or executable/library file.

This shaves off more than 30,000 shell invocations during buildworld.
2011-11-29 08:38:47 +00:00
Warner Losh
ff239280c6 Test against "no" rather than "yes" for MK_KERNEL_SYMBOLS
Also, change DEBUG back to DEBUG_FLAGS in kmod.mk.  The latter accidentally
snuck in with my backwards compat fix.

Submitted by:	ru,gcooper
2011-05-23 21:32:45 +00:00
Warner Losh
adcdcb73a4 Backwards compatibility hacks to allow kernels to be built via config
wihtout updating world (good transition aide for -current, but also
allows kernels to be built on -stable the old way too).  This likely
should go away around FreeBSD 10.0 or so.
2011-05-22 18:09:51 +00:00
Warner Losh
d380e0d209 Start to usher INSTALL_NODEBUG hack out the door. Add new
WITH{OUT,}_KERNEL_SYMBOLS (defaulting to WITH).  In the fullness of
time, likely around 2020, INSTALL_NODEBUG will be removed.  For now,
don't print a warning when using INSTALL_NODEBUG, but that will be
coming soon.
2011-05-22 18:01:52 +00:00
John Baldwin
544de89de0 Add an x86/include directory to the kernel to hold headers that are common
to amd64, i386, and pc98.  The headers are installed to /usr/include/x86
during an installworld, and an 'x86' symlink is created for kernel builds
similar to 'machine' so that the headers can be included as <x86/foo.h>.

Reviewed by:	imp
2010-11-01 17:34:04 +00:00
Warner Losh
25faff346c MFtbemd:
Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.
2010-08-23 22:24:11 +00:00
Nathan Whitehorn
915b4b093c Convert several instances of MACHINE_ARCH to MACHINE_CPUARCH and use the
correct compiler flags on 64-bit PowerPC.
2010-07-13 13:11:18 +00:00
Alexander Leidinger
21edb039c6 WITH_CTF can now be specified in src.conf (not recommended, there
are some problems with static executables), make.conf (would also
affect ports which do not use GNU make and do not override the
compile targets) or in the kernel config (via "makeoptions
WITH_CTF=yes").

Additional (related) changes:
 - propagate WITH_CTF to module builds
 - do not add -g to the linker flags, it's a noop there anyway
   (at least according to the man page of ld)
 - do not add -g to CFLAGS unconditionally
   we need to have a look if it is really needed (IMO not) or if there
   is a way to add it only when WITH_CTF is used

Note: ctfconvert / ctfmerge lines will not appear in the build output,
to protect the innocent (those which do not build with WITH_CTF would
see the shell-test and may think WITH_CTF is used).

Reviewed by:	imp, jhb, scottl (earlier version)
Discussed on:	arch@
2010-04-02 06:55:31 +00:00
Alexander Leidinger
627693305a Propagate CONF_CFLAGS (from makeoptions) to the module build too.
Discussed with:	jhb (on arch@)
2010-03-25 13:47:21 +00:00
John Baldwin
8859442e76 Always compute the root of the kernel source tree and explicitly pass it
to module builds.  This avoids having to have the module builds walk up
the tree to find the kernel sources.  It also allows a kernel + module
build to succeed when a new level of module subdirectories is added without
requiring that the /usr/share/mk/bsd.kmod.mk file on the machine be patched.

MFC after:	1 week
2009-05-04 20:25:56 +00:00
Bjoern A. Zeeb
b63fbf28cb Using KMODOWN/KMODGRP rather than hard coding root/wheel for
installing the kernel allows one, like with modules, to override
the default user/group and install as non-su to a temporary
directory to test, create images or seed a tftp dir.

Reviewed by:	Andrzej Tobola <ato@iem.pw.edu.pl>
MFC after:	4 weeks
2009-01-07 09:56:54 +00:00
John Birrell
3a877a1d93 Add CTF conversion to the objects compiled from generated code.
This allows DTrace scripts to access variables like 'ostype'.
2008-07-05 06:12:14 +00:00
John Birrell
ef74ab5a41 Add support for generating CTF data for the kernel. 2008-05-23 03:53:49 +00:00
Rafal Jaworowski
fcfdd827d0 Introduce a standalone shell script for embedding MFS image.
This allows to fix a problem with ARM kernel.bin not having the MFS image
embedded: it is objcopied from the kernel.noheader temporary ELF file, which
was not subject to embedding the MFS image previously.

Reviewed by:	imp
Approved by:	cognet (mentor)
2008-02-05 10:46:30 +00:00
Warner Losh
92d0be02b0 If KERNEL_EXTRA is defined, make kernel-all target depend on it.
If KERNEL_EXTRA_INSTALL is defined, install it into ${DESTDIR}${KODIR}.
2007-03-23 21:55:59 +00:00
John-Mark Gurney
83616b3aff now that MFS_IMAGE is in the FULLKERNEL section, use FULLKERNEL instead of
KERNEL_KO, this fixes MFS_IMAGE on a debugging kernel...

Submitted by:	Neelkanth Natu
2006-12-30 20:27:24 +00:00
Ruslan Ermilov
a10892b064 MF kmod.mk 1.176: Properly handle vnode_if.h dependencies.
Instructed by:	bde
2006-10-26 19:04:20 +00:00
Ruslan Ermilov
74465532f6 - Remove include links only when .depend is also removed, so that
"make depend; make clean; make -n" works.

- Preseve kernel's .depend if it already exists and its creation
  is interrupted.

Reported/reviewed by:	bde
2006-10-13 22:28:14 +00:00
Dag-Erling Smørgrav
8b3ae668b1 Don't use touch when what is really meant is :> (create an empty file, or
truncate it if it exists) or :>> (ensure the file exists, but don't change
it if it already does)

Reviewed by:	ru
MFC after:	2 weeks
2006-08-14 13:28:53 +00:00
Warner Losh
f36c2bbe0c Remove the insistance on having a device.hints. This was a seat belt
for those upgrading from 4.x -> 5.x.  It is therefore no longer
necessary because it is installed on 5.x and 6.x and one has to
upgrade from 6.x -> current, or at the very least 5.x (although not
supported, it can be made to work).
2006-06-18 17:48:45 +00:00
Olivier Houchard
de5f056a10 Handle MFS_IMAGE in the ${FULLKERNEL} target, so that we can build kernel
with MFS root without debugging.
2006-06-13 00:57:10 +00:00
John-Mark Gurney
c53113c8bc add support for makeoptions MFS_IMAGE="<file>" in the config file which
will automaticly populate the kernel w/ the mfs image...
2006-05-12 02:45:12 +00:00
Ruslan Ermilov
ee439c43ae Remove .depend when doing "make cleandir". 2006-02-07 13:37:26 +00:00
Ruslan Ermilov
150636cae7 I couldn't find any traces of what the tags1 file was supposed to do. 2006-01-16 16:25:17 +00:00
Ruslan Ermilov
a90232e1f7 Teach this to create the "machine" and ${MACHINE_ARCH} (for pc98
only now) symbolic links in the kernel compile directory, rather
than relying on config(8) to do this.  (The changes to config(8)
will be committed separately.)  This is aimed towards making the
config(8) as lightweight as possible.

Idea by:	bde (all bugs are mine)
2005-11-30 18:15:06 +00:00
Ruslan Ermilov
1558abf6ce Rename the .dbg extension to .symbols, which matches "symbol-file"
gdb(1) command better, though I must admit it's confusing: these
files have not only [debugging] symbols, but much more than that.

Requested by:	obrien
2005-10-27 17:39:03 +00:00
Ruslan Ermilov
bebb05211f Use ${S} to pass ${SYSDIR} to ports. This makes PORTS_MODULES
feature work when compiling a kernel via "make buildkernel".

Noticed and tested by:	nork
2005-10-27 14:33:08 +00:00
Ruslan Ermilov
98b45a8ff8 Installing debug modules was a bad idea -- I bogusly assumed that
our kernel linker will only load PT_LOAD segments, apparently not.
Instead, produce .dbg objects from .debug objects, and install
them together with non-debug objects, as described in objcopy(1).

Original code by:	obrien
2005-10-27 14:24:45 +00:00
Ruslan Ermilov
d24864f785 Refactor (some more) installation of kernel and module objects.
Try to make everyone happy: David (to have debug kernels installed
by default), Warner (to be able to override that), and myself (for
actually making it all work and to be consistent).

Now, if kernel was configured for debugging (through DEBUG=-g in
the kernel config file or "config -g"), doing "make install" will
install debug versions of kernel and module objects with their
canonical names,

	kernel.debug -> /boot/kernel/kernel
	if_fxp.ko.debug -> /boot/kernel/if_fxp.ko

Installing a kernel not configured for debugging, or debug kernel
with INSTALL_NODEBUG variable defined, will install non-debug
kernel and module objects.

Also, restore the install.debug and reinstall.debug targets that
are part of the existing API (they cause some additional gdb(1)
scripts to be installed).
2005-10-25 09:05:07 +00:00
Warner Losh
697ca17bb0 Back out most of 1.84. It was unwise to force debug kernels to always
be installed.  It should have been optional to install a non-debug
one, just like it was formerly optional to install a debug one.  In
order to do that, most of 1.84 had to go.

Instead, make installing the debug kernel the default, but create a
new option INSTALL_NODEBUG for those people that have small /
partitions and good source control habits.

This preserves the behavior of 1.84 while allowing it to be overriden
for people (like me) that do not have the time to upgrade to get a
bigger / and also don't have time for stupid makefile tricks when
upgrading their older system, but still want a kernel.debug around if
things go south.
2005-10-24 23:54:39 +00:00
David E. O'Brien
e319790c0c For HEAD, install a kernel with debug information if DEBUG is a kernel
config option.  It is too easy to loose the build directory and not have
symbols for kgdb to read.
2005-09-11 00:22:21 +00:00
Warner Losh
9f74b22210 Don't build PORTS_MODULES if NO_MODULES is defined 2005-06-09 05:38:18 +00:00
Maxime Henrion
5c25ebd529 Install ports defined in PORTS_MODULES at make reinstall time too.
Reviewed by:	imp
2005-06-05 18:34:16 +00:00
Ruslan Ermilov
1afc807b33 Be resistant to DESTDIR being set to some unkosher value, e.g. "/".
Noticed by:	Steve Ames
2005-04-28 14:45:57 +00:00
Ruslan Ermilov
3365523e54 Clean all generated vnode_if* files. 2005-04-22 19:58:22 +00:00
Ruslan Ermilov
a13914f600 Fix "make depend" to not redundantly rebuild the .depend file.
Reviewed by:	bde (I think so)
2005-04-22 17:36:25 +00:00
Warner Losh
cfaacd7f0f Now that we have proper links, no need to fake up ones as part of
depend.  Now that we no longer need this hack, remove it.

Forgotten by: imp
Reminded by: nyan
2005-04-03 04:33:42 +00:00
Poul-Henning Kamp
92daf6f9ac Don't generate major.c anymore. 2005-03-29 11:23:25 +00:00
Warner Losh
f747977691 Get SYSDIR set correctly for building ports.
On install, do deinstall reinstall
2005-02-25 05:34:45 +00:00
Warner Losh
c8f0f80834 use __target in preference to target 2005-02-25 02:25:38 +00:00
Poul-Henning Kamp
aec0fb7b40 Back when VOP_* was introduced, we did not have new-style struct
initializations but we did have lofty goals and big ideals.

Adjust to more contemporary circumstances and gain type checking.

	Replace the entire vop_t frobbing thing with properly typed
	structures.  The only casualty is that we can not add a new
	VOP_ method with a loadable module.  History has not given
	us reason to belive this would ever be feasible in the the
	first place.

	Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc.

	Give coda correct prototypes and function definitions for
	all vop_()s.

	Generate a bit more data from the vnode_if.src file:  a
	struct vop_vector and protype typedefs for all vop methods.

	Add a new vop_bypass() and make vop_default be a pointer
	to another struct vop_vector.

	Remove a lot of vfs_init since vop_vector is ready to use
	from the compiler.

	Cast various vop_mumble() to void * with uppercase name,
	for instance VOP_PANIC, VOP_NULL etc.

	Implement VCALL() by making vdesc_offset the offsetof() the
	relevant function pointer in vop_vector.  This is disgusting
	but since the code is generated by a script comparatively
	safe.  The alternative for nullfs etc. would be much worse.

	Fix up all vnode method vectors to remove casts so they
	become typesafe.  (The bulk of this is generated by scripts)
2004-12-01 23:16:38 +00:00
Warner Losh
10695f3acb Use PORTSDIR, falling back to /usr/ports 2004-11-14 00:22:18 +00:00
Ruslan Ermilov
7e25cd95ff Ports aren't generally ready for parallel make.
Pointed by:	Ben Mesander
2004-11-12 20:44:51 +00:00
Warner Losh
1fd4bb62ef PORTS_MODULES: a list of ports to build with this kernel.
# I directly use the targets for building this, but it was suggested
# to use portupgrade.  I couldn't fit that into the target model, so I
# punted.
2004-11-11 23:58:14 +00:00
Poul-Henning Kamp
08d0c00b91 Per recent HEADSUP: Disconnect (old)vinum from the kernel build.
Users should move to the new geom_vinum implementation instead.

The refcount logic which is being added to devices to enable safe module
unloading and the buf/vm work also in progress would require a major rework
of the (old)-vinum code to comply with the new semantics.

The actual source files will not be removed until I have coordinated with
the geomvinum people if they need any bits repo-copied etc.
2004-09-23 08:34:50 +00:00
Ruslan Ermilov
e8f7141ed8 Pass the idea of the make(1) binary to use down to newvers.sh.
This is necessary so source upgrades use the correct binary.

MFC after:	3 days

For the record: Problem spotted by Scott Long, who mentioned
that source upgrades from 4.7 to recent 5.x and 6.0 are broken.
Detailed analysis shows that 4.7 has a broken make(1) binary.
A breakage was fixed in RELENG_4 in make/main.c,v 1.35.2.7 by
imp@, though the commit log erroneously stated "MFC 1.68"
while in fact it should have been spelled as "MFC 1.67".
2004-09-17 09:17:33 +00:00
Warner Losh
6324e64978 We don't need GEN_M_CFILES. Fold it into GEN_CFILES definition and
adjust as necessary.

Suggested by: bde
2004-06-27 23:03:43 +00:00
Warner Losh
b53dd31ab9 MFp4:
Now that the devs files are marked before-depend, we can remvoe them
from a few places they were explicitly mentioned (along with
BEFORE_DEPEND).

Noticed by: bde
2004-06-26 06:02:06 +00:00
Warner Losh
0825532b5c Add pccarddevs.h and usbdevs.h as depends, ala miidevs.h, in the right
places.  This should have been committed last night with the rest of
my changes, but wasn't.

Pointy hat to: imp
2004-05-26 16:31:41 +00:00
David E. O'Brien
7676d865bd Use ' rather than ".
Submitted by:	ru
2004-03-22 15:45:17 +00:00
David E. O'Brien
276233b632 Quote NM in case you need to force it to something with args.
Submitted by:	jmallett
2004-03-21 19:06:54 +00:00
Marcel Moolenaar
7b5ee3392b Don't make having ${DESTDIR}/boot/device.hints a prerequisite to
installing a kernel on ia64.
2004-03-20 22:47:30 +00:00
Ruslan Ermilov
41460aa51a Merged from kmod.mk,v 1.152: strip debugging symbols even when not
configured for debugging.  This saves some bytes, and produces the
same "kernel" object as if it was configured for debugging.
2004-02-13 13:21:41 +00:00
Peter Wemm
0ec876a2f0 Attempt to clean up the emu10k1-alsa.h stuff so that config doesn't
delete it each time its run and have it regenerated each time by make.
I used a quick hackish script rather than putting it in the files file
and used the before-depend rule to avoid the depend/no-depend hacks.
2004-02-05 22:51:16 +00:00
Ruslan Ermilov
c7301f9132 The gdbinit.${MACHINE_ARCH} script may not exist. 2004-01-21 08:23:46 +00:00
David E. O'Brien
4239793589 Add emu10k1-alsa%diked.h dependancies. 2004-01-12 19:02:37 +00:00
Warner Losh
e342346255 Define KERNBUILDDIR again. The RELENG_5_2 tree is stable enough that
we can turn this back on to start to resolve the issues with the
release process.

Approved by: scottl
2004-01-03 19:03:28 +00:00
Bruce Evans
77c854b056 Backed out rev.1.48. -Winline now works better so there should be no
need for a hack to prevent bogus warnings about unused inlines.
2003-12-30 07:54:39 +00:00
Bruce Evans
e1402a88c6 Garbage-collected some vestiges of objformat support (mainly ${FMT}). 2003-12-29 11:34:33 +00:00
Bruce Evans
c52c3a23e9 Fixed some style bugs (manly a few English usage errors in comments and
many unusual indentations for continued lines in code).
2003-12-29 11:28:21 +00:00
Greg Lehey
01b4ca63ec gdbinit target: Remove comment lines from dot.gdbinit. This allows us to
put dire warnings in the original and not find them in the installed version.
2003-12-29 06:40:00 +00:00
Warner Losh
54e1080557 Turns out that building modules with the kernel opt files is
uncovering some interesting problems.  Be conservative and effecitvely
disable this by default.  Interested parties may still define
KERNBUILDDIR by hand to achive the same effect.

I plan on referting this change after 5.2 is released, or sooner if
the issues with building releases are resolved and re@ approves.

Approved by: re@ (scottl, marcel)
2003-11-25 04:12:43 +00:00
Bruce Evans
9644b98770 Moved $FreeBSD$ to the beginning of the file.
Improved wording in a nearby comment.
2003-11-14 23:09:38 +00:00
Brian Feldman
8fa793d0fe Include opt_global.h in the modules build, when building from a normal
kernel build.  This makes it possible for me not to get pissed off that
random.ko crashes the system trying to rdtsc() when the i386/cpu.h
support code decides it's okay to call that op when neither I386_CPU or
I486_CPU is defined.  I guess it also makes WITNESS/INVARIANTS defines
get picked up by the modules.
2003-11-14 16:04:11 +00:00
Brian Feldman
afdc68c42f Add a "-f" flag for asf(8) which performs a search to find the each module
no matter where in the directory structure it may be.  Use this and the "-k"
flag in the generated gdbinit files so that the "getsyms" function in gdb
requires no user intervention to run and will find every module if they're
in the kernel build's module directory.  This is still quite useful for
cases where gdb knows that the path for some modules is /boot/kernel and
others are in the object directory for /usr/src/sys/$ARCH/compile/kernel.

Approved by:	grog
2003-11-04 06:38:37 +00:00
Ruslan Ermilov
98a32cb196 Fix logic in Makefile.i386,v 1.249: only back up ${DESTDIR}${KODIR}
to ${DESTDIR}${KODIR}.old if we have booted from ${DESTDIR}${KODIR},
and always keep kern.bootfile in a good shape.
2003-08-07 19:12:06 +00:00
Poul-Henning Kamp
a018375a89 Don't complain about inlines for genassym 2003-07-22 09:02:21 +00:00
Ruslan Ermilov
46205431f9 Protect against .depend file somewhere else in the .PATH.
Also consolidate building rules for special files.
2003-06-22 17:57:56 +00:00
Mark Murray
1d1f8d7c90 Some glue to allow lint(1) to work on the kernel. This is not
complete without some config(8) work. Config(8) needs to provide
some ${NORMAL_LINT} rules to make foo.ln files.
2003-06-14 17:28:13 +00:00
Greg Lehey
222aa33abc If we're building a debug kernel, add target to install the .gdbinit files
from tools/debugscripts.
2003-06-12 08:09:48 +00:00
David E. O'Brien
dfb835396a Fix a style nit.
Submitted by:	ru
2003-06-02 03:26:03 +00:00
David E. O'Brien
5345d76f4a Be sloppier about the miidevs.h dependency. This reduces the maintenance
effort at the expense of making miidevs.h a dependency for very .o.

Requested by:	imp
2003-06-01 20:47:46 +00:00
Poul-Henning Kamp
89e50d0e9a If DESTDIR was specified as a makeoption in the kernelconfig file
we want to pass it on to the modules build so we don't install
the kernel under DESTDIR and the modules in /boot.
2003-05-31 21:16:12 +00:00
Mark Murray
1d6911d10f Help out with linting. Print the ${LINT} command line. This makes
the all-important -DFOO -IBAR options "hang out".
2003-04-30 12:19:25 +00:00
Ruslan Ermilov
ab404da2f1 Leave the `clobber' target alone, it clobbers too much (including
the generated Makefile) to be useful as the cleandir replacement.

Reported by:	des
2003-03-03 09:35:44 +00:00
Ruslan Ermilov
04b603e5a2 Abuse cleandir' for what clobber' was supposed to do, for peter. 2003-03-02 21:25:00 +00:00
Ruslan Ermilov
e1ace8b4d3 Hopefully, obviate the need of ``make depend''. 2003-02-28 22:17:47 +00:00
Ruslan Ermilov
ddc474a84b Initiate the de-orbit burn sequence for <bsd.kern.mk>.
Always use sys/conf/kern.mk when building kernel/modules.
<bsd.kern.mk> is only preserved for sys/boot/pc98/boot2
for now, but this will be fixed.  If there are other
users of <bsd.kern.mk>, please let me know.

Reminded by:	bde
2003-02-28 22:12:17 +00:00
Ruslan Ermilov
5d1b6a85bc Standardize handling of locore.[sS] etc. files.
Submitted by:	jake, bde, ru
2003-02-28 21:59:14 +00:00
Poul-Henning Kamp
76d6aef572 Add necessary awk magic to create a table of major numbers allocated
in conf/majors so we can avoid autoallocating them in the kernel.
2003-02-27 08:52:11 +00:00
Ruslan Ermilov
73b893a720 Overhaul the targets and hope this is now much more readable.
This adds some orthodox kernel-* and modules-* targets and
retires harmful ``clobber''.

Now, do we really want to keep the ``modules'' target here?
2003-02-21 11:02:49 +00:00
Peter Wemm
cb42115081 Move the miidevs.h build stuff to conf/files so that config(8) doesn't
clobber it each time.
XXX: maybe this should be 'optional miibus' rather than 'standard'
2003-01-30 02:19:14 +00:00
David E. O'Brien
2d3ce7133a Remove miidevs.h and generate it from miidevs at compile time.
The devlist2h.awk tool to do this has been repocopied to sys/tools/.
2003-01-19 02:59:34 +00:00
Scott Long
fb404d6fcf Hook the aic7xxx modules up. This requires some extra care since aicasm
is a compiler tool and needs to be compiled by the host compiler.  I've
tested this in i386->sparc cross-build, 4.7->current upgrade, normal
buildkernel target, and normal /sys/i386/compile/GENERIC configurations.

Submitted by:	ru
2002-11-03 23:48:14 +00:00
Poul-Henning Kamp
32e8efbffd Don't show the command line when doing "make lint". 2002-10-15 20:49:58 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
2002-09-17 01:49:00 +00:00
Bruce Evans
49b2349b41 Added rules to generate .c files from .m files. Run mkdep on these .c
files.  This fixes at least "make" (without -j) after "make clean".
2002-08-19 01:00:37 +00:00
Bruce Evans
0f64e446fe Finished removing env(1) commands, as in rev.1.13 but non-broken. Set
the environment for the last command of the pipeline (xargs) instead
of too early in the broken version or using an extra env process for
each command spawned by xargs as in rev.1.12.  Fixed a nearby English
error.
2002-08-18 20:41:19 +00:00
Juli Mallett
8a3e49fd52 Spell kenrel as 'kernel' for consistency with the rest of the universe.
Inspired by:	bde
2002-08-14 17:55:11 +00:00
Peter Wemm
8fe52021c2 Remove duplicate 'modules-tags' rule 2002-08-01 03:13:10 +00:00
Jake Burkholder
ba37958b34 Moved the rule for locore.o from kern.post.mk to Makefile.$ARCH. 2002-07-31 14:59:05 +00:00
Ruslan Ermilov
d2893b161b Drop support for COPY, -c has been the default mode of install(1)
for a long time now.

Approved by:	bde
2002-07-29 09:40:17 +00:00
Ruslan Ermilov
7f3c93b7de s/install -c/${INSTALL} ${COPY}/ 2002-07-18 12:02:20 +00:00
Bruce Evans
3c9d896571 Quick fix for high resolution kernel profiling on i386's. Use
-finstrument-functions instead of -mprofiler-epilogue.  The former
works essentially the same as the latter but has a higher overhead
(about 22 more bytes per function for passing unused args to the
profiling functions).

Removed all traces of the IDENT Makefile variable, which had been
reduced to just a place for holding profiling's contribution to CFLAGS
(the IDENT that gives the kernel identity was renamed to KERN_IDENT).
2002-07-13 22:28:34 +00:00
Ruslan Ermilov
1cd1fdeaf5 Fixed broken ``make -jX install''.
Spotted by:	make release TARGET_ARCH=ia64
2002-05-23 07:25:01 +00:00
Dima Dorfman
b90faaf350 sysctl -w -> sysctl 2002-05-11 06:06:11 +00:00
John Baldwin
2065f9d26e Add a dummy cleandir target to the kernel section so that make buildkernel
actually works on a kernel config with NO_MODULES set.
2002-05-11 02:25:02 +00:00
David E. O'Brien
9fa411ae4a Use makeobjops.awk rather than makeobjops.pl.
(with big thanks to Oliver Fromme <olli@fromme.com>)
2002-05-01 03:28:14 +00:00
Ruslan Ermilov
2cbc81ffe4 The install.debug and reinstall.debug targets are needed solely
to build kernel and kernel modules so stop supporting them in
bsd.subdir.mk and reimplement them in kern.post.mk and kmod.mk
as special versions of the install and reinstall targets, and
only define them if DEBUG is also defined (when debug versions
are really built).

Prompted by:	bde
2002-04-24 11:26:19 +00:00
Warner Losh
d82f87481f Minor cleanups to post.mk from bde. Mostly ordering 2002-03-20 19:18:42 +00:00
Bruce Evans
a7ac916bc7 Backed out the part of the previous commit related to xargs. It just
broke things, since "name=value ... cmd ..." only works for simple
commands (not for pipelines).
2002-03-19 08:20:44 +00:00
Bruce Evans
09f2f5ad67 Removed env(1) commands. make(1) uses a real shell, and
"env name=value ... cmd ..." is just a pessimized way of doing
"name=value ... cmd ..." in real shells.  Set the environment
(without using env(1)) before starting xargs so that env(1)
is not needed in "xargs env name=value ... cmd ..."
2002-03-19 06:30:24 +00:00
Ruslan Ermilov
bbb467cd9a lint the previous lint commit.
Reviewed by:	markm
2002-03-18 09:35:45 +00:00
Mark Murray
766f7d6e03 Allow "make lint" to mostly work. Our sources are very unclean WRT
lint, so this is turned off by default. Setting WANT_LINT will turn
on generation of lint libraries for /usr/libdata/lint/*.ln.

Reviewd by:	silence in -audit.
2002-03-17 10:05:57 +00:00
David E. O'Brien
b7bbb709c2 Use vnode_if.awk rather than vnode_if.pl 2002-03-01 01:21:29 +00:00
Jake Burkholder
4fbd95d6b5 Don't echo a comment during make depend. 2002-02-23 01:49:13 +00:00
Luigi Rizzo
caa38512f5 Use make -V VARIABLE | xargs ... to pass argument lists to program
so that this is safe even if VARIABLE is longer than kern.argmax.

There is another instance of CFILES which might need the same treatment,
and might be noticed when doing a "make links".

The same has to be done in RELENG_4 (on some different file).

Noticed-by: picobsd cross-compiling LINT
Suggested-by: Alfred (bright@mu.org), des@freebsd.org
MFC-after: 3 days
2002-02-22 04:44:28 +00:00
Mike Smith
0b3178a45c Eliminate the use of commons in the kernel and modules,
simplifying the module linking process and eliminating the risks
associated with doubly-defined variables.

Cases where commons were legitimately used (detection of
compiled-in subsystems) have been converted to use sysinits, and
any new code should use this or an equivalent practice as a
matter of course.

Modules can override this behaviour by substituting -fno-common
out of ${CFLAGS} in cases where commons are necessary
(eg. third-party object modules).  Commons will be resolved and
allocated space when the kld is linked as part of the module
build process, so they will not pose a risk to the kernel or
other modules.

Provide a mechanism for controlling the export of symbols from
the module namespace.  The EXPORT_SYMS variable may be set in the
Makefile to NO (export no symbols), a list of symbols to export,
or the name of a file containing a newline-seperated list of
symbols to be exported.  Non-exported symbols are converted to
local symbols.  If EXPORT_SYMS is not set, all global symbols are
currently exported.  This behaviour is expected to change (to
exporting no symbols) once modules have been converted.

Reviewed by:	peter (in principle)
Obtained from:	green (kmod_syms.awk)
2002-01-10 03:52:01 +00:00
Warner Losh
714b6aa6ff s/oferride/override/
submitted by: dima
2002-01-06 20:33:55 +00:00
Warner Losh
99fd86af3f Move initialization of the MKMODULESENV envorinoment to kern.pre.mk
from kern.post.mk so port makefiles can augment it.

Submitted by: nyan
2002-01-05 06:21:06 +00:00
Warner Losh
4e8764288f Move all: target to kern.pre.mk so it matters less where you include
kern.post.mk.

# this should allow us to move kern.post.mk to the last line of the makefiles,
# but I'll do that slowly as I verify that one can do that w/o breaking things.

Submitted by: naddy
2001-11-11 06:16:53 +00:00
Warner Losh
1fddc467ee Move machine link creation from genassym to kernel-depend, per nyan@ 2001-11-04 23:10:39 +00:00
Warner Losh
7ff5025996 Arrgh. A clean pc98 build failed due to bogons on my part :-(.
Fix it by putting back the link of machine to sys/i386/include rather
than ../../include (aka sys/pc98/include).  I had a stale machine link
on my first test.

Not sure what the "right" fix is, but this unbreaks things.
2001-11-02 21:50:15 +00:00
Warner Losh
41c8eb3039 Factor the common parts of the Makefile.foo files. This introduces two
new files: kern.pre.mk, which contains most of the definitions, and
kern.post.mk, which contains most of the rules.

I've tested this on i386 and pc98.  I have had feedback on the sparc64
port, but no reports from anybody on alpha, ia64 or powerpc.  I
appologize in advance if I've broken you.

Reviewed by: jake, jhb, arch@
2001-11-02 21:34:20 +00:00