diff mbox

[3/7] libselinux: PCRE_LDFLAGS is actually LDLIBS

Message ID 20170424175959.20998-3-jason@perfinion.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Jason Zaman April 24, 2017, 5:59 p.m. UTC
From Make's manual:

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the
linker, ‘ld’, such as -L. Libraries (-lfoo) should be added to the
LDLIBS variable instead.

LDLIBS
Library flags or names given to compilers when they are supposed to
invoke the linker, ‘ld’. Non-library linker flags, such as -L, should go
in the LDFLAGS variable.

https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

Signed-off-by: Jason Zaman <jason@perfinion.com>
---
 libselinux/Makefile       | 6 +++---
 libselinux/src/Makefile   | 6 +++---
 libselinux/utils/Makefile | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/libselinux/Makefile b/libselinux/Makefile
index 98776d2..1ecab17 100644
--- a/libselinux/Makefile
+++ b/libselinux/Makefile
@@ -22,12 +22,12 @@  export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST
 USE_PCRE2 ?= n
 ifeq ($(USE_PCRE2),y)
 	PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 $(shell $(PKG_CONFIG) --cflags libpcre2-8)
-	PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre2-8)
+	PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre2-8)
 else
 	PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre)
-	PCRE_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpcre)
+	PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre)
 endif
-export PCRE_CFLAGS PCRE_LDFLAGS
+export PCRE_CFLAGS PCRE_LDLIBS
 
 OS := $(shell uname)
 export OS
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index a277b87..c685e66 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -91,7 +91,7 @@  override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
 LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
-PCRE_LDFLAGS ?= -lpcre
+PCRE_LDLIBS ?= -lpcre
 
 override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
 
@@ -143,8 +143,8 @@  $(LIBA): $(OBJS)
 	$(RANLIB) $@
 
 $(LIBSO): $(LOBJS)
-	$(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS)
-	ln -sf $@ $(TARGET) 
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(PCRE_LDLIBS) -ldl -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS)
+	ln -sf $@ $(TARGET)
 
 $(LIBPC): $(LIBPC).in ../VERSION
 	sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
diff --git a/libselinux/utils/Makefile b/libselinux/utils/Makefile
index 954da45..68f7097 100644
--- a/libselinux/utils/Makefile
+++ b/libselinux/utils/Makefile
@@ -46,7 +46,7 @@  endif
 
 override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
 LDLIBS += -L../src -lselinux -L$(LIBDIR)
-PCRE_LDFLAGS ?= -lpcre
+PCRE_LDLIBS ?= -lpcre
 
 ifeq ($(ANDROID_HOST),y)
 TARGETS=sefcontext_compile
@@ -54,7 +54,7 @@  else
 TARGETS=$(patsubst %.c,%,$(wildcard *.c))
 endif
 
-sefcontext_compile: LDLIBS += $(PCRE_LDFLAGS) ../src/libselinux.a -lsepol
+sefcontext_compile: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a -lsepol
 
 sefcontext_compile: sefcontext_compile.o ../src/regex.o