blob: 007c6a030644ed82b3156f9783c6f89ebea475ae [file] [log] [blame]
https://github.com/miniupnp/miniupnp/pull/70
--- a/Makefile.linux
+++ b/Makefile.linux
@@ -21,10 +21,9 @@
# $ IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux
#
#CFLAGS = -O -g -DDEBUG
-CFLAGS ?= -Os
CFLAGS += -fno-strict-aliasing
CFLAGS += -fno-common
-CFLAGS += -D_GNU_SOURCE
+CPPFLAGS += -D_GNU_SOURCE
CFLAGS += -Wall
CFLAGS += -Wextra -Wstrict-prototypes -Wdeclaration-after-statement
#CFLAGS += -Wno-missing-field-initializers
@@ -53,69 +52,8 @@ NETFILTEROBJS = netfilter/iptcrdr.o netfilter/iptpinhole.o
ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS)
-ifeq "$(wildcard /etc/gentoo-release )" ""
-LIBS ?= -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
-CFLAGS := -DIPTABLES_143 $(CFLAGS)
-endif
-
-ARCH ?= $(shell uname -m | grep -q "x86_64" && echo 64)
-ifdef IPTABLESPATH
-CFLAGS := $(CFLAGS) -I$(IPTABLESPATH)/include/
-LDFLAGS := $(LDFLAFGS) -L$(IPTABLESPATH)/libiptc/
-# get iptables version and set IPTABLES_143 macro if needed
-ifeq ($(TARGET_OPENWRT),)
-IPTABLESVERSION := $(shell grep "\#define VERSION" $(IPTABLESPATH)/config.h | tr -d \" |cut -d" " -f3 )
-IPTABLESVERSION1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 )
-IPTABLESVERSION2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 )
-IPTABLESVERSION3 := $(shell echo $(IPTABLESVERSION) | cut -d. -f3 )
-# test if iptables version >= 1.4.3
-TEST := $(shell [ \( \( $(IPTABLESVERSION1) -ge 1 \) -a \( $(IPTABLESVERSION2) -ge 4 \) \) -a \( $(IPTABLESVERSION3) -ge 3 \) ] && echo 1 )
-ifeq ($(TEST), 1)
-CFLAGS := $(CFLAGS) -DIPTABLES_143
-# the following sucks, but works
-LIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o
-#LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
-else # ifeq ($(TEST), 1)
-LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
-endif # ifeq ($(TEST), 1)
-else # ($(TARGET_OPENWRT),)
-# openWRT :
-# check for system-wide iptables files. Test if iptables version >= 1.4.3
-# the following test has to be verified :
-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
-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
-endif # ($(TEST_LIB), 1)
-endif # ($(TARGET_OPENWRT),)
-else # ifdef IPTABLESPATH
-# IPTABLESPATH not defined
-# the following test has to be verified :
-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
-TESTIP4TC := $(shell test -f /lib/libip4tc.so && echo 1)
-ifeq ($(TESTIP4TC), 1)
-LIBS := $(LIBS) -lip4tc
-endif # ($(TESTIP4TC), 1)
-TESTIP6TC := $(shell test -f /lib/libip6tc.so && echo 1)
-ifeq ($(TESTIP6TC), 1)
-LIBS := $(LIBS) -lip6tc
-endif # ($(TESTIP6TC), 1)
-endif # ($(TEST), 1)
-endif # ifdef IPTABLESPATH
-
-LIBS += -lnfnetlink
+LDLIBS = -lip4tc -lnfnetlink
+CPPFLAGS += -DIPTABLES_143
TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
@@ -150,8 +88,8 @@ install: miniupnpd miniupnpd.8 miniupnpd.conf genuuid \
$(INSTALL) --mode=0644 -b miniupnpd.conf $(ETCINSTALLDIR)
$(INSTALL) -d $(PREFIX)/etc/init.d
$(INSTALL) linux/miniupnpd.init.d.script $(PREFIX)/etc/init.d/miniupnpd
+ $(INSTALL) -d $(MANINSTALLDIR)
+ $(INSTALL) --mode=0644 miniupnpd.8 $(MANINSTALLDIR)
- $(INSTALL) miniupnpd.8 $(MANINSTALLDIR)
- gzip $(MANINSTALLDIR)/miniupnpd.8
# genuuid is using the uuidgen CLI tool which is part of libuuid
# from the e2fsprogs
@@ -162,7 +100,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)