diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am
index 5f1fe1d81253f64038228950545d5753d43c7d0c..d0b6c9ff7f1f8c0f9537fca3d2292fb8fe572a56 100644
--- a/daemon/src/Makefile.am
+++ b/daemon/src/Makefile.am
@@ -62,6 +62,7 @@ libring_la_LDFLAGS = \
 		@SNDFILE_LIBS@ \
 		@YAMLCPP_LIBS@ \
 		@SPEEXDSP_LIBS@ \
+		@LIBUPNP_LIBS@ \
 		$(TLS_LIB) \
 		$(IAX_LIB) \
 		$(IM_LIB) \
@@ -82,6 +83,7 @@ libring_la_CFLAGS = \
 		@PULSEAUDIO_CFLAGS@ \
 		@SAMPLERATE_CFLAGS@ \
 		@SPEEXDSP_CFLAGS@ \
+		@LIBUPNP_CFLAGS@ \
 		$(TLS_CFLAGS)
 
 if USE_DHT
diff --git a/daemon/src/upnp/Makefile.am b/daemon/src/upnp/Makefile.am
index e62c6dcfc5619236333eccb6de108da869118526..353152f5bad0db32d683bd211054a596d4bd7a3b 100644
--- a/daemon/src/upnp/Makefile.am
+++ b/daemon/src/upnp/Makefile.am
@@ -3,10 +3,7 @@ include $(top_srcdir)/globals.mak
 noinst_LTLIBRARIES = libupnpcontrol.la
 
 libupnpcontrol_la_CXXFLAGS = \
-				@CXXFLAGS@ \
-				@LIBUPNP_CFLAGS@
-
-libupnpcontrol_la_LDFLAGS = @LIBUPNP_LIBS@
+				@CXXFLAGS@
 
 libupnpcontrol_la_SOURCES = \
         upnp_control.cpp \