diff --git a/Makefile.inc1 b/Makefile.inc1 index 648475b98618..27c8808e4499 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1719,7 +1719,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ ${_lib_casper} \ lib/ncurses/ncurses lib/ncurses/ncursesw \ - lib/libopie lib/libpam ${_lib_libthr} \ + lib/libopie lib/libpam/libpam ${_lib_libthr} \ ${_lib_libradius} lib/libsbuf lib/libtacplus \ lib/libgeom \ ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ @@ -1731,6 +1731,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ ${_secure_lib_libcrypto} ${_lib_libldns} \ ${_secure_lib_libssh} ${_secure_lib_libssl} \ gnu/lib/libdialog + .if ${MK_GNUCXX} != "no" _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ gnu/lib/libstdc++__L: lib/msun__L @@ -1898,7 +1899,7 @@ ${_lib}__PL: .PHONY .MAKE .endif .endfor -.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} +.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} ${_lib}__L: .PHONY .MAKE .if exists(${.CURDIR}/${_lib}) ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ @@ -1909,18 +1910,6 @@ ${_lib}__L: .PHONY .MAKE .endif .endfor -# libpam is special: we need to build static PAM modules before -# static PAM library, and dynamic PAM library before dynamic PAM -# modules. -lib/libpam__L: .PHONY .MAKE - ${_+_}@${ECHODIR} "===> lib/libpam (obj,all,install)"; \ - cd ${.CURDIR}/lib/libpam; \ - ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj; \ - ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \ - -D_NO_LIBPAM_SO_YET all; \ - ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \ - -D_NO_LIBPAM_SO_YET install - _prereq_libs: ${_prereq_libs:S/$/__PL/} _startup_libs: ${_startup_libs:S/$/__L/} _prebuild_libs: ${_prebuild_libs:S/$/__L/} diff --git a/lib/libpam/Makefile b/lib/libpam/Makefile index 5c3a2ae60cc5..fa73b95b140d 100644 --- a/lib/libpam/Makefile +++ b/lib/libpam/Makefile @@ -24,8 +24,11 @@ # # $FreeBSD$ -# The modules must be built first, because they are built into the -# static version of libpam. -SUBDIR+= modules libpam static_modules +# The modules link in libpam. They build the static modules as well. +SUBDIR+= libpam modules +SUBDIR_DEPEND_modules= libpam +SUBDIR+= static_libpam +SUBDIR_DEPEND_static_libpam= modules +SUBDIR_PARALLEL= .include diff --git a/lib/libpam/libpam/Makefile b/lib/libpam/libpam/Makefile index 1dc977f610d3..f428a7fc26cf 100644 --- a/lib/libpam/libpam/Makefile +++ b/lib/libpam/libpam/Makefile @@ -38,7 +38,11 @@ OPENPAM= ${.CURDIR}/../../../contrib/openpam .PATH: ${OPENPAM}/include ${OPENPAM}/lib/libpam ${OPENPAM}/doc/man -LIB= pam +# static_libpam will build libpam.a +.if !defined(LIB) +SHLIB= pam +.endif + MK_PROFILE=no SRCS= openpam_asprintf.c \ @@ -98,7 +102,7 @@ SRCS= openpam_asprintf.c \ # Local additions SRCS+= pam_debug_log.c -MAN= openpam.3 \ +MAN?= openpam.3 \ openpam_borrow_cred.3 \ openpam_free_data.3 \ openpam_free_envlist.3 \ @@ -150,10 +154,10 @@ MAN= openpam.3 \ pam_vprompt.3 \ pam.conf.5 -MLINKS= pam.conf.5 pam.d.5 +MLINKS?= pam.conf.5 pam.d.5 CSTD?= c99 -CFLAGS+= -I${.CURDIR} -I${OPENPAM}/include +CFLAGS+= -I${OPENPAM}/include CFLAGS+= -DLIB_MAJ=${SHLIB_MAJOR} CFLAGS+= -DHAVE_DLFUNC=1 CFLAGS+= -DHAVE_FDLOPEN=1 @@ -172,7 +176,7 @@ HEADERS= security/openpam.h \ ADD_HEADERS= security/pam_mod_misc.h # Headers -INCS= ${HEADERS} ${ADD_HEADERS} +INCS?= ${HEADERS} ${ADD_HEADERS} INCSDIR= ${INCLUDEDIR}/security .include diff --git a/lib/libpam/modules/Makefile.inc b/lib/libpam/modules/Makefile.inc index 2da5a7b524ad..899c3cbbc8f6 100644 --- a/lib/libpam/modules/Makefile.inc +++ b/lib/libpam/modules/Makefile.inc @@ -7,14 +7,7 @@ MK_PROFILE= no CFLAGS+= -I${PAMDIR}/include -I${.CURDIR}/../../libpam -# This is nasty. -# For the static case, libpam.a depends on the modules. -# For the dynamic case, the modules depend on libpam.so.N -.if defined(_NO_LIBPAM_SO_YET) -NO_PIC= -.else SHLIB_NAME?= ${LIB}.so.${SHLIB_MAJOR} LIBADD+= pam -.endif .include "../Makefile.inc" diff --git a/lib/libpam/static_modules/Makefile b/lib/libpam/static_libpam/Makefile similarity index 92% rename from lib/libpam/static_modules/Makefile rename to lib/libpam/static_libpam/Makefile index 429e6601e620..f7180e93ef05 100644 --- a/lib/libpam/static_modules/Makefile +++ b/lib/libpam/static_libpam/Makefile @@ -35,15 +35,17 @@ # # $FreeBSD$ -OPENPAM= ${.CURDIR:H:H:H}/contrib/openpam -.PATH: ${OPENPAM}/lib -.PATH: ${OPENPAM}/lib/libpam +.PATH: ${.CURDIR}/../libpam -all: - -SRCS = openpam_static.c +# Only build the static library. +LIB= pam +NO_PIC= +# Avoid redundancy with the master Makefile. MAN= +INCS= +MLINKS= +MK_TESTS= no # # Static modules @@ -61,11 +63,7 @@ STATICOBJS+= openpam_static_modules.o CLEANFILES+= openpam_static.o \ openpam_static_modules.o -.include - -.if empty(_SKIP_BUILD) openpam_static_modules.o: openpam_static.o ${STATIC_MODULES} ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} -all: ${STATICOBJS} -.endif +.include "${.CURDIR}/../libpam/Makefile" diff --git a/lib/libpam/static_modules/Makefile.depend b/lib/libpam/static_libpam/Makefile.depend similarity index 100% rename from lib/libpam/static_modules/Makefile.depend rename to lib/libpam/static_libpam/Makefile.depend diff --git a/targets/pseudo/userland/lib/Makefile.depend b/targets/pseudo/userland/lib/Makefile.depend index 7b911fea9393..dac80744e227 100644 --- a/targets/pseudo/userland/lib/Makefile.depend +++ b/targets/pseudo/userland/lib/Makefile.depend @@ -117,6 +117,7 @@ DIRDEPS = \ lib/libpam/modules/pam_ssh \ lib/libpam/modules/pam_tacplus \ lib/libpam/modules/pam_unix \ + lib/libpam/static_libpam \ lib/libpcap \ lib/libpe \ lib/libpjdlog \