On Thu, 2011-09-15 at 21:12 +0200, Guido Trentalancia wrote: > I did hit other issues too. Lesson learned was: add -lbz2 -lustr to > LDLIBS in policycoreutils/{semodule,setsebool}/Makefile and replace = > with ?= in checkpolicy/test/Makefile > > Unfortunately none of the above is exactly what I am looking for... > > I am looking to install directly under the root live filesystem. So > DESTDIR is not going to be used in my specific case. And I need > LIBDIR=SHLIBDIR=/usr/lib64. Also, I'd like to first type "make" to build > only and then type "make install" to get things installed. > > rm -rf /usr/include/selinux/ ; rm -rf /usr/include/semanage/ ; rm > -rf /usr/include/sepol/ ; rm -f /usr/lib64/libsepol.* ; rm > -f /usr/lib64/libsemanage.* ; CFLAGS="-O3 -march=corei7 -mtune=corei7" > LIBDIR=/usr/lib64 SHLIBDIR=/usr/lib64 make install > > Works with "install" target only with latest git. So it is not possible > to build only first and then install. Yes, if you want that, you'll need further changes. But rather than changing the component Makefiles in a manner that won't work for separate builds, how about defining some top-level variables and using them throughout, with conditional definitions (?=) within the individual Makefiles so that the separate builds still work. Like the following (incomplete, but gives the idea): diff --git a/Makefile b/Makefile index 09c2c1e..f68a2b2 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,10 @@ ifeq ($(DEBUG),1) export LDFLAGS = -g endif +export LIBSEPOLSTATIC=$(CURDIR)/libsepol/src/libsepol.a +export EXTRA_INCLUDES=-I$(CURDIR)/libsepol/include -I$(CURDIR)/libselinux/include -I$(CURDIR)/libsemanage/include +export EXTRA_LIBS=-L$(CURDIR)/libsepol/src -L$(CURDIR)/libselinux/src -L$(CURDIR)/libsemanage/src + all install relabel clean test indent: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) $@) || exit 1; \ diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile index 7680008..4651616 100644 --- a/libselinux/src/Makefile +++ b/libselinux/src/Makefile @@ -7,7 +7,8 @@ PYPREFIX ?= $(notdir $(PYTHON)) # Installation directories. PREFIX ?= $(DESTDIR)/usr LIBDIR ?= $(PREFIX)/lib -SHLIBDIR ?= $(PREFIX)/lib +LIBSEPOLSTATIC ?= $(LIBDIR)/libsepol.a +SHLIBDIR ?= $(DESTDIR)/lib INCLUDEDIR ?= $(PREFIX)/include PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])') PYINC ?= $(shell pkg-config --cflags $(PYPREFIX)) @@ -54,7 +55,7 @@ SRCS= $(filter-out $(UNUSED_SRCS) $(GENERATED) audit2why.c, $(wildcard *.c)) OBJS= $(patsubst %.c,%.o,$(SRCS)) LOBJS= $(patsubst %.c,%.lo,$(SRCS)) CFLAGS ?= -Werror -Wall -W -Wundef -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS) +override CFLAGS += -I../include -I$(INCLUDEDIR) $(EXTRA_INCLUDES) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS) RANLIB=ranlib ARCH := $(patsubst i%86,i386,$(shell uname -m)) @@ -102,7 +103,7 @@ $(AUDIT2WHYLOBJ): audit2why.c $(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $< $(AUDIT2WHYSO): $(AUDIT2WHYLOBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux ${LIBDIR}/libsepol.a -L$(LIBDIR) -Wl,-soname,$@ + $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux $(LIBSEPOLSTATIC) -L$(LIBDIR) -Wl,-soname,$@ %.o: %.c policy.h $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $< diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile index d9120c0..44962e6 100644 --- a/libsemanage/src/Makefile +++ b/libsemanage/src/Makefile @@ -55,7 +55,7 @@ OBJS= $(patsubst %.c,%.o,$(SRCS)) conf-scan.o conf-parse.o LOBJS= $(patsubst %.c,%.lo,$(SRCS)) conf-scan.lo conf-parse.lo CFLAGS ?= -Werror -Wall -W -Wundef -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE +override CFLAGS += -I../include -I$(INCLUDEDIR) $(EXTRA_INCLUDES) -D_GNU_SOURCE RANLIB=ranlib SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ @@ -87,7 +87,7 @@ $(LIBA): $(OBJS) $(RANLIB) $@ $(LIBSO): $(LOBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -lselinux -lbz2 -lustr -L$(LIBDIR) -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs + $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -lselinux -lbz2 -lustr $(EXTRA_LIBS) -L$(LIBDIR) -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in -- Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with the words "unsubscribe selinux" without quotes as the message.