Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4D9A1B86FB for ; Thu, 18 Jul 2024 10:30:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721298633; cv=none; b=iPRWyRZHhCIBINm7KURjfIZ78EM2l431LXl9qNoQkKi7nxbck7oR7KbhPt5QJIN/2VYSLJUcOzg0anuDdOMjIptzqBlTHL8CuWbkGDn1SzoXeJxWq4+TTtveoa/JKXmbN33vPlFoiJx30qURNroXrjQahurNV2IJAYoJfLhkOZ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721298633; c=relaxed/simple; bh=2G9sGtNZFUoGRHZp8ySfzfrFHDN5R/+M2GFcngBZdns=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=gIjeT27N1/YeqBhm0okFFtysZnRRcvr0+kIERatgQVtszWxhefld57F+VunU0qXV9/R6jQxcxyr8/g0PI/0jUTnswkSDN66IzfZe5lWLoPm5MB3Bp9ubtLZhu9Gvoec1IZH+k1SSYmYMzMUMfEPxcKqMRob79tFlAORKbmGJeSc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uH+ePlzU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uH+ePlzU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8056CC116B1; Thu, 18 Jul 2024 10:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721298631; bh=2G9sGtNZFUoGRHZp8ySfzfrFHDN5R/+M2GFcngBZdns=; h=Date:From:To:Cc:Subject:From; b=uH+ePlzUjomfq/XdNaqNuxHYOfnTUMpPnXLK/70YGlI0UW+c+G6yBlhW7CWSCVDO5 EN4Bao15mZw7Y8mo8gMRvdTTba7MEfTPdLF1zmiiTjlMyShXfRi60HZf3f9kwe2y8Z W9wOUk30EnAMaSEZh7wcPkndrrkRdBxDx3KYS3LRGMwiDXF4dJ19MxnWMlNuldOS1A xt+bCcVCt8avPL30pvPsBBpmAYdfUlZGXeYI4uNXLSujcJ3Tw+kiwvS9kmKff8qKg1 cPwsY8h9qgmjJHb6ysdukSDf85gWWvhBpo7icTtUOb1PQqroJmborqkpuoX41fQkpS h1h8a7Ns2J6Vw== Date: Thu, 18 Jul 2024 12:30:28 +0200 From: Alejandro Colomar To: liba2i@lists.linux.dev Cc: Alejandro Colomar , Sam James Subject: [PATCH v1] share/mk/: Reduce the work of 'make && make install' Message-ID: <20240718102635.13399-2-alx@kernel.org> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: liba2i@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cq5ceeifqhx4gijc" Content-Disposition: inline --cq5ceeifqhx4gijc Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable From: Alejandro Colomar To: liba2i@lists.linux.dev Cc: Alejandro Colomar , Sam James Subject: [PATCH v1] share/mk/: Reduce the work of 'make && make install' MIME-Version: 1.0 Distros expect 'make' to build only what they need. While we want to build more stuff upstream, for various reasons (mainly, for extra diagnostics), packagers only want what they'll use, and don't want to waste CPU time with that. Also, distros expect 'make install' to only install what they'll use, which is just the headers, the pc(5) file, the shared library, and the manual pages. They usually don't want a static library. For that, repurpose the build and install targets to do precisely that, and add build-all and install-all targets that do all that can be done. Reported-by: Sam James Signed-off-by: Alejandro Colomar --- Hi Sam, I'll apply this patch, which is what I think you want. With this, and except for environment variables being ignored (the next release of GNU make(1) that contains the bugfix I need for solving this), I think this should build as any build system would expect. (Hopefully I won't be missing any other details. As always, I'm sorry if that happens.) alx@debian:~/src/alx/liba2i/contrib$ make clean RM -rf .tmp alx@debian:~/src/alx/liba2i/contrib$ make MKDIR .tmp/a2i/a2i/ MKDIR .tmp/a2i/str2i/ MKDIR .tmp/a2i/strtoi/strtoi/ MKDIR .tmp/a2i/strtoi/strtou/ MKDIR .tmp/a2i/strtoi/strtou_noneg/ SED .tmp/liba2i-uninstalled.pc LD .tmp/liba2i.so.1.0-rc3-2-gbacec0a1b LN .tmp/liba2i.so.1 LN .tmp/liba2i.so alx@debian:~/src/alx/liba2i/contrib$ make install DESTDIR=3D/tmp/asdf MKDIR /tmp/asdf/usr/local/include/a2i/a2i/ INSTALL /tmp/asdf/usr/local/include/a2i/a2i/a2i.h INSTALL /tmp/asdf/usr/local/include/a2i/a2i/a2s.h INSTALL /tmp/asdf/usr/local/include/a2i/a2i/a2s_.h INSTALL /tmp/asdf/usr/local/include/a2i/a2i/a2u.h INSTALL /tmp/asdf/usr/local/include/a2i/a2i/a2u_.h INSTALL /tmp/asdf/usr/local/include/a2i/attr.h INSTALL /tmp/asdf/usr/local/include/a2i/inline.h INSTALL /tmp/asdf/usr/local/include/a2i/qual.h MKDIR /tmp/asdf/usr/local/include/a2i/str2i/ INSTALL /tmp/asdf/usr/local/include/a2i/str2i/str2i.h INSTALL /tmp/asdf/usr/local/include/a2i/str2i/str2s.h INSTALL /tmp/asdf/usr/local/include/a2i/str2i/str2u.h MKDIR /tmp/asdf/usr/local//lib/pkgconfig/ INSTALL /tmp/asdf/usr/local//lib/pkgconfig/liba2i.pc INSTALL /tmp/asdf/usr/local//lib/liba2i.so.1.0-rc3-2-gbacec0a1b LN /tmp/asdf/usr/local//lib/liba2i.so.1 LN /tmp/asdf/usr/local//lib/liba2i.so MKDIR .tmp/man/man3/ SED .tmp/man/man3/a2i.3 MKDIR /tmp/asdf/usr/local/share/man/man3/ INSTALL /tmp/asdf/usr/local/share/man/man3/a2i.3 SED .tmp/man/man3/a2s.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2s.3 CP .tmp/man/man3/a2sh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2sh.3 CP .tmp/man/man3/a2shh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2shh.3 CP .tmp/man/man3/a2si.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2si.3 CP .tmp/man/man3/a2sl.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2sl.3 CP .tmp/man/man3/a2sll.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2sll.3 SED .tmp/man/man3/a2u.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2u.3 CP .tmp/man/man3/a2uh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2uh.3 CP .tmp/man/man3/a2uhh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2uhh.3 CP .tmp/man/man3/a2ui.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2ui.3 CP .tmp/man/man3/a2ul.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2ul.3 CP .tmp/man/man3/a2ull.3 INSTALL /tmp/asdf/usr/local/share/man/man3/a2ull.3 SED .tmp/man/man3/str2i.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2i.3 SED .tmp/man/man3/str2s.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2s.3 CP .tmp/man/man3/str2sh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2sh.3 CP .tmp/man/man3/str2shh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2shh.3 CP .tmp/man/man3/str2si.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2si.3 CP .tmp/man/man3/str2sl.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2sl.3 CP .tmp/man/man3/str2sll.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2sll.3 SED .tmp/man/man3/str2u.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2u.3 CP .tmp/man/man3/str2uh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2uh.3 CP .tmp/man/man3/str2uhh.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2uhh.3 CP .tmp/man/man3/str2ui.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2ui.3 CP .tmp/man/man3/str2ul.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2ul.3 CP .tmp/man/man3/str2ull.3 INSTALL /tmp/asdf/usr/local/share/man/man3/str2ull.3 Have a lovely day! Alex Range-diff against v0: -: --------- > 1: bacec0a1b share/mk/: Reduce the work of 'make && make i= nstall' share/mk/build/_.mk | 9 +++++++-- share/mk/build/lib/_.mk | 2 +- share/mk/build/lib/shared.mk | 11 ++++++++++- share/mk/install/_.mk | 5 ++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/share/mk/build/_.mk b/share/mk/build/_.mk index ea16d4dfc..d1fecf6d9 100644 --- a/share/mk/build/_.mk +++ b/share/mk/build/_.mk @@ -12,8 +12,8 @@ include $(MAKEFILEDIR)/configure/directory_variables/buil= d.mk _MANDIR :=3D $(builddir)/man =20 =20 -.PHONY: build -build: \ +.PHONY: build-all +build-all: \ build-catman \ build-dev \ build-html \ @@ -24,5 +24,10 @@ build: \ build-ps \ build-ex; =20 +.PHONY: build +build: \ + build-dev \ + build-lib-shared; + =20 endif # include guard diff --git a/share/mk/build/lib/_.mk b/share/mk/build/lib/_.mk index 8b3c439a9..2320279e0 100644 --- a/share/mk/build/lib/_.mk +++ b/share/mk/build/lib/_.mk @@ -7,7 +7,7 @@ MAKEFILE_BUILD_LIB_INCLUDED :=3D 1 =20 =20 .PHONY: build-lib -build-lib: build-lib-shared build-lib-static; +build-lib: build-lib-shared build-lib-shared-allO build-lib-static; =20 =20 endif # include guard diff --git a/share/mk/build/lib/shared.mk b/share/mk/build/lib/shared.mk index 8132f9e8b..d4387ba6c 100644 --- a/share/mk/build/lib/shared.mk +++ b/share/mk/build/lib/shared.mk @@ -18,12 +18,18 @@ _REALNAME :=3D $(builddir)/$(REALNAME) _SONAME :=3D $(builddir)/$(SONAME) _LINKERNAME :=3D $(builddir)/$(LINKERNAME) =20 +_REALNAME_ALLO :=3D $(_REALNAME).allO.touch =20 -$(_REALNAME): %.so.$(DISTVERSION): $(TU_h) $(TU_c) $(MK) $(LIB_pc) | $$(@D= )/ + +$(_REALNAME_ALLO): %.so.$(DISTVERSION).allO.touch: $(TU_h) $(TU_c) $(MK) $= (LIB_pc) | $$(@D)/ $(info $(INFO_)LD $@) for opt in g 0 1 2 s z 3 fast; do \ $(LD) $(LDFLAGS_) -O$$opt -o $*.O$$opt.so.$(DISTVERSION) $(TU_c) $(LDLIBS= _); \ done + + +$(_REALNAME): %.so.$(DISTVERSION): $(TU_h) $(TU_c) $(MK) $(LIB_pc) | $$(@D= )/ + $(info $(INFO_)LD $@) $(LD) $(LDFLAGS_) -o $@ $(TU_c) $(LDLIBS= _) =20 =20 @@ -40,5 +46,8 @@ $(_LINKERNAME): $(_SONAME) $(MK) | $$(@D)/ .PHONY: build-lib-shared build-lib-shared: $(_LINKERNAME); =20 +.PHONY: build-lib-shared-allO +build-lib-shared-allO: $(_REALNAME_ALLO); + =20 endif # include guard diff --git a/share/mk/install/_.mk b/share/mk/install/_.mk index 15a030361..f54b05a2d 100644 --- a/share/mk/install/_.mk +++ b/share/mk/install/_.mk @@ -19,8 +19,11 @@ include $(MAKEFILEDIR)/configure/build-depends/coreutils= /rm.mk $(RM) $* =20 =20 +.PHONY: install-all +install-all: install-dev install-lib install-man; + .PHONY: install -install: install-dev install-lib install-man; +install: install-dev install-lib-shared install-man; =20 .PHONY: uninstall uninstall: uninstall-dev uninstall-lib uninstall-man; base-commit: 92a9c89855347bc335f00eea3d4aa56c667edd6f --=20 2.45.2 --cq5ceeifqhx4gijc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmaY7sQACgkQnowa+77/ 2zK6pw//WJKEgAizsXGkECGQhXFLCgpmy5DVgV9gP8HQokMBIsRhx+pH0OYcDCF3 Qs+ekmyTTSq+fZSwG3nRr8Pp04C0lofG5z3VK/2EEs93Vfq9HpApa24/0fEcMZUT f3N3Z6HJiSJHz12Ywy9zEMC80URRUB/I22xvOAjaDjuVnRm6k689qH34ogbiIstE 7M3h93ErkMUD52d1dJLe74pioHN9ufVuQNAPYcXxxxd5o3jSqOnAu5C8/we6RMad g5GBTfUgAihW/NIWw5Ug3VPhAw5Om625vLlDV6rCYET1eSQsQm/mBc5TfSkvd7Z9 8HnLgVLoucNGY713T8pL9+reOM59GzzwecqPrxriZLrDfRthzT8RuEGFfszk6HyL DDFPiJ+5SzcnCOVSuSCikZdc5osDPxwA0JBsnyui47Eqa+DrNJpIc1mMmtC7j+Am sh9M6C5SvC9kxK2FWxLJDlZurhZ6XLIc1Sjo8OeUd3m/UXbCSNQqMAUzICIJgZEX PtVg5abX7Pb/gDJfrjvx0RZFqu/WcZoteO1FczVfrMzXz1m9t6hypx7OwXFB0mRQ YRzotAX35/fHW+jshc/sD3lOEOeWJ5ZBdaYLooPJLnvKyDBkHcYqY50glJv1skQr 4tAnYmYySfsupwZ5Dcx/9/FKfiQIm1f+JeT8nJgwa/0yRPJWxXQ= =Kr2Z -----END PGP SIGNATURE----- --cq5ceeifqhx4gijc--