diff mbox series

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

Message ID 20241113074931.2730415-1-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>
---
 libsepol/Makefile         | 27 +++++----------------------
 libsepol/include/Makefile |  2 +-
 libsepol/man/Makefile     |  2 +-
 3 files changed, 7 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/libsepol/Makefile b/libsepol/Makefile
index 5b5d03e2..e354d3cb 100644
--- a/libsepol/Makefile
+++ b/libsepol/Makefile
@@ -1,29 +1,12 @@ 
+SUBDIRS = include src utils man
 DISABLE_CIL ?= n
 
 export DISABLE_CIL
 
-all: 
-	$(MAKE) -C src 
-	$(MAKE) -C utils
-
-install: 
-	$(MAKE) -C include install
-	$(MAKE) -C src install
-	$(MAKE) -C utils install
-	$(MAKE) -C man install
-
-relabel:
-	$(MAKE) -C src relabel
-
-clean:
-	$(MAKE) -C src clean
-	$(MAKE) -C utils clean
-	$(MAKE) -C tests clean
-
-indent:
-	$(MAKE) -C src $@
-	$(MAKE) -C include $@
-	$(MAKE) -C utils $@
+all install relabel clean indent:
+	@for subdir in $(SUBDIRS); do \
+		(cd $$subdir && $(MAKE) $@) || exit 1; \
+	done
 
 test:
 	$(MAKE) -C tests test
diff --git a/libsepol/include/Makefile b/libsepol/include/Makefile
index 1ad4ecab..8d64e846 100644
--- a/libsepol/include/Makefile
+++ b/libsepol/include/Makefile
@@ -3,7 +3,7 @@  PREFIX ?= /usr
 INCDIR = $(PREFIX)/include/sepol
 CILDIR ?= ../cil
 
-all:
+all relabel clean:
 
 install: all
 	test -d $(DESTDIR)$(INCDIR) || install -m 755 -d $(DESTDIR)$(INCDIR)
diff --git a/libsepol/man/Makefile b/libsepol/man/Makefile
index 0b410c19..6017ff51 100644
--- a/libsepol/man/Makefile
+++ b/libsepol/man/Makefile
@@ -7,7 +7,7 @@  MAN8SUBDIR ?= man8
 MAN3DIR ?= $(MANDIR)/$(MAN3SUBDIR)
 MAN8DIR ?= $(MANDIR)/$(MAN8SUBDIR)
 
-all:
+all relabel clean indent:
 
 install: all
 	mkdir -p $(DESTDIR)$(MAN3DIR)