Commit Graph

104 Commits

Author SHA1 Message Date
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Simon J. Gerraty
48e733eef9 Add some more local.*.mk includes
These facilitate customizing the build with minimal churn.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D37592
2022-12-06 10:49:54 -08:00
Emmanuel Vadot
9b6aa99e1f Revert "Introduce MODULES_EXCLUDE"
This is already present as WITHOUT_MODULES

This reverts commit 8c0c5bdf9d.

Reported by:	jrtc27
2022-01-13 15:59:47 +01:00
Emmanuel Vadot
8c0c5bdf9d Introduce MODULES_EXCLUDE
It's sometimes easier to exclude some modules rather than listing all
possibly needed ones with MODULES_OVERRIDE.
So for this add MODULES_EXCLUDE which do exactly as one would guess, excludes
some modules from the build/install.

For example if one wants to exclude all modules which are only present in the
GENERIC config on amd64 :
export MODULES_EXCLUDE=$(grep -E '^device' sys/amd64/conf/GENERIC | awk '{print $2}' | tr '\n' ' ')

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33443
2022-01-13 15:16:34 +01:00
Warner Losh
3cc5d6a470 Introduce bsd.sysdir.mk to consolidate looking for the kernel.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D22144
2019-11-21 15:59:33 +00:00
Bryan Drewery
4f6de62991 Use known SRCTOP if possible to determine SYSDIR.
Suggested by:	sjg
Sponsored by:	Dell EMC
2018-04-12 20:48:17 +00:00
Bryan Drewery
711c77093c Fix using wrong SYSDIR after r331683.
This was inadvertently overriding the first found SYSDIR with the last
of /usr/src which could result in the wrong headers being used if not
building from /usr/src.

SYSDIR?= is not used here to avoid evaluating the exists() when unneeded.

Reported by:	rgrimes, sjg, Mark Millard
Pointyhat to:	bdrewery
Sponsored by:	Dell EMC
2018-04-12 20:27:57 +00:00
Bryan Drewery
7d9f50a4ba Avoid looping if SYSDIR already known.
Sponsored by:	Dell EMC
2018-03-28 16:28:24 +00:00
Bryan Drewery
ffae081b1e Avoid upwards directory walk in kernel build for finding known SYSDIR.
Sponsored by:	Dell EMC
2018-03-28 16:28:20 +00:00
Bryan Drewery
2dcffa9cb7 WITH_META_MODE: Resolve SYSDIR to avoid changed build commands.
Sponsored by:	EMC / Isilon Storage Division
2016-05-31 23:08:43 +00:00
Warner Losh
6d42086e33 Eliminate bsd.sys.mk on purpose. Do not put it back. 2015-01-01 04:26:45 +00:00
Enji Cooper
bc5c3aad41 Unbreak the build for some modules that depend on -std flags to be passed
through via CFLAGS, as noted by Jenkins when building sparc64 by re-adding
bsd.sys.mk to bsd.kmod.mk:
https://jenkins.freebsd.org/job/FreeBSD_HEAD_sparc64/225/changes

Tested with:
    % cd /sys/modules/bce; make obj; make depend; make all
2015-01-01 04:10:56 +00:00
Warner Losh
7ed11c5e5a Fix module builds on arm (and maybe others) by turning off a whole
raft of new warnings that appear to be on by default in clang 3.5.0.
Fix RPI-B build issues with new clang not liking the ability to pass
arbitrary flags to as, since some flags are more arbitrary (and thus
verboten) than others.

These warnings should be actually fixed in the code, but this is a
band-aide to get things (almost) building again.
2015-01-01 02:00:04 +00:00
Warner Losh
e517a11c27 Fix comma splice, can't ambiguity and quoting.
Submitted by:	bde@
MFC after:	2 weeks
2012-02-16 21:04:47 +00:00
Warner Losh
c693bd2ff6 Wordsmith the can't find kernel error message, and suggest which
variable to set to override.
2012-02-15 21:20:58 +00:00
Warner Losh
258f85b951 ata module additions now nest ata modules one deeper than any prior module.
Increase heuristic used to find them by one.
2008-10-09 22:01:27 +00:00
Bruce Evans
07f8c1504f Fixed style bugs in previous commit (151 characters of trailing whitespace). 2004-06-21 16:12:02 +00:00
Pawel Jakub Dawidek
be8b4bc831 - Missing trailing slash for a kern directory check.
- Check in both places if ${_dir}/conf/kmod.mk exists.
- Style fixes (lines too long).

Submitted by:	bde
2004-06-21 08:41:50 +00:00
Pawel Jakub Dawidek
e1e6143854 Check if ${_dir}/kern exists as well, because if it doesn't exists
we will fail later and we can miss good kernel source tree directory.
I found this trying to compile kld module and it finds 'conf/kmod.mk'
in '../..', but it fails later, because there is no 'kern' directory,
but there is valid kernel source tree still in /usr/src/sys/.
2004-06-18 16:38:42 +00:00
Kris Kennaway
d510ecb42b Bring in the WARNS directive from NetBSD, localized in a new bsd.sys.mk
to avoid polluting sys.mk.  This directive controls the addition of
compiler warning flags to CFLAGS in a relatively compiler-neutral manner.

The idea is that WARNS can be set in Makefile.inc or in individual
Makefiles as they become clean, to prevent the introduction of new
warnings in the code.  -Werror is added by default
2001-05-19 23:18:21 +00:00
Jason Evans
aabafca098 Do not check for existence of ${_dir}/kern/ , because for modules that set
.PATH to ${.CURDIR}/[...]/kern , the "exists" expression will fail for the
form exists(${.CURDIR}/[...]/kern/).  This appears to be happening because
make is searching for the argument to "exists" by using .PATH rather than a
relative search, because .PATH and the argument match at the beginning.
Additionally, make appears to consider a path that starts with ${.CURDIR}
as relative, even though it expands to an absolute path.

The reason that most people aren't seeing this problem is that the absolute
paths of /usr/src/sys and /sys are also searched, so as long as the kernel
source can be found in at least one of those places, no problems surface.
This problem was inadvertently introduced on 1 December 2000, with the
addition of the sysvipc modules.
2000-12-08 20:36:32 +00:00
Warner Losh
c7c5a4ed23 Add ${.CURDIR}/../../../.. to the list of places we look for the
kernel.  The new moudles/sound/drivers/foo pushes us down one more
level.
2000-07-07 05:12:33 +00:00
Peter Wemm
5b412e30f2 Sigh. Use the correct path to bsd.conf.mk. It's times like this that I
regret giving up coffee.
2000-05-27 01:11:17 +00:00
Peter Wemm
08f95f1e10 Revive a skeleton for bsd.kmod.mk (which will be in the make search path)
that merely locates and includes sys/conf/kmod.mk.
2000-05-27 00:54:15 +00:00
Peter Wemm
d4550896b0 Repocopied to src/sys/conf/kmod.mk 2000-05-04 12:18:19 +00:00
Peter Wemm
09be11ba99 Remove KMODDEPS support. All our existing dependencies are specified
via the MODULE_VERSION() and MODULE_DEPEND() macros that both the loader
and kld system know how to deal with.  The old DT_NEEDED tag is still
supported by the loader (and will remain supported for a while) - but the
kernel side presently doesn't know how to deal with DT_NEEDED.
2000-05-01 18:06:49 +00:00
Warner Losh
9a8631b340 Add support for compiling kernel modules outside of the tree. If you
do not have the kernel you wish to compile against in either
/usr/src/sys or /sys, then you will need to set SYSDIR to point to the
sys directory of the source tree that contians the source.

Also, minor tweaks to the load/unload targets from Bruce.

I've had this through several make worlds, as well as using it on a
daily basis for the past couple of weeks to build modules needed for
testing at Timing Solutions.

Reviewed and revised by: bde
Work sponsored by: Timing Solutions
2000-04-08 17:20:00 +00:00
Doug Rabson
c0de587901 Use makeobjops.pl instead of makedevops.pl. 2000-04-08 15:31:28 +00:00
Doug Rabson
7fecffec3d Allow the calling Makefile to specify a list of device interfaces instead
of relying on the default list provided here.
2000-04-05 10:13:05 +00:00
Peter Wemm
9e0f2a9fb1 Use an intermediate file containing the module binary before converting
it into a ``shared'' .ko file.  This intermediate file can be directly
linked into a static kernel.  This isn't all that useful yet but will
become much more interesting shortly.
2000-03-20 01:29:59 +00:00
Bruce Evans
9e4be63dd6 Add ${DEBUG_FLAGS} to CFLAGS in bsd.kmod.mk, not in scattered module
makefiles.  Bad examples in fxp/Makefile keep getting copied to new
makefiles.
2000-01-28 11:26:46 +00:00
Peter Wemm
647b247c34 oops, nearly forgot to commit the addition of ppbus_if.m to the list. 2000-01-23 15:42:44 +00:00
Bruce Evans
a0b845fe92 Add "-I@/../include" and/or "-I${DESTDIR}/usr/include" to CFLAGS,
essentially as in kernel makefiles, so that module sources can include
<stddef.h> and other standard headers.  Only add the second path when
the first path can't be found, instead of when DESTDIR is defined.
Adding it used to be just an obfuscation.

Use "${.OBJDIR}" instyead of "." in -I paths.  Using "${.OBJDIR}" just
gave more verbose command lines and depend files.
2000-01-08 18:48:57 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Peter Wemm
3b073b53b7 Update vnode_if.sh location. This was deliberately left a while after
the repo copy as the kernel src/sys/modules stuff uses
/usr/share/mk/bsd.kmod.mk which often gets out of sync with the kernel
source.
1999-12-22 01:07:30 +00:00
Peter Wemm
9029b6442a Use the -c and -h args of vnode_if.sh to generate only the .h file that
we use.  The .c half is statically compiled into the kernel.  It's kinda
silly to generate a .h file on the fly that has inlines to call the
.c stuff when the .c code is fixed.

Also, zap the special treatment for VFS_KLD modules.  This treatment
applies to lots of things, not just VFS's.
1999-12-12 16:45:58 +00:00
Warner Losh
052331f45b Add two modules for the pccard work: dev/pccard/card_if.m and
dev/pccard/power_if.m.

XXX There has got to be a better way to deal with this.
1999-11-28 20:18:50 +00:00
Bruce Evans
4fea670478 Build and clean device interface files (foo_if.[ch]) and empty options
files (opt_*.h) automatically (if they are in ${SRCS}).

Clean vnode_if.[ch] automatically (if one of them is in ${SRCS}, not just
if VFS_KLD is defined).

There are some complications to avoid using the "@" symlink before it
is built.
1999-11-28 17:52:40 +00:00
Marcel Moolenaar
84eadd6305 Add .ORDER which is needed for the previous commit to work with -jN.
Pointed out by: bde
1999-11-23 17:18:52 +00:00
Marcel Moolenaar
5f644e4c72 vnode_if.sh makes both vnode_if.c and vnode_if.h. Add vnode_if.c to
the LHS of the rule for vnode_if.h. This solves a "dunno how to make"
error.
1999-11-23 10:17:36 +00:00
Nick Hibma
fe3cac87c1 1) s/mod(un)?load/kld$1load/
2) s/MODLOAD/KMODLOAD/ to be consistent with the rest of the variables
(KMOD, KMODOWN, KMODGRP, etc) and definition of MODLOAD/UNLOAD in the
Makefile of the ATAPI module

3) textual fixups
1999-09-06 20:11:59 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Tim Vanderhoek
e902c1bb07 Add variable INSTALLFLAGS_EDIT used to remove arbitrary INSTALLFLAGS.
Specifically intended for removing -fschg ("INSTALLFLAGS_EDIT=:S/schg/uchg/")
this makes the NOFSCHG flag redundant.  NOFSCHG will still be honoured by
bsd.lib.mk but is valid for buildworld only.  NOFSCHG is still implemented in
the old way (ie. _not_ ".if NOFSCHG then { INSTALLFLAGS_EDIT+=:S/schg/,/ }"
to emphasize the fact that NOFSCHG is only supported in a limited
fashion and for buildworld.

The interface and implementation are such that future use of flags such
as sappnd can also be easily removed or altered (perhaps to uappnd).

This commit brought to you by the letters B, D, and E, and the numbers six,
one, thirteen, and three.
1999-07-31 20:27:33 +00:00
Peter Wemm
e0e77ef1c6 s/lkm(4)/kld(4)/ 1999-04-23 20:53:34 +00:00
Peter Wemm
713959259e Clean out most of the LKM stuff, the build support left a little while ago. 1999-04-20 14:33:24 +00:00
Bruce Evans
2336a7ea75 Removed all traces of LN_FLAGS. It was only used to produce a link
/usr/sbin/sysctl -> ${DESTDIR}/sbin/sysctl in some versions of 2.2,
and this link was broken if DESTDIR was set.

Added a SYMLINKS macro.  This works the same as LINKS, except it
creates symlinks and the linked-to pathname may be relative.  This
is more flexible than LN_FLAGS, since it supports installing
symlinks independently of hard links.

Use `ln -f[s] ...' instead of `rm -f ...; ln [-s] ...' for LINKS and
SYMLINKS.  This is equivalent if the target is neither a directory nor
a symlink to a directory.

PR:		8279
1999-03-23 03:06:25 +00:00
Peter Wemm
1e216ab590 Use a name less likely to collide with source files without an obj dir. 1998-11-11 07:40:44 +00:00
Peter Wemm
92892ca7a5 Do not add ${KMOD} to the CLEANFILES list. We want ${PROG} which is either
${KMOD}.o or ${KMOD}.ko.  Otherwise we can delete the source shell script
for linux, joy and ibcs2.
1998-11-05 04:01:55 +00:00
Peter Wemm
08a04a8985 Update the kld glue
Pre-Approved by: jkh
1998-10-16 03:32:03 +00:00
Peter Wemm
fdbdd3a05f Support encapsulating ELF linker sets for KLD modules via gensetdefs.
Support name based dependencies at build time.  This is a hack.
These only affect KLD modules.
1998-10-14 04:04:22 +00:00