Add support for static-only build Instead of unconditionally building shared libraries, this patch improves the libsepol build system with a "STATIC" variable, which when defined to some non-empty value, will disable the build of shared libraries. It allows to support cases where the target architecture does not have support for shared libraries. Signed-off-by: Thomas Petazzoni Signed-off-by: Adam Duskett Index: b/src/Makefile =================================================================== diff --git a/src/Makefile b/src/Makefile index db6c2ba..0006285 100644 --- a/src/Makefile +++ b/src/Makefile @@ -30,8 +30,12 @@ LOBJS += $(sort $(patsubst %.c,%.lo,$(wildcard $(CILDIR)/src/*.c) $(CIL_GENERATE override CFLAGS += -I$(CILDIR)/include endif +ALL_TARGETS = $(LIBA) $(LIBPC) +ifeq ($(STATIC),) +ALL_TARGETS += $(LIBSO) +endif -all: $(LIBA) $(LIBSO) $(LIBPC) +all: $(ALL_TARGETS) $(LIBA): $(OBJS) @@ -66,11 +70,13 @@ install: all test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) install -m 644 $(LIBA) $(LIBDIR) - test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) - install -m 755 $(LIBSO) $(SHLIBDIR) test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig +ifeq ($(STATIC),) + test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) + install -m 755 $(LIBSO) $(SHLIBDIR) ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) +endif relabel: /sbin/restorecon $(SHLIBDIR)/$(LIBSO)