mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-24 23:12:05 +00:00
Makefiles: override *FLAGS and *LIBS
There were several places in the makefiles where LDLIBS or CFLAGS were supposed to include options to build. They were missing the override keyword so would be skipped if these vars were set on the make cmdline. Add the override directive to fix this. Signed-off-by: Jason Zaman <jason@perfinion.com>
This commit is contained in:
parent
34dc7bcc31
commit
15f2740733
@ -4,24 +4,19 @@ LIBDIR ?= $(PREFIX)/lib
|
||||
# Add your test source files here:
|
||||
SOURCES = $(sort $(wildcard *.c))
|
||||
|
||||
# Add the required external object files here:
|
||||
LIBS = ../src/libsemanage.a -lselinux -lsepol
|
||||
|
||||
###########################################################################
|
||||
|
||||
EXECUTABLE = libsemanage-tests
|
||||
CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
|
||||
INCLUDE = -I../src -I../include
|
||||
LDLIBS += -lcunit -lbz2 -laudit
|
||||
override CFLAGS += -I../src -I../include
|
||||
override LDLIBS += -lcunit -lbz2 -laudit ../src/libsemanage.a -lselinux -lsepol
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
all: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS) ../src/libsemanage.a
|
||||
$(CC) $(OBJECTS) $(LIBS) $(LDFLAGS) -o $@ $(LDLIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -c $*.c -o $*.o
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@ $(LDLIBS)
|
||||
|
||||
clean distclean:
|
||||
rm -rf $(OBJECTS) $(EXECUTABLE)
|
||||
|
@ -5,7 +5,7 @@ BINDIR ?= $(PREFIX)/bin
|
||||
CFLAGS ?= -Wall -Werror
|
||||
override CFLAGS += -I../include
|
||||
override LDFLAGS += -L../src
|
||||
LDLIBS += -lsepol
|
||||
override LDLIBS += -lsepol
|
||||
|
||||
TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
|
||||
|
||||
|
@ -6,7 +6,7 @@ LIBSEPOLA ?= $(LIBDIR)/libsepol.a
|
||||
|
||||
CFLAGS ?= -Wall
|
||||
override CFLAGS += -I../src -D_GNU_SOURCE
|
||||
LDLIBS += -lselinux -lpcre
|
||||
override LDLIBS += -lselinux -lpcre
|
||||
|
||||
TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
|
||||
|
||||
|
@ -8,7 +8,7 @@ LIBEXECDIR ?= $(PREFIX)/libexec
|
||||
HLLDIR ?= $(LIBEXECDIR)/selinux/hll
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
LDLIBS = -lsepol
|
||||
override LDLIBS += -lsepol
|
||||
|
||||
PP_SRCS = $(sort $(wildcard *.c))
|
||||
PP_OBJS = $(patsubst %.c,%.o,$(PP_SRCS))
|
||||
|
@ -7,7 +7,7 @@ LOCALEDIR ?= /usr/share/locale
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
override CFLAGS += $(LDFLAGS) -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
|
||||
LDLIBS += -lsepol -lselinux
|
||||
override LDLIBS += -lsepol -lselinux
|
||||
|
||||
TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
|
||||
|
||||
|
@ -23,18 +23,18 @@ VERSION = $(shell cat ../VERSION)
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
EXTRA_OBJS =
|
||||
override CFLAGS += -DVERSION=\"$(VERSION)\" -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
|
||||
LDLIBS += -lselinux
|
||||
override LDLIBS += -lselinux
|
||||
ifeq ($(PAMH), y)
|
||||
override CFLAGS += -DUSE_PAM
|
||||
EXTRA_OBJS += hashtab.o
|
||||
LDLIBS += -lpam -lpam_misc
|
||||
override LDLIBS += -lpam -lpam_misc
|
||||
else
|
||||
override CFLAGS += -D_XOPEN_SOURCE=500
|
||||
LDLIBS += -lcrypt
|
||||
override LDLIBS += -lcrypt
|
||||
endif
|
||||
ifeq ($(AUDITH), y)
|
||||
override CFLAGS += -DUSE_AUDIT
|
||||
LDLIBS += -laudit
|
||||
override LDLIBS += -laudit
|
||||
endif
|
||||
ifeq ($(LSPP_PRIV),y)
|
||||
override AUDIT_LOG_PRIV=y
|
||||
@ -50,7 +50,7 @@ ifeq ($(NAMESPACE_PRIV),y)
|
||||
endif
|
||||
ifeq ($(IS_SUID),y)
|
||||
MODE := 4555
|
||||
LDLIBS += -lcap-ng
|
||||
override LDLIBS += -lcap-ng
|
||||
else
|
||||
MODE := 0555
|
||||
endif
|
||||
|
@ -10,17 +10,17 @@ AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
override CFLAGS += -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
|
||||
LDLIBS += -lselinux
|
||||
override LDLIBS += -lselinux
|
||||
ifeq ($(PAMH), y)
|
||||
override CFLAGS += -DUSE_PAM
|
||||
LDLIBS += -lpam -lpam_misc
|
||||
override LDLIBS += -lpam -lpam_misc
|
||||
else
|
||||
override CFLAGS += -D_XOPEN_SOURCE=500
|
||||
LDLIBS += -lcrypt
|
||||
override LDLIBS += -lcrypt
|
||||
endif
|
||||
ifeq ($(AUDITH), y)
|
||||
override CFLAGS += -DUSE_AUDIT
|
||||
LDLIBS += -laudit
|
||||
override LDLIBS += -laudit
|
||||
endif
|
||||
|
||||
TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
|
||||
|
@ -9,7 +9,7 @@ WARNS=-Werror -W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wca
|
||||
VERSION = $(shell cat ../VERSION)
|
||||
CFLAGS ?= $(WARNS) -O1
|
||||
override CFLAGS += -DVERSION=\"$(VERSION)\"
|
||||
LDLIBS = -lselinux
|
||||
override LDLIBS += -lselinux
|
||||
|
||||
all: secon
|
||||
|
||||
|
@ -6,13 +6,12 @@ MANDIR = $(PREFIX)/share/man
|
||||
LIBDIR ?= $(PREFIX)/lib
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
LDLIBS = -lsepol -lselinux -lsemanage
|
||||
override LDLIBS += -lsepol -lselinux -lsemanage
|
||||
SEMODULE_OBJS = semodule.o
|
||||
|
||||
all: semodule genhomedircon
|
||||
|
||||
semodule: $(SEMODULE_OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||
|
||||
genhomedircon:
|
||||
ln -sf semodule genhomedircon
|
||||
|
@ -7,11 +7,11 @@ LIBDIR ?= $(PREFIX)/lib
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
override CFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
LDLIBS = -lselinux
|
||||
override LDLIBS += -lselinux
|
||||
|
||||
all: sestatus
|
||||
|
||||
sestatus: sestatus.o
|
||||
sestatus: sestatus.o
|
||||
|
||||
install: all
|
||||
[ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8
|
||||
@ -24,7 +24,7 @@ install: all
|
||||
install -m 644 sestatus.conf $(ETCDIR)
|
||||
|
||||
clean:
|
||||
rm -f sestatus *.o
|
||||
rm -f sestatus *.o
|
||||
|
||||
indent:
|
||||
../../scripts/Lindent $(wildcard *.[ch])
|
||||
|
@ -8,21 +8,21 @@ AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
|
||||
ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }')
|
||||
|
||||
CFLAGS ?= -g -Werror -Wall -W
|
||||
LDLIBS = -lselinux -lsepol
|
||||
override LDLIBS += -lselinux -lsepol
|
||||
|
||||
ifeq ($(AUDITH), y)
|
||||
override CFLAGS += -DUSE_AUDIT
|
||||
LDLIBS += -laudit
|
||||
override LDLIBS += -laudit
|
||||
endif
|
||||
|
||||
all: setfiles restorecon restorecon_xattr man
|
||||
|
||||
setfiles: setfiles.o restore.o
|
||||
setfiles: setfiles.o restore.o
|
||||
|
||||
restorecon: setfiles
|
||||
ln -sf setfiles restorecon
|
||||
|
||||
restorecon_xattr: restorecon_xattr.o restore.o
|
||||
restorecon_xattr: restorecon_xattr.o restore.o
|
||||
|
||||
man:
|
||||
@cp -af setfiles.8 setfiles.8.man
|
||||
|
@ -7,7 +7,7 @@ LIBDIR ?= $(PREFIX)/lib
|
||||
BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
LDLIBS = -lsepol -lselinux -lsemanage
|
||||
override LDLIBS += -lsepol -lselinux -lsemanage
|
||||
SETSEBOOL_OBJS = setsebool.o
|
||||
|
||||
BASHCOMPLETIONS=setsebool-bash-completion.sh
|
||||
|
@ -29,7 +29,7 @@ else
|
||||
endif
|
||||
export PCRE_CFLAGS PCRE_LDLIBS
|
||||
|
||||
LDLIBS += -lselinux $(PCRE_LDLIBS) $(DBUSLIB)
|
||||
override LDLIBS += -lselinux $(PCRE_LDLIBS) $(DBUSLIB)
|
||||
|
||||
all: restorecond
|
||||
|
||||
|
@ -10,7 +10,7 @@ MANDIR ?= $(PREFIX)/share/man
|
||||
LOCALEDIR ?= /usr/share/locale
|
||||
SHAREDIR ?= $(PREFIX)/share/sandbox
|
||||
override CFLAGS += -DPACKAGE="\"policycoreutils\"" -Wall -Werror -Wextra -W
|
||||
LDLIBS += -lselinux -lcap-ng
|
||||
override LDLIBS += -lselinux -lcap-ng
|
||||
SEUNSHARE_OBJS = seunshare.o
|
||||
|
||||
all: sandbox seunshare sandboxX.sh start
|
||||
|
@ -4,8 +4,6 @@ MANDIR ?= $(PREFIX)/share/man
|
||||
LIBDIR ?= $(PREFIX)/lib
|
||||
INCLUDEDIR ?= $(PREFIX)/include
|
||||
|
||||
LDLIBS = -lsepol
|
||||
|
||||
SECILC = secilc
|
||||
SECILC_SRCS := secilc.c
|
||||
SECILC_OBJS := $(patsubst %.c,%.o,$(SECILC_SRCS))
|
||||
@ -21,6 +19,7 @@ XMLTO = xmlto
|
||||
CFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wunused
|
||||
|
||||
override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
override LDLIBS += -lsepol
|
||||
|
||||
all: $(SECILC) $(SECIL2CONF) man
|
||||
|
||||
|
@ -6,7 +6,7 @@ LIBDIR ?= $(PREFIX)/lib
|
||||
MANDIR ?= $(PREFIX)/share/man
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
LDLIBS = -lsepol
|
||||
override LDLIBS += -lsepol
|
||||
|
||||
all: semodule_expand
|
||||
|
||||
|
@ -6,7 +6,7 @@ MANDIR ?= $(PREFIX)/share/man
|
||||
LIBDIR ?= $(PREFIX)/lib
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
LDLIBS = -lsepol
|
||||
override LDLIBS += -lsepol
|
||||
|
||||
all: semodule_link
|
||||
|
||||
|
@ -6,7 +6,7 @@ LIBDIR ?= $(PREFIX)/lib
|
||||
MANDIR ?= $(PREFIX)/share/man
|
||||
|
||||
CFLAGS ?= -Werror -Wall -W
|
||||
LDLIBS = -lsepol
|
||||
override LDLIBS += -lsepol
|
||||
|
||||
all: semodule_package semodule_unpackage
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user