Skip to contentSkip to conversation

share/mk/: Reduce the work of 'make && make install'

PATCH New Alejandro Colomar 1 participant 1 message Jul 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 share/mk/: Reduce the work of 'make && make install'

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.

---

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(-)
share/mk/build/_.mk +7 -2
index ea16d4dfc..d1fecf6d9 100644
@@ -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
share/mk/build/lib/_.mk +1 -1
index 8b3c439a9..2320279e0 100644
@@ -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
share/mk/build/lib/shared.mk +10 -1
index 8132f9e8b..d4387ba6c 100644
@@ -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
share/mk/install/_.mk +4 -1
index 15a030361..f54b05a2d 100644
@@ -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

Signature · 1 line
2.45.2