public inbox for liba2i@lists.linux.dev
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: liba2i@lists.linux.dev
Cc: Alejandro Colomar <alx@kernel.org>, Sam James <sam@gentoo.org>
Subject: [PATCH v1] share/mk/: Reduce the work of 'make && make install'
Date: Thu, 18 Jul 2024 12:30:28 +0200	[thread overview]
Message-ID: <20240718102635.13399-2-alx@kernel.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 7676 bytes --]

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 <sam@gentoo.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---

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=/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 install'

 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/build.mk
 _MANDIR := $(builddir)/man
 
 
-.PHONY: build
-build: \
+.PHONY: build-all
+build-all: \
 	build-catman \
 	build-dev \
 	build-html \
@@ -24,5 +24,10 @@ build: \
 	build-ps \
 	build-ex;
 
+.PHONY: build
+build: \
+	build-dev \
+	build-lib-shared;
+
 
 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 := 1
 
 
 .PHONY: build-lib
-build-lib: build-lib-shared build-lib-static;
+build-lib: build-lib-shared build-lib-shared-allO build-lib-static;
 
 
 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   := $(builddir)/$(REALNAME)
 _SONAME     := $(builddir)/$(SONAME)
 _LINKERNAME := $(builddir)/$(LINKERNAME)
 
+_REALNAME_ALLO := $(_REALNAME).allO.touch
 
-$(_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_)
 
 
@@ -40,5 +46,8 @@ $(_LINKERNAME): $(_SONAME) $(MK) | $$(@D)/
 .PHONY: build-lib-shared
 build-lib-shared: $(_LINKERNAME);
 
+.PHONY: build-lib-shared-allO
+build-lib-shared-allO: $(_REALNAME_ALLO);
+
 
 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) $*
 
 
+.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;
 
 .PHONY: uninstall
 uninstall: uninstall-dev uninstall-lib uninstall-man;

base-commit: 92a9c89855347bc335f00eea3d4aa56c667edd6f
-- 
2.45.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

                 reply	other threads:[~2024-07-18 10:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240718102635.13399-2-alx@kernel.org \
    --to=alx@kernel.org \
    --cc=liba2i@lists.linux.dev \
    --cc=sam@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox