convert to LDLIBS
The standard variable for adding -l flags is LDLIBS, not LIBS. The default Makefile rules (which this code already relies on) will use that when linking. This also fixes a problem where we do not want to list -l flags in the dependency of make targets. When you do that, make will do a file search in /lib and /usr/lib (hardcoded) and expand the path to those absolute files. This breaks when you try to cross- compile miniupnpd for other platforms.
This commit is contained in:
parent
77a2ce69b6
commit
30e510ac79
|
@ -70,18 +70,18 @@ CFLAGS += -DIPTABLES_143
|
|||
endif
|
||||
|
||||
CFLAGS += $(shell $(PKG_CONFIG) --cflags libiptc)
|
||||
LIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libiptc)
|
||||
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libiptc)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L libiptc)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-other libiptc)
|
||||
else
|
||||
|
||||
ifeq "$(wildcard /etc/gentoo-release )" ""
|
||||
LIBS ?= -liptc
|
||||
LDLIBS ?= -liptc
|
||||
else # gentoo
|
||||
# the following is better, at least on gentoo with iptables 1.4.6
|
||||
# see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=1618
|
||||
# and http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=2183
|
||||
LIBS ?= -lip4tc
|
||||
LDLIBS ?= -lip4tc
|
||||
CFLAGS := -DIPTABLES_143 $(CFLAGS)
|
||||
endif
|
||||
|
||||
|
@ -100,10 +100,10 @@ TEST := $(shell [ \( \( $(IPTABLESVERSION1) -ge 1 \) -a \( $(IPTABLESVERSION2) -
|
|||
ifeq ($(TEST), 1)
|
||||
CFLAGS := $(CFLAGS) -DIPTABLES_143
|
||||
# the following sucks, but works
|
||||
LIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o
|
||||
#LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
|
||||
LDLIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o
|
||||
#LDLIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
|
||||
else # ifeq ($(TEST), 1)
|
||||
LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
|
||||
LDLIBS = $(IPTABLESPATH)/libiptc/libiptc.a
|
||||
endif # ifeq ($(TEST), 1)
|
||||
else # ($(TARGET_OPENWRT),)
|
||||
# openWRT :
|
||||
|
@ -112,11 +112,11 @@ else # ($(TARGET_OPENWRT),)
|
|||
TEST := $(shell test -f /usr/include/iptables/internal.h && grep -q "\#define IPTABLES_VERSION" /usr/include/iptables/internal.h && echo 1)
|
||||
ifeq ($(TEST), 1)
|
||||
CFLAGS := $(CFLAGS) -DIPTABLES_143
|
||||
LIBS = -liptc
|
||||
LDLIBS = -liptc
|
||||
endif # ($(TEST), 1)
|
||||
TEST_LIB := $(shell test -f /usr/lib$(ARCH)/libiptc.a && echo 1)
|
||||
ifeq ($(TEST_LIB), 1)
|
||||
LIBS = -liptc /usr/lib$(ARCH)/libiptc.a
|
||||
LDLIBS = -liptc /usr/lib$(ARCH)/libiptc.a
|
||||
endif # ($(TEST_LIB), 1)
|
||||
endif # ($(TARGET_OPENWRT),)
|
||||
else # ifdef IPTABLESPATH
|
||||
|
@ -125,29 +125,29 @@ else # ifdef IPTABLESPATH
|
|||
TEST := $(shell test -f /usr/include/xtables.h && grep -q "XTABLES_VERSION_CODE" /usr/include/xtables.h && echo 1)
|
||||
ifeq ($(TEST), 1)
|
||||
CFLAGS := $(CFLAGS) -DIPTABLES_143
|
||||
LIBS = -liptc
|
||||
LDLIBS = -liptc
|
||||
TESTIP4TC := $(shell test -f /lib/libip4tc.so && echo 1)
|
||||
ifeq ($(TESTIP4TC), 1)
|
||||
LIBS := $(LIBS) -lip4tc
|
||||
LDLIBS := $(LDLIBS) -lip4tc
|
||||
endif # ($(TESTIP4TC), 1)
|
||||
TESTIP6TC := $(shell test -f /lib/libip6tc.so && echo 1)
|
||||
ifeq ($(TESTIP6TC), 1)
|
||||
LIBS := $(LIBS) -lip6tc
|
||||
LDLIBS := $(LDLIBS) -lip6tc
|
||||
endif # ($(TESTIP6TC), 1)
|
||||
endif # ($(TEST), 1)
|
||||
endif # ifdef IPTABLESPATH
|
||||
endif # ifdef PCFILE_FOUND
|
||||
|
||||
LIBS += -lnfnetlink
|
||||
LDLIBS += -lnfnetlink
|
||||
|
||||
TEST := $(shell $(PKG_CONFIG) --atleast-version=1.0.2 libnetfilter_conntrack && $(PKG_CONFIG) --atleast-version=1.0.3 libmnl && echo 1)
|
||||
ifeq ($(TEST),1)
|
||||
CFLAGS += -DUSE_NFCT
|
||||
LIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libmnl)
|
||||
LIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
|
||||
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libmnl)
|
||||
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
|
||||
endif # ($(TEST),1)
|
||||
|
||||
LIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
|
||||
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
|
||||
|
||||
TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
|
||||
|
||||
|
@ -196,7 +196,7 @@ else
|
|||
sed -i -e "s/^uuid=[-0-9a-f]*/uuid=`($(STAGING_DIR_HOST)/bin/genuuid||$(STAGING_DIR_HOST)/bin/uuidgen||$(STAGING_DIR_HOST)/bin/uuid) 2>/dev/null`/" miniupnpd.conf
|
||||
endif
|
||||
|
||||
miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS)
|
||||
miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS)
|
||||
|
||||
testupnpdescgen: $(TESTUPNPDESCGENOBJS)
|
||||
|
||||
|
@ -206,13 +206,13 @@ testupnppermissions: testupnppermissions.o upnppermissions.o
|
|||
|
||||
testgetifaddr: testgetifaddr.o getifaddr.o
|
||||
|
||||
testgetroute: testgetroute.o linux/getroute.o upnputils.o -lnfnetlink
|
||||
testgetroute: testgetroute.o linux/getroute.o upnputils.o
|
||||
|
||||
testasyncsendto: testasyncsendto.o asyncsendto.o upnputils.o \
|
||||
linux/getroute.o -lnfnetlink
|
||||
linux/getroute.o
|
||||
|
||||
testportinuse: testportinuse.o portinuse.o getifaddr.o \
|
||||
netfilter/iptcrdr.o $(LIBS)
|
||||
netfilter/iptcrdr.o
|
||||
|
||||
miniupnpdctl: miniupnpdctl.o
|
||||
|
||||
|
|
Loading…
Reference in New Issue