From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 21:31:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E1324EF; Mon, 24 Nov 2014 21:31:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A63C6AF; Mon, 24 Nov 2014 21:31:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAOLV90W001673; Mon, 24 Nov 2014 21:31:09 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAOLV9lQ001672; Mon, 24 Nov 2014 21:31:09 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201411242131.sAOLV9lQ001672@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 24 Nov 2014 21:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274984 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 21:31:09 -0000 Author: bapt Date: Mon Nov 24 21:31:08 2014 New Revision: 274984 URL: https://svnweb.freebsd.org/changeset/base/274984 Log: Implement LIBADD LIBADD will automatically set DPADD and LDADD when needed including their dependencies, LIBADD automatically handles private and internal libs so that the end user Makefile does not have to care about it. This allows to reduce overlinking on the base system leaving the framework get the dependencies properly. It also allows to built components binaries statically. To use it: Replace: DPADD= ${LIBARCHIVE} ${LIBSSL} LDADD= -larchive -lssl by: LIBADD= archive ssl Differential Revision: https://reviews.freebsd.org/D1209 Reviewed by: brooks imp Modified: head/share/mk/src.libnames.mk Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Mon Nov 24 20:57:20 2014 (r274983) +++ head/share/mk/src.libnames.mk Mon Nov 24 21:31:08 2014 (r274984) @@ -7,7 +7,182 @@ .error src.libnames.mk cannot be included directly. .endif -ROOTOBJDIR= ${.OBJDIR:S/${.CURDIR}//}${.MAKE.MAKEFILES:M*/src.libnames.mk:H:H:H} +.include + +ROOTSRCDIR= ${.MAKE.MAKEFILES:M*/src.libnames.mk:H:H:H} +ROOTOBJDIR= ${.OBJDIR:S/${.CURDIR}//}${ROOTSRCDIR} +_PRIVATELIBS= \ + atf_c \ + atf_cxx \ + bsdstat \ + ldns \ + sqlite3 \ + ssh \ + ucl \ + unbound +_INTERNALIBS= \ + libmandoc \ + ohash \ + readline \ + sm + +_LIBRARIES= \ + archive \ + atf_c \ + atf_cxx \ + bsdxml \ + bsnmp \ + bz2 \ + cam \ + capsicum \ + casper \ + cft \ + crypt \ + crypto \ + cuse \ + cxxrt \ + devstat \ + dialog \ + dpv \ + dwarf \ + edit \ + elf \ + event \ + execinfo \ + fetch \ + figpar \ + geom \ + gssapi \ + ipsec \ + jail \ + kiconv \ + kvm \ + l \ + ldns \ + lzma \ + m \ + magic \ + mandoc \ + md \ + memstat \ + mp \ + nandfs \ + ncursesw \ + nv \ + opie \ + pam \ + pcap \ + pjdlog \ + proc \ + procstat \ + pthread \ + radius \ + readline \ + rpcsec_gss \ + rt \ + sbuf \ + sm \ + smb \ + ssh \ + ssl \ + stdthreads \ + supcplusplus \ + tacplus \ + termcapw \ + ucl \ + ufs \ + ulog \ + usb \ + util \ + wrap \ + y \ + z + +_DP_archive= z bz2 lzma bsdxml +.if ${MK_OPENSSL} != "no" +_DP_archive+= crypto +.else +_DP_archive+= md +.endif +_DP_ssl= crypto +_DP_ssh= crypto crypt +_DP_edit= edit +.if ${MK_OPENSSL} != "no" +_DP_bsnmp= crypto +.endif +_DP_grom= bsdxml sbuf +_DP_cam= sbuf +_DP_casper= capsicum nv pjdlog +_DP_capsicum= nv +_DP_pjdlog= util +_DP_opie= md +_DP_usb= pthread +_DP_unbound= pthread +_DP_rt= pthread +.if ${MK_OPENSSL} == "no" +_DP_radius= md +.else +_DP_radius= crypto +.endif +_DP_procstat= kvm util elf +.if ${MK_CXX} == "yes" +.if ${MK_LIBCPLUSPLUS} != "no" +_DP_proc= cxxrt +.else +_DP_proc= supcplusplus +.endif +.endif +.if ${MK_CDDL} != "no" +_DP_proc+= cft +.endif +_DP_mp= crypto +_DP_memstat= kvm +_DP_magic= z +_DP_ldns= crypto +.if ${MK_OPENSSL} != "no" +_DP_fetch= ssl crypto +.else +_DP_fetch= md +.endif +_DP_execinfo= elf +_DP_dwarf= elf +_DP_dpv= dialog figpar util +_DP_dialog= ncursesw m +_DP_cuse= pthread +_DP_atf_cxx= atf_c +_DP_devstat= kvm + +# Define spacial cases +LDADD_supcplusplus= -lsupc++ + +.for _l in ${_LIBRARIES} +.if ${_PRIVATELIBS:M${_l}} +LDADD+= -L${LIB${_l:tu}DIR} +.endif +.if ${_INTERNALIBS:M${_l}} +LDADD+= -L${LIB${_l:tu}DIR} +.endif +DPADD_${_l}?= ${LIB${_l:tu}} +LDADD_${_l}?= -l${_l} +.if defined(${_l}_depend) && defined(NO_SHARED) +.for _d in ${_DP_${_l}} +DPADD_${_l}+= ${DPADD_${_d}} +LDADD_${_l}+= ${LDADD_${_d}} +.endfor +.endif +.endfor + +# ucl needs and exposes libm +DPADD_ucl+= ${DPADD_m} +LDADD_ucl+= ${LDADD_m} + +.for _l in ${LIBADD} +.if ${_PRIVATELIBS:M${_l}} +USEPRIVATELIB+= ${_l} +.endif +DPADD+= ${DPADD_${_l}} +LDADD+= ${LDADD_${_l}} +.endfor LIBATF_CDIR= ${ROOTOBJDIR}/lib/atf/libatf-c LDATF_C?= ${LIBATF_CDIR}/libatf-c.so @@ -22,7 +197,7 @@ LDBSDSTAT?= ${LIBBSDSTATDIR}/libbsdstat. LIBBSDSTAT?= ${LIBBSDSTATDIR}/libbsdstat.a LIBEVENTDIR= ${ROOTOBJDIR}/lib/libevent -LDEVENT?= ${LIBEVENTDIR}/libevent.so +LDEVENT?= ${LIBEVENTDIR}/libevent.a LIBEVENT?= ${LIBEVENTDIR}/libevent.a LIBHEIMIPCCDIR= ${ROOTOBJDIR}/kerberos5/lib/libheimipcc @@ -64,3 +239,7 @@ LIBSQLITE3?= ${LIBSQLITE3DIR}/libsqlite3 LIBMANDOCDIR= ${ROOTOBJDIR}/lib/libmandoc LDMANDOC?= ${LIBMANDOCDIR}/libmandoc.a LIBMANDOC?= ${LIBMANDOCDIR}/libmandoc.a + +LIBSMDIR= ${ROOTOBJDIR}/lib/libsm +LDSM?= ${LIBSMDIR}/libsm.a +LIBSM?= ${LIBSMDIR}/libsm.a