diff mbox series

[v1,2/2] libsemanage: allow specifying SUBDIRS when building

Message ID 20241113074931.2730415-2-dmitry.sharshakov@siderolabs.com (mailing list archive)
State New
Delegated to: Petr Lautrbach
Headers show
Series [v1,1/2] libsepol: allow specifying SUBDIRS when building | expand

Commit Message

dmitry.sharshakov@siderolabs.com Nov. 13, 2024, 7:49 a.m. UTC
From: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>

Allow building without utils and man for minimalist builds which do not need those.

Also make the Makefile modular as in libselinux.

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
---
 libsemanage/Makefile         | 25 ++++++-------------------
 libsemanage/include/Makefile |  2 +-
 libsemanage/man/Makefile     |  2 +-
 3 files changed, 8 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/libsemanage/Makefile b/libsemanage/Makefile
index 390176fe..66c45c5a 100644
--- a/libsemanage/Makefile
+++ b/libsemanage/Makefile
@@ -1,5 +1,9 @@ 
-all: 
-	$(MAKE) -C src all
+SUBDIRS = include src utils man
+
+all install relabel clean distclean indent:
+	@for subdir in $(SUBDIRS); do \
+		(cd $$subdir && $(MAKE) $@) || exit 1; \
+	done
 
 swigify:
 	$(MAKE) -C src swigify
@@ -10,28 +14,11 @@  pywrap:
 rubywrap:
 	$(MAKE) -C src rubywrap
 
-install: 
-	$(MAKE) -C include install
-	$(MAKE) -C src install
-	$(MAKE) -C man install
-	$(MAKE) -C utils install
-
 install-pywrap: 
 	$(MAKE) -C src install-pywrap
 
 install-rubywrap:
 	$(MAKE) -C src install-rubywrap
 
-relabel:
-	$(MAKE) -C src relabel
-
-clean distclean:
-	$(MAKE) -C src $@
-	$(MAKE) -C tests $@
-
-indent:
-	$(MAKE) -C src $@
-	$(MAKE) -C include $@
-
 test: all
 	$(MAKE) -C tests test
diff --git a/libsemanage/include/Makefile b/libsemanage/include/Makefile
index 6e44a28a..c08aafec 100644
--- a/libsemanage/include/Makefile
+++ b/libsemanage/include/Makefile
@@ -2,7 +2,7 @@ 
 PREFIX ?= /usr
 INCDIR ?= $(PREFIX)/include/semanage
 
-all:
+all relabel clean distclean:
 
 install: all
 	test -d $(DESTDIR)$(INCDIR) || install -m 755 -d $(DESTDIR)$(INCDIR)
diff --git a/libsemanage/man/Makefile b/libsemanage/man/Makefile
index 5e21a65e..88143db8 100644
--- a/libsemanage/man/Makefile
+++ b/libsemanage/man/Makefile
@@ -7,7 +7,7 @@  MAN5SUBDIR ?= man5
 MAN3DIR ?= $(MANDIR)/$(MAN3SUBDIR)
 MAN5DIR ?= $(MANDIR)/$(MAN5SUBDIR)
 
-all:
+all relabel clean distclean indent:
 
 install: all
 	mkdir -p $(DESTDIR)$(MAN3DIR)