From 8c770b9e0538f6812f226f18151d7eb3d4c6a197 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 4 May 2018 09:53:00 -0400 Subject: [PATCH] appropriate use of LDFLAGS and LDLIBS fixes use of implicit make rules for some compilers closes #539 Change-Id: I43a74ccf8155b1eafe90eba46ce155a2a6301a89 --- daemon/Makefile | 44 +++++++++++++++++++-------------------- lib/common.Makefile | 2 +- lib/lib.Makefile | 1 + recording-daemon/Makefile | 20 +++++++++--------- t/Makefile | 18 ++++++++-------- tests/Makefile.aes | 6 +++--- 6 files changed, 46 insertions(+), 45 deletions(-) diff --git a/daemon/Makefile b/daemon/Makefile index fb8808575..6e9e24c41 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -84,33 +84,33 @@ CFLAGS+= -DRE_PLUGIN_DIR="\"/usr/lib/rtpengine\"" #CFLAGS+= -DTERMINATE_SDP_AT_BLANK_LINE #CFLAGS+= -DSTRICT_SDES_KEY_LIFETIME -LDFLAGS= -lm -LDFLAGS+= $(shell pkg-config --libs glib-2.0) -LDFLAGS+= $(shell pkg-config --libs gthread-2.0) -LDFLAGS+= $(shell pkg-config --libs zlib) -LDFLAGS+= $(shell pkg-config --libs libpcre) -LDFLAGS+= $(shell pkg-config --libs libcrypto) -LDFLAGS+= $(shell pkg-config --libs openssl) -LDFLAGS+= $(shell pkg-config --libs libevent_pthreads) -LDFLAGS+= -lpcap -LDFLAGS+= $(shell pcre-config --libs) -LDFLAGS+= $(shell pkg-config xmlrpc_client --libs 2> /dev/null || xmlrpc-c-config client --libs) -LDFLAGS+= $(shell pkg-config xmlrpc --libs 2> /dev/null) -LDFLAGS+= $(shell pkg-config xmlrpc_util --libs 2> /dev/null) -LDFLAGS+= -lhiredis -LDFLAGS+= $(shell pkg-config --libs json-glib-1.0) +LDLIBS= -lm +LDLIBS+= $(shell pkg-config --libs glib-2.0) +LDLIBS+= $(shell pkg-config --libs gthread-2.0) +LDLIBS+= $(shell pkg-config --libs zlib) +LDLIBS+= $(shell pkg-config --libs libpcre) +LDLIBS+= $(shell pkg-config --libs libcrypto) +LDLIBS+= $(shell pkg-config --libs openssl) +LDLIBS+= $(shell pkg-config --libs libevent_pthreads) +LDLIBS+= -lpcap +LDLIBS+= $(shell pcre-config --libs) +LDLIBS+= $(shell pkg-config xmlrpc_client --libs 2> /dev/null || xmlrpc-c-config client --libs) +LDLIBS+= $(shell pkg-config xmlrpc --libs 2> /dev/null) +LDLIBS+= $(shell pkg-config xmlrpc_util --libs 2> /dev/null) +LDLIBS+= -lhiredis +LDLIBS+= $(shell pkg-config --libs json-glib-1.0) ifeq ($(with_iptables_option),yes) -LDFLAGS+= $(shell pkg-config --libs libiptc) +LDLIBS+= $(shell pkg-config --libs libiptc) endif ifeq ($(with_transcoding),yes) -LDFLAGS+= $(shell pkg-config --libs libavcodec) -LDFLAGS+= $(shell pkg-config --libs libavformat) -LDFLAGS+= $(shell pkg-config --libs libavutil) -LDFLAGS+= $(shell pkg-config --libs libswresample) -LDFLAGS+= $(shell pkg-config --libs libavfilter) +LDLIBS+= $(shell pkg-config --libs libavcodec) +LDLIBS+= $(shell pkg-config --libs libavformat) +LDLIBS+= $(shell pkg-config --libs libavutil) +LDLIBS+= $(shell pkg-config --libs libswresample) +LDLIBS+= $(shell pkg-config --libs libavfilter) endif ifeq ($(have_bcg729),yes) -LDFLAGS+= $(bcg729_lib) +LDLIBS+= $(bcg729_lib) endif SRCS= main.c kernel.c poller.c aux.c control_tcp.c streambuf.c call.c control_udp.c redis.c \ diff --git a/lib/common.Makefile b/lib/common.Makefile index bb204a0f2..af4b27370 100644 --- a/lib/common.Makefile +++ b/lib/common.Makefile @@ -4,7 +4,7 @@ all: $(MAKE) $(TARGET) $(TARGET): $(OBJS) .depend Makefile - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LDLIBS) debug: $(MAKE) DBG=yes all diff --git a/lib/lib.Makefile b/lib/lib.Makefile index 2c2752ed2..fa15e22e4 100644 --- a/lib/lib.Makefile +++ b/lib/lib.Makefile @@ -40,5 +40,6 @@ ifneq ($(DBG),yes) CFLAGS+= $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS+= $(shell dpkg-buildflags --get CPPFLAGS) LDFLAGS+= $(shell dpkg-buildflags --get LDFLAGS) + LDLIBS+= $(shell dpkg-buildflags --get LDLIBS) endif endif diff --git a/recording-daemon/Makefile b/recording-daemon/Makefile index 200636eb7..cc0d42c9a 100644 --- a/recording-daemon/Makefile +++ b/recording-daemon/Makefile @@ -13,16 +13,16 @@ CFLAGS+= $(shell pkg-config --cflags libavfilter) CFLAGS+= $(shell mysql_config --cflags) CFLAGS+= $(shell pkg-config --cflags openssl) -LDFLAGS= -lm -LDFLAGS+= $(shell pkg-config --libs glib-2.0) -LDFLAGS+= $(shell pkg-config --libs gthread-2.0) -LDFLAGS+= $(shell pkg-config --libs libavcodec) -LDFLAGS+= $(shell pkg-config --libs libavformat) -LDFLAGS+= $(shell pkg-config --libs libavutil) -LDFLAGS+= $(shell pkg-config --libs libswresample) -LDFLAGS+= $(shell pkg-config --libs libavfilter) -LDFLAGS+= $(shell mysql_config --libs) -LDFLAGS+= $(shell pkg-config --libs openssl) +LDLIBS= -lm +LDLIBS+= $(shell pkg-config --libs glib-2.0) +LDLIBS+= $(shell pkg-config --libs gthread-2.0) +LDLIBS+= $(shell pkg-config --libs libavcodec) +LDLIBS+= $(shell pkg-config --libs libavformat) +LDLIBS+= $(shell pkg-config --libs libavutil) +LDLIBS+= $(shell pkg-config --libs libswresample) +LDLIBS+= $(shell pkg-config --libs libavfilter) +LDLIBS+= $(shell mysql_config --libs) +LDLIBS+= $(shell pkg-config --libs openssl) SRCS= epoll.c garbage.c inotify.c main.c metafile.c stream.c recaux.c packet.c \ decoder.c output.c mix.c db.c log.c forward.c diff --git a/t/Makefile b/t/Makefile index d3af1a875..76bf8ea31 100644 --- a/t/Makefile +++ b/t/Makefile @@ -20,16 +20,16 @@ else CFLAGS+= -DWITHOUT_CODECLIB endif -LDFLAGS+= $(shell pkg-config --libs glib-2.0) -LDFLAGS+= $(shell pkg-config --libs gthread-2.0) -LDFLAGS+= $(shell pkg-config --libs libcrypto) -LDFLAGS+= $(shell pkg-config --libs openssl) +LDLIBS+= $(shell pkg-config --libs glib-2.0) +LDLIBS+= $(shell pkg-config --libs gthread-2.0) +LDLIBS+= $(shell pkg-config --libs libcrypto) +LDLIBS+= $(shell pkg-config --libs openssl) ifeq ($(with_transcoding),yes) -LDFLAGS+= $(shell pkg-config --libs libavcodec) -LDFLAGS+= $(shell pkg-config --libs libavformat) -LDFLAGS+= $(shell pkg-config --libs libavutil) -LDFLAGS+= $(shell pkg-config --libs libswresample) -LDFLAGS+= $(shell pkg-config --libs libavfilter) +LDLIBS+= $(shell pkg-config --libs libavcodec) +LDLIBS+= $(shell pkg-config --libs libavformat) +LDLIBS+= $(shell pkg-config --libs libavutil) +LDLIBS+= $(shell pkg-config --libs libswresample) +LDLIBS+= $(shell pkg-config --libs libavfilter) endif SRCS= bitstr-test.c diff --git a/tests/Makefile.aes b/tests/Makefile.aes index 46714a431..9547dc71d 100644 --- a/tests/Makefile.aes +++ b/tests/Makefile.aes @@ -12,8 +12,8 @@ OBJS_DIR = ../daemon/ OBJS = crypto.o log.o loglib.o -LDFLAGS = $(shell pkg-config --libs glib-2.0) -LDFLAGS += $(shell pkg-config --libs openssl) +LDLIBS = $(shell pkg-config --libs glib-2.0) +LDLIBS += $(shell pkg-config --libs openssl) CFLAGS = -g $(shell pkg-config --cflags glib-2.0) -D_GNU_SOURCE @@ -30,7 +30,7 @@ sources = t_crypt.c include $(sources:.c=.d) t_crypt: t_crypt.o - gcc -o $@ $< $(addprefix $(OBJS_DIR), $(OBJS)) $(LDFLAGS) + gcc $(LDFLAGS) -o $@ $< $(addprefix $(OBJS_DIR), $(OBJS)) $(LDLIBS) .PHONY: clean