aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2018-06-25 19:55:15 +0000
committerBrooks Davis <brooks@FreeBSD.org>2018-06-25 19:55:15 +0000
commite4b0a90e771b94e4b043729a6f0f5564f1d01aca (patch)
tree2cb4088f70d2963a7584dc9069c3c90a27081d45
parent9c42fa94a63fc22aee2bd106aa12bfa7388f3911 (diff)
downloadsrc-e4b0a90e771b94e4b043729a6f0f5564f1d01aca.tar.gz
src-e4b0a90e771b94e4b043729a6f0f5564f1d01aca.zip
Normalize the g(eom,cache,part,...) build.
Rather then combining hardlink creation for the geom(8) binary with shared library build, move libraries to src/lib/geom so they are built and installed normally. Create a common Makefile.classes which is included by both lib/geom/Makefile and sbin/geom/Makefile so the symlink and libraries stay in sync. The relocation of libraries allows libraries to be build for 32-bit compat. This also reduces the number of non-standard builds in the system. This commit is not sufficent to run a 32-bit /sbin/geom on a 64-bit system out of the box as it will look in the wrong place for libraries unless GEOM_LIBRARY_PATH is set appropriatly in the environment. Reviewed by: bdrewery Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15360
Notes
Notes: svn path=/head/; revision=335645
-rw-r--r--Makefile.inc13
-rw-r--r--etc/mtree/BSD.lib32.dist2
-rw-r--r--lib/Makefile2
-rw-r--r--lib/geom/Makefile6
-rw-r--r--lib/geom/Makefile.inc (renamed from sbin/geom/class/Makefile.inc)11
-rw-r--r--lib/geom/cache/Makefile (renamed from sbin/geom/class/cache/Makefile)0
-rw-r--r--lib/geom/cache/Makefile.depend (renamed from sbin/geom/class/cache/Makefile.depend)0
-rw-r--r--lib/geom/cache/gcache.8 (renamed from sbin/geom/class/cache/gcache.8)0
-rw-r--r--lib/geom/cache/geom_cache.c (renamed from sbin/geom/class/cache/geom_cache.c)0
-rw-r--r--lib/geom/concat/Makefile (renamed from sbin/geom/class/concat/Makefile)0
-rw-r--r--lib/geom/concat/Makefile.depend (renamed from sbin/geom/class/concat/Makefile.depend)0
-rw-r--r--lib/geom/concat/gconcat.8 (renamed from sbin/geom/class/concat/gconcat.8)0
-rw-r--r--lib/geom/concat/geom_concat.c (renamed from sbin/geom/class/concat/geom_concat.c)0
-rw-r--r--lib/geom/eli/Makefile (renamed from sbin/geom/class/eli/Makefile)0
-rw-r--r--lib/geom/eli/Makefile.depend (renamed from sbin/geom/class/eli/Makefile.depend)0
-rw-r--r--lib/geom/eli/geli.8 (renamed from sbin/geom/class/eli/geli.8)0
-rw-r--r--lib/geom/eli/geom_eli.c (renamed from sbin/geom/class/eli/geom_eli.c)0
-rw-r--r--lib/geom/journal/Makefile (renamed from sbin/geom/class/journal/Makefile)0
-rw-r--r--lib/geom/journal/Makefile.depend (renamed from sbin/geom/class/journal/Makefile.depend)0
-rw-r--r--lib/geom/journal/geom_journal.c (renamed from sbin/geom/class/journal/geom_journal.c)0
-rw-r--r--lib/geom/journal/geom_journal.h (renamed from sbin/geom/class/journal/geom_journal.h)0
-rw-r--r--lib/geom/journal/geom_journal_ufs.c (renamed from sbin/geom/class/journal/geom_journal_ufs.c)0
-rw-r--r--lib/geom/journal/gjournal.8 (renamed from sbin/geom/class/journal/gjournal.8)0
-rw-r--r--lib/geom/label/Makefile (renamed from sbin/geom/class/label/Makefile)0
-rw-r--r--lib/geom/label/Makefile.depend (renamed from sbin/geom/class/label/Makefile.depend)0
-rw-r--r--lib/geom/label/geom_label.c (renamed from sbin/geom/class/label/geom_label.c)0
-rw-r--r--lib/geom/label/glabel.8 (renamed from sbin/geom/class/label/glabel.8)0
-rw-r--r--lib/geom/mirror/Makefile (renamed from sbin/geom/class/mirror/Makefile)0
-rw-r--r--lib/geom/mirror/Makefile.depend (renamed from sbin/geom/class/mirror/Makefile.depend)0
-rw-r--r--lib/geom/mirror/geom_mirror.c (renamed from sbin/geom/class/mirror/geom_mirror.c)0
-rw-r--r--lib/geom/mirror/gmirror.8 (renamed from sbin/geom/class/mirror/gmirror.8)0
-rw-r--r--lib/geom/mountver/Makefile (renamed from sbin/geom/class/mountver/Makefile)0
-rw-r--r--lib/geom/mountver/Makefile.depend (renamed from sbin/geom/class/mountver/Makefile.depend)0
-rw-r--r--lib/geom/mountver/geom_mountver.c (renamed from sbin/geom/class/mountver/geom_mountver.c)0
-rw-r--r--lib/geom/mountver/gmountver.8 (renamed from sbin/geom/class/mountver/gmountver.8)0
-rw-r--r--lib/geom/multipath/Makefile (renamed from sbin/geom/class/multipath/Makefile)0
-rw-r--r--lib/geom/multipath/Makefile.depend (renamed from sbin/geom/class/multipath/Makefile.depend)0
-rw-r--r--lib/geom/multipath/geom_multipath.c (renamed from sbin/geom/class/multipath/geom_multipath.c)0
-rw-r--r--lib/geom/multipath/gmultipath.8 (renamed from sbin/geom/class/multipath/gmultipath.8)0
-rw-r--r--lib/geom/nop/Makefile (renamed from sbin/geom/class/nop/Makefile)0
-rw-r--r--lib/geom/nop/Makefile.depend (renamed from sbin/geom/class/nop/Makefile.depend)0
-rw-r--r--lib/geom/nop/geom_nop.c (renamed from sbin/geom/class/nop/geom_nop.c)0
-rw-r--r--lib/geom/nop/gnop.8 (renamed from sbin/geom/class/nop/gnop.8)0
-rw-r--r--lib/geom/part/Makefile (renamed from sbin/geom/class/part/Makefile)0
-rw-r--r--lib/geom/part/Makefile.depend (renamed from sbin/geom/class/part/Makefile.depend)0
-rw-r--r--lib/geom/part/geom_part.c (renamed from sbin/geom/class/part/geom_part.c)0
-rw-r--r--lib/geom/part/gpart.8 (renamed from sbin/geom/class/part/gpart.8)0
-rw-r--r--lib/geom/raid/Makefile (renamed from sbin/geom/class/raid/Makefile)0
-rw-r--r--lib/geom/raid/Makefile.depend (renamed from sbin/geom/class/raid/Makefile.depend)0
-rw-r--r--lib/geom/raid/geom_raid.c (renamed from sbin/geom/class/raid/geom_raid.c)0
-rw-r--r--lib/geom/raid/graid.8 (renamed from sbin/geom/class/raid/graid.8)0
-rw-r--r--lib/geom/raid3/Makefile (renamed from sbin/geom/class/raid3/Makefile)0
-rw-r--r--lib/geom/raid3/Makefile.depend (renamed from sbin/geom/class/raid3/Makefile.depend)0
-rw-r--r--lib/geom/raid3/geom_raid3.c (renamed from sbin/geom/class/raid3/geom_raid3.c)0
-rw-r--r--lib/geom/raid3/graid3.8 (renamed from sbin/geom/class/raid3/graid3.8)0
-rw-r--r--lib/geom/sched/Makefile (renamed from sbin/geom/class/sched/Makefile)0
-rw-r--r--lib/geom/sched/Makefile.depend (renamed from sbin/geom/class/sched/Makefile.depend)0
-rw-r--r--lib/geom/sched/geom_sched.c (renamed from sbin/geom/class/sched/geom_sched.c)0
-rw-r--r--lib/geom/sched/gsched.8 (renamed from sbin/geom/class/sched/gsched.8)0
-rw-r--r--lib/geom/shsec/Makefile (renamed from sbin/geom/class/shsec/Makefile)0
-rw-r--r--lib/geom/shsec/Makefile.depend (renamed from sbin/geom/class/shsec/Makefile.depend)0
-rw-r--r--lib/geom/shsec/geom_shsec.c (renamed from sbin/geom/class/shsec/geom_shsec.c)0
-rw-r--r--lib/geom/shsec/gshsec.8 (renamed from sbin/geom/class/shsec/gshsec.8)0
-rw-r--r--lib/geom/stripe/Makefile (renamed from sbin/geom/class/stripe/Makefile)0
-rw-r--r--lib/geom/stripe/Makefile.depend (renamed from sbin/geom/class/stripe/Makefile.depend)0
-rw-r--r--lib/geom/stripe/geom_stripe.c (renamed from sbin/geom/class/stripe/geom_stripe.c)0
-rw-r--r--lib/geom/stripe/gstripe.8 (renamed from sbin/geom/class/stripe/gstripe.8)0
-rw-r--r--lib/geom/virstor/Makefile (renamed from sbin/geom/class/virstor/Makefile)0
-rw-r--r--lib/geom/virstor/Makefile.depend (renamed from sbin/geom/class/virstor/Makefile.depend)0
-rw-r--r--lib/geom/virstor/geom_virstor.c (renamed from sbin/geom/class/virstor/geom_virstor.c)0
-rw-r--r--lib/geom/virstor/gvirstor.8 (renamed from sbin/geom/class/virstor/gvirstor.8)0
-rw-r--r--sbin/geom/Makefile38
-rw-r--r--sbin/geom/Makefile.inc5
-rw-r--r--sbin/geom/class/Makefile24
-rw-r--r--sbin/geom/core/Makefile17
-rw-r--r--targets/pseudo/userland/Makefile.depend16
-rw-r--r--targets/pseudo/userland/lib/Makefile.depend16
77 files changed, 55 insertions, 85 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 769441d20ec4..e20a9b343c61 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -952,7 +952,7 @@ _worldtmp: .PHONY
@touch ${WORLDTMP}/${.TARGET}
.for _dir in \
- lib lib/casper usr legacy/bin legacy/usr
+ lib lib/casper lib/geom usr legacy/bin legacy/usr
mkdir -p ${WORLDTMP}/${_dir}
.endfor
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
@@ -2507,6 +2507,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_cddl_lib_libavl} \
${_cddl_lib_libzfs_core} \
${_cddl_lib_libctf} \
+ lib/libufs \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
${_secure_lib_libssh} ${_secure_lib_libssl}
diff --git a/etc/mtree/BSD.lib32.dist b/etc/mtree/BSD.lib32.dist
index a82368f9ef6d..3e2d80fd6cae 100644
--- a/etc/mtree/BSD.lib32.dist
+++ b/etc/mtree/BSD.lib32.dist
@@ -8,6 +8,8 @@
lib32
dtrace
..
+ geom
+ ..
i18n
..
..
diff --git a/lib/Makefile b/lib/Makefile
index 82e8af3b679f..506675476078 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -24,6 +24,7 @@ SUBDIR_BOOTSTRAP= \
SUBDIR= ${SUBDIR_BOOTSTRAP} \
.WAIT \
+ geom \
libalias \
libarchive \
libauditd \
@@ -100,6 +101,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \
# Inter-library dependencies. When the makefile for a library contains LDADD
# libraries, those libraries should be listed as build order dependencies here.
+SUBDIR_DEPEND_geom= libufs
SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma libmd
SUBDIR_DEPEND_libauditdm= libbsm
SUBDIR_DEPEND_libbsnmp= ${_libnetgraph}
diff --git a/lib/geom/Makefile b/lib/geom/Makefile
new file mode 100644
index 000000000000..2a53278be92d
--- /dev/null
+++ b/lib/geom/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+SUBDIR=${GEOM_CLASSES}
+
+.include "Makefile.inc"
+.include <bsd.subdir.mk>
diff --git a/sbin/geom/class/Makefile.inc b/lib/geom/Makefile.inc
index 6da58bbac05c..74597f8bcacd 100644
--- a/sbin/geom/class/Makefile.inc
+++ b/lib/geom/Makefile.inc
@@ -1,13 +1,16 @@
# $FreeBSD$
-SHLIBDIR?=${GEOM_CLASS_DIR}
+.include <src.opts.mk>
+
+SHLIBDIR=${GEOM_CLASS_DIR}
SHLIB_NAME?=geom_${GEOM_CLASS}.so
-LINKS= ${BINDIR}/geom ${BINDIR}/g${GEOM_CLASS}
MAN= g${GEOM_CLASS}.8
SRCS+= geom_${GEOM_CLASS}.c subr.c
+CFLAGS+=-I${SRCTOP}/sbin/geom
-NO_WMISSING_VARIABLE_DECLARATIONS=
+.PATH: ${SRCTOP}/sbin/geom/misc
-CFLAGS+= -I${.CURDIR:H:H}
+NO_WMISSING_VARIABLE_DECLARATIONS=
+.include "Makefile.classes"
.include "../Makefile.inc"
diff --git a/sbin/geom/class/cache/Makefile b/lib/geom/cache/Makefile
index e1ba031c9ffe..e1ba031c9ffe 100644
--- a/sbin/geom/class/cache/Makefile
+++ b/lib/geom/cache/Makefile
diff --git a/sbin/geom/class/cache/Makefile.depend b/lib/geom/cache/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/cache/Makefile.depend
+++ b/lib/geom/cache/Makefile.depend
diff --git a/sbin/geom/class/cache/gcache.8 b/lib/geom/cache/gcache.8
index b0f1c7abf1f7..b0f1c7abf1f7 100644
--- a/sbin/geom/class/cache/gcache.8
+++ b/lib/geom/cache/gcache.8
diff --git a/sbin/geom/class/cache/geom_cache.c b/lib/geom/cache/geom_cache.c
index 4e76da2ce7a8..4e76da2ce7a8 100644
--- a/sbin/geom/class/cache/geom_cache.c
+++ b/lib/geom/cache/geom_cache.c
diff --git a/sbin/geom/class/concat/Makefile b/lib/geom/concat/Makefile
index 3c370520a624..3c370520a624 100644
--- a/sbin/geom/class/concat/Makefile
+++ b/lib/geom/concat/Makefile
diff --git a/sbin/geom/class/concat/Makefile.depend b/lib/geom/concat/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/concat/Makefile.depend
+++ b/lib/geom/concat/Makefile.depend
diff --git a/sbin/geom/class/concat/gconcat.8 b/lib/geom/concat/gconcat.8
index d874b087b649..d874b087b649 100644
--- a/sbin/geom/class/concat/gconcat.8
+++ b/lib/geom/concat/gconcat.8
diff --git a/sbin/geom/class/concat/geom_concat.c b/lib/geom/concat/geom_concat.c
index 801bea61cdfd..801bea61cdfd 100644
--- a/sbin/geom/class/concat/geom_concat.c
+++ b/lib/geom/concat/geom_concat.c
diff --git a/sbin/geom/class/eli/Makefile b/lib/geom/eli/Makefile
index b9bd29268893..b9bd29268893 100644
--- a/sbin/geom/class/eli/Makefile
+++ b/lib/geom/eli/Makefile
diff --git a/sbin/geom/class/eli/Makefile.depend b/lib/geom/eli/Makefile.depend
index 3378fcd11dbc..3378fcd11dbc 100644
--- a/sbin/geom/class/eli/Makefile.depend
+++ b/lib/geom/eli/Makefile.depend
diff --git a/sbin/geom/class/eli/geli.8 b/lib/geom/eli/geli.8
index e4a48cf625f7..e4a48cf625f7 100644
--- a/sbin/geom/class/eli/geli.8
+++ b/lib/geom/eli/geli.8
diff --git a/sbin/geom/class/eli/geom_eli.c b/lib/geom/eli/geom_eli.c
index f6ed6a88fb4f..f6ed6a88fb4f 100644
--- a/sbin/geom/class/eli/geom_eli.c
+++ b/lib/geom/eli/geom_eli.c
diff --git a/sbin/geom/class/journal/Makefile b/lib/geom/journal/Makefile
index 3be15a13a81e..3be15a13a81e 100644
--- a/sbin/geom/class/journal/Makefile
+++ b/lib/geom/journal/Makefile
diff --git a/sbin/geom/class/journal/Makefile.depend b/lib/geom/journal/Makefile.depend
index 7c411851c451..7c411851c451 100644
--- a/sbin/geom/class/journal/Makefile.depend
+++ b/lib/geom/journal/Makefile.depend
diff --git a/sbin/geom/class/journal/geom_journal.c b/lib/geom/journal/geom_journal.c
index 2a174c6e5b1c..2a174c6e5b1c 100644
--- a/sbin/geom/class/journal/geom_journal.c
+++ b/lib/geom/journal/geom_journal.c
diff --git a/sbin/geom/class/journal/geom_journal.h b/lib/geom/journal/geom_journal.h
index 6725fe04001a..6725fe04001a 100644
--- a/sbin/geom/class/journal/geom_journal.h
+++ b/lib/geom/journal/geom_journal.h
diff --git a/sbin/geom/class/journal/geom_journal_ufs.c b/lib/geom/journal/geom_journal_ufs.c
index 324be1748261..324be1748261 100644
--- a/sbin/geom/class/journal/geom_journal_ufs.c
+++ b/lib/geom/journal/geom_journal_ufs.c
diff --git a/sbin/geom/class/journal/gjournal.8 b/lib/geom/journal/gjournal.8
index 6eb8cde821ae..6eb8cde821ae 100644
--- a/sbin/geom/class/journal/gjournal.8
+++ b/lib/geom/journal/gjournal.8
diff --git a/sbin/geom/class/label/Makefile b/lib/geom/label/Makefile
index 767924b78b61..767924b78b61 100644
--- a/sbin/geom/class/label/Makefile
+++ b/lib/geom/label/Makefile
diff --git a/sbin/geom/class/label/Makefile.depend b/lib/geom/label/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/label/Makefile.depend
+++ b/lib/geom/label/Makefile.depend
diff --git a/sbin/geom/class/label/geom_label.c b/lib/geom/label/geom_label.c
index f51e87ecb57d..f51e87ecb57d 100644
--- a/sbin/geom/class/label/geom_label.c
+++ b/lib/geom/label/geom_label.c
diff --git a/sbin/geom/class/label/glabel.8 b/lib/geom/label/glabel.8
index c426a06ea355..c426a06ea355 100644
--- a/sbin/geom/class/label/glabel.8
+++ b/lib/geom/label/glabel.8
diff --git a/sbin/geom/class/mirror/Makefile b/lib/geom/mirror/Makefile
index 553e44787d8b..553e44787d8b 100644
--- a/sbin/geom/class/mirror/Makefile
+++ b/lib/geom/mirror/Makefile
diff --git a/sbin/geom/class/mirror/Makefile.depend b/lib/geom/mirror/Makefile.depend
index 7902e1927044..7902e1927044 100644
--- a/sbin/geom/class/mirror/Makefile.depend
+++ b/lib/geom/mirror/Makefile.depend
diff --git a/sbin/geom/class/mirror/geom_mirror.c b/lib/geom/mirror/geom_mirror.c
index a1b399338814..a1b399338814 100644
--- a/sbin/geom/class/mirror/geom_mirror.c
+++ b/lib/geom/mirror/geom_mirror.c
diff --git a/sbin/geom/class/mirror/gmirror.8 b/lib/geom/mirror/gmirror.8
index 128138bbd2e4..128138bbd2e4 100644
--- a/sbin/geom/class/mirror/gmirror.8
+++ b/lib/geom/mirror/gmirror.8
diff --git a/sbin/geom/class/mountver/Makefile b/lib/geom/mountver/Makefile
index 36c1e01e112a..36c1e01e112a 100644
--- a/sbin/geom/class/mountver/Makefile
+++ b/lib/geom/mountver/Makefile
diff --git a/sbin/geom/class/mountver/Makefile.depend b/lib/geom/mountver/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/mountver/Makefile.depend
+++ b/lib/geom/mountver/Makefile.depend
diff --git a/sbin/geom/class/mountver/geom_mountver.c b/lib/geom/mountver/geom_mountver.c
index 0d065d71612e..0d065d71612e 100644
--- a/sbin/geom/class/mountver/geom_mountver.c
+++ b/lib/geom/mountver/geom_mountver.c
diff --git a/sbin/geom/class/mountver/gmountver.8 b/lib/geom/mountver/gmountver.8
index 4c27a652b0b0..4c27a652b0b0 100644
--- a/sbin/geom/class/mountver/gmountver.8
+++ b/lib/geom/mountver/gmountver.8
diff --git a/sbin/geom/class/multipath/Makefile b/lib/geom/multipath/Makefile
index 5a753e42d76d..5a753e42d76d 100644
--- a/sbin/geom/class/multipath/Makefile
+++ b/lib/geom/multipath/Makefile
diff --git a/sbin/geom/class/multipath/Makefile.depend b/lib/geom/multipath/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/multipath/Makefile.depend
+++ b/lib/geom/multipath/Makefile.depend
diff --git a/sbin/geom/class/multipath/geom_multipath.c b/lib/geom/multipath/geom_multipath.c
index 12f194ff762d..12f194ff762d 100644
--- a/sbin/geom/class/multipath/geom_multipath.c
+++ b/lib/geom/multipath/geom_multipath.c
diff --git a/sbin/geom/class/multipath/gmultipath.8 b/lib/geom/multipath/gmultipath.8
index f6e286a43c72..f6e286a43c72 100644
--- a/sbin/geom/class/multipath/gmultipath.8
+++ b/lib/geom/multipath/gmultipath.8
diff --git a/sbin/geom/class/nop/Makefile b/lib/geom/nop/Makefile
index 9d8b69117466..9d8b69117466 100644
--- a/sbin/geom/class/nop/Makefile
+++ b/lib/geom/nop/Makefile
diff --git a/sbin/geom/class/nop/Makefile.depend b/lib/geom/nop/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/nop/Makefile.depend
+++ b/lib/geom/nop/Makefile.depend
diff --git a/sbin/geom/class/nop/geom_nop.c b/lib/geom/nop/geom_nop.c
index 65dc07cf1a3c..65dc07cf1a3c 100644
--- a/sbin/geom/class/nop/geom_nop.c
+++ b/lib/geom/nop/geom_nop.c
diff --git a/sbin/geom/class/nop/gnop.8 b/lib/geom/nop/gnop.8
index f9b3dc2c440e..f9b3dc2c440e 100644
--- a/sbin/geom/class/nop/gnop.8
+++ b/lib/geom/nop/gnop.8
diff --git a/sbin/geom/class/part/Makefile b/lib/geom/part/Makefile
index e9631caf4d84..e9631caf4d84 100644
--- a/sbin/geom/class/part/Makefile
+++ b/lib/geom/part/Makefile
diff --git a/sbin/geom/class/part/Makefile.depend b/lib/geom/part/Makefile.depend
index 29b9a504acf9..29b9a504acf9 100644
--- a/sbin/geom/class/part/Makefile.depend
+++ b/lib/geom/part/Makefile.depend
diff --git a/sbin/geom/class/part/geom_part.c b/lib/geom/part/geom_part.c
index 29c066c4714f..29c066c4714f 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/lib/geom/part/geom_part.c
diff --git a/sbin/geom/class/part/gpart.8 b/lib/geom/part/gpart.8
index 829181578e8f..829181578e8f 100644
--- a/sbin/geom/class/part/gpart.8
+++ b/lib/geom/part/gpart.8
diff --git a/sbin/geom/class/raid/Makefile b/lib/geom/raid/Makefile
index 75d2ac7e25b7..75d2ac7e25b7 100644
--- a/sbin/geom/class/raid/Makefile
+++ b/lib/geom/raid/Makefile
diff --git a/sbin/geom/class/raid/Makefile.depend b/lib/geom/raid/Makefile.depend
index 7902e1927044..7902e1927044 100644
--- a/sbin/geom/class/raid/Makefile.depend
+++ b/lib/geom/raid/Makefile.depend
diff --git a/sbin/geom/class/raid/geom_raid.c b/lib/geom/raid/geom_raid.c
index efb356f6a7e3..efb356f6a7e3 100644
--- a/sbin/geom/class/raid/geom_raid.c
+++ b/lib/geom/raid/geom_raid.c
diff --git a/sbin/geom/class/raid/graid.8 b/lib/geom/raid/graid.8
index e11648659495..e11648659495 100644
--- a/sbin/geom/class/raid/graid.8
+++ b/lib/geom/raid/graid.8
diff --git a/sbin/geom/class/raid3/Makefile b/lib/geom/raid3/Makefile
index 2fdf4e8f8167..2fdf4e8f8167 100644
--- a/sbin/geom/class/raid3/Makefile
+++ b/lib/geom/raid3/Makefile
diff --git a/sbin/geom/class/raid3/Makefile.depend b/lib/geom/raid3/Makefile.depend
index 7902e1927044..7902e1927044 100644
--- a/sbin/geom/class/raid3/Makefile.depend
+++ b/lib/geom/raid3/Makefile.depend
diff --git a/sbin/geom/class/raid3/geom_raid3.c b/lib/geom/raid3/geom_raid3.c
index 17d3187d5cf4..17d3187d5cf4 100644
--- a/sbin/geom/class/raid3/geom_raid3.c
+++ b/lib/geom/raid3/geom_raid3.c
diff --git a/sbin/geom/class/raid3/graid3.8 b/lib/geom/raid3/graid3.8
index 426c94d17521..426c94d17521 100644
--- a/sbin/geom/class/raid3/graid3.8
+++ b/lib/geom/raid3/graid3.8
diff --git a/sbin/geom/class/sched/Makefile b/lib/geom/sched/Makefile
index ad3f5b131a18..ad3f5b131a18 100644
--- a/sbin/geom/class/sched/Makefile
+++ b/lib/geom/sched/Makefile
diff --git a/sbin/geom/class/sched/Makefile.depend b/lib/geom/sched/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/sched/Makefile.depend
+++ b/lib/geom/sched/Makefile.depend
diff --git a/sbin/geom/class/sched/geom_sched.c b/lib/geom/sched/geom_sched.c
index 7b7b281d7d55..7b7b281d7d55 100644
--- a/sbin/geom/class/sched/geom_sched.c
+++ b/lib/geom/sched/geom_sched.c
diff --git a/sbin/geom/class/sched/gsched.8 b/lib/geom/sched/gsched.8
index facb5c18440f..facb5c18440f 100644
--- a/sbin/geom/class/sched/gsched.8
+++ b/lib/geom/sched/gsched.8
diff --git a/sbin/geom/class/shsec/Makefile b/lib/geom/shsec/Makefile
index f86df6c9af42..f86df6c9af42 100644
--- a/sbin/geom/class/shsec/Makefile
+++ b/lib/geom/shsec/Makefile
diff --git a/sbin/geom/class/shsec/Makefile.depend b/lib/geom/shsec/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/shsec/Makefile.depend
+++ b/lib/geom/shsec/Makefile.depend
diff --git a/sbin/geom/class/shsec/geom_shsec.c b/lib/geom/shsec/geom_shsec.c
index 308a53b7f9d3..308a53b7f9d3 100644
--- a/sbin/geom/class/shsec/geom_shsec.c
+++ b/lib/geom/shsec/geom_shsec.c
diff --git a/sbin/geom/class/shsec/gshsec.8 b/lib/geom/shsec/gshsec.8
index dcfd2b397909..dcfd2b397909 100644
--- a/sbin/geom/class/shsec/gshsec.8
+++ b/lib/geom/shsec/gshsec.8
diff --git a/sbin/geom/class/stripe/Makefile b/lib/geom/stripe/Makefile
index bbea1901749e..bbea1901749e 100644
--- a/sbin/geom/class/stripe/Makefile
+++ b/lib/geom/stripe/Makefile
diff --git a/sbin/geom/class/stripe/Makefile.depend b/lib/geom/stripe/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/stripe/Makefile.depend
+++ b/lib/geom/stripe/Makefile.depend
diff --git a/sbin/geom/class/stripe/geom_stripe.c b/lib/geom/stripe/geom_stripe.c
index 175ddada2e33..175ddada2e33 100644
--- a/sbin/geom/class/stripe/geom_stripe.c
+++ b/lib/geom/stripe/geom_stripe.c
diff --git a/sbin/geom/class/stripe/gstripe.8 b/lib/geom/stripe/gstripe.8
index f1f34fe10609..f1f34fe10609 100644
--- a/sbin/geom/class/stripe/gstripe.8
+++ b/lib/geom/stripe/gstripe.8
diff --git a/sbin/geom/class/virstor/Makefile b/lib/geom/virstor/Makefile
index dfbe0aeddc47..dfbe0aeddc47 100644
--- a/sbin/geom/class/virstor/Makefile
+++ b/lib/geom/virstor/Makefile
diff --git a/sbin/geom/class/virstor/Makefile.depend b/lib/geom/virstor/Makefile.depend
index fb5f86e931fb..fb5f86e931fb 100644
--- a/sbin/geom/class/virstor/Makefile.depend
+++ b/lib/geom/virstor/Makefile.depend
diff --git a/sbin/geom/class/virstor/geom_virstor.c b/lib/geom/virstor/geom_virstor.c
index 25ebdebbe7eb..25ebdebbe7eb 100644
--- a/sbin/geom/class/virstor/geom_virstor.c
+++ b/lib/geom/virstor/geom_virstor.c
diff --git a/sbin/geom/class/virstor/gvirstor.8 b/lib/geom/virstor/gvirstor.8
index 3d93e5baa2ae..3d93e5baa2ae 100644
--- a/sbin/geom/class/virstor/gvirstor.8
+++ b/lib/geom/virstor/gvirstor.8
diff --git a/sbin/geom/Makefile b/sbin/geom/Makefile
index 5ef8fb847dd8..9520483815b3 100644
--- a/sbin/geom/Makefile
+++ b/sbin/geom/Makefile
@@ -1,28 +1,30 @@
# $FreeBSD$
-PACKAGE=runtime
-.if defined(RESCUE) || defined(RELEASE_CRUNCH)
+.include <src.opts.mk>
-.PATH: ${.CURDIR}/class/part \
- ${.CURDIR}/class/label \
- ${.CURDIR}/core \
- ${.CURDIR}/misc
+.PATH: ${.CURDIR}/core ${.CURDIR}/misc
-PROG= geom
-SRCS= geom.c geom_label.c geom_part.c subr.c
-MAN=
+PACKAGE=runtime
+PROG= geom
+SRCS= geom.c subr.c
+MAN= geom.8
+CFLAGS+= -I${.CURDIR} -I${.CURDIR}/core
+CFLAGS+= -DGEOM_CLASS_DIR=\"${GEOM_CLASS_DIR}\"
-WARNS?= 2
-CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core -DSTATIC_GEOM_CLASSES
+LIBADD= geom util
-LIBADD= geom util
+.if defined(RESCUE) || defined(RELEASE_CRUNCH)
+.PATH: ${SRCTOP}/lib/geom/part \
+ ${SRCTOP}/lib/geom/label
-.include <bsd.prog.mk>
+SRCS+= geom_label.c geom_part.c
+MAN=
+WARNS?= 2
+CFLAGS+=-DSTATIC_GEOM_CLASSES
.else
-
-SUBDIR= core class
-
-.include <bsd.subdir.mk>
-
+.include "${SRCTOP}/lib/geom/Makefile.classes"
+LINKS= ${GEOM_CLASSES:S|^|${BINDIR}/geom ${BINDIR}/g|}
.endif
+
+.include <bsd.prog.mk>
diff --git a/sbin/geom/Makefile.inc b/sbin/geom/Makefile.inc
deleted file mode 100644
index 0b1f991bfb1c..000000000000
--- a/sbin/geom/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD$
-
-GEOM_CLASS_DIR?=/lib/geom
-
-.include "../Makefile.inc"
diff --git a/sbin/geom/class/Makefile b/sbin/geom/class/Makefile
deleted file mode 100644
index a7ed1b9450e5..000000000000
--- a/sbin/geom/class/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# $FreeBSD$
-
-.include <src.opts.mk>
-
-SUBDIR= cache
-SUBDIR+=concat
-.if ${MK_OPENSSL} != "no"
-SUBDIR+=eli
-.endif
-SUBDIR+=journal
-SUBDIR+=label
-SUBDIR+=mirror
-SUBDIR+=mountver
-SUBDIR+=multipath
-SUBDIR+=nop
-SUBDIR+=part
-SUBDIR+=raid
-SUBDIR+=raid3
-SUBDIR+=sched
-SUBDIR+=shsec
-SUBDIR+=stripe
-SUBDIR+=virstor
-
-.include <bsd.subdir.mk>
diff --git a/sbin/geom/core/Makefile b/sbin/geom/core/Makefile
deleted file mode 100644
index d892575c595d..000000000000
--- a/sbin/geom/core/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR:H}/misc
-
-PACKAGE=runtime
-PROG= geom
-MAN= geom.8
-SRCS= geom.c subr.c
-
-NO_SHARED=NO
-
-CFLAGS+= -DGEOM_CLASS_DIR=\"${GEOM_CLASS_DIR}\"
-CFLAGS+= -I${SRCTOP}/sys -I${.CURDIR} -I${.CURDIR:H}
-
-LIBADD= geom util
-
-.include <bsd.prog.mk>
diff --git a/targets/pseudo/userland/Makefile.depend b/targets/pseudo/userland/Makefile.depend
index 470a57d10759..685e603c5c4b 100644
--- a/targets/pseudo/userland/Makefile.depend
+++ b/targets/pseudo/userland/Makefile.depend
@@ -70,22 +70,6 @@ DIRDEPS+= \
sbin/fsdb \
sbin/fsirand \
sbin/gbde \
- sbin/geom/class/cache \
- sbin/geom/class/concat \
- sbin/geom/class/eli \
- sbin/geom/class/journal \
- sbin/geom/class/label \
- sbin/geom/class/mirror \
- sbin/geom/class/mountver \
- sbin/geom/class/multipath \
- sbin/geom/class/nop \
- sbin/geom/class/part \
- sbin/geom/class/raid \
- sbin/geom/class/raid3 \
- sbin/geom/class/sched \
- sbin/geom/class/shsec \
- sbin/geom/class/stripe \
- sbin/geom/class/virstor \
sbin/geom/core \
sbin/ggate/ggatec \
sbin/ggate/ggated \
diff --git a/targets/pseudo/userland/lib/Makefile.depend b/targets/pseudo/userland/lib/Makefile.depend
index 5ff429cb6bcc..381722cb059b 100644
--- a/targets/pseudo/userland/lib/Makefile.depend
+++ b/targets/pseudo/userland/lib/Makefile.depend
@@ -8,6 +8,22 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/atf/libatf-c \
lib/atf/libatf-c++ \
+ lib/geom/cache \
+ lib/geom/concat \
+ lib/geom/eli \
+ lib/geom/journal \
+ lib/geom/label \
+ lib/geom/mirror \
+ lib/geom/mountver \
+ lib/geom/multipath \
+ lib/geom/nop \
+ lib/geom/part \
+ lib/geom/raid \
+ lib/geom/raid3 \
+ lib/geom/sched \
+ lib/geom/shsec \
+ lib/geom/stripe \
+ lib/geom/virstor \
lib/lib80211 \
lib/libalias/libalias \
lib/libalias/modules/cuseeme \