| 
version 1.1.1.2, 2012/05/29 12:55:57
 | 
version 1.1.1.3, 2013/07/22 00:32:35
 | 
| 
 Line 1
 | 
 Line 1
 | 
 |  # $Id$ | 
  # $Id$ | 
 |  # MiniUPnP project | 
  # MiniUPnP project | 
| # (c) 2006-2011 Thomas Bernard | # (c) 2006-2012 Thomas Bernard | 
 |  # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ | 
  # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ | 
 |  # Author : Thomas Bernard | 
  # Author : Thomas Bernard | 
 |  # for use with GNU Make | 
  # for use with GNU Make | 
 |  # | 
  # | 
 |   | 
  # options can be passed to genconfig.sh through CONFIG_OPTIONS : | 
 |   | 
  # $ CONFIG_OPTIONS="--ipv6 --igd2" make -f Makefile.linux | 
 |   | 
  # | 
 |  # To install use : | 
  # To install use : | 
 |  # $ PREFIX=/dummyinstalldir make -f Makefile.linux install | 
  # $ PREFIX=/dummyinstalldir make -f Makefile.linux install | 
 |  # or : | 
  # or : | 
| 
 Line 17
 | 
 Line 20
 | 
 |  # ./configure them and build them then miniupnpd will build using : | 
  # ./configure them and build them then miniupnpd will build using : | 
 |  # $ IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux | 
  # $ IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux | 
 |  # | 
  # | 
| #CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG | #CFLAGS = -O -g -DDEBUG | 
| CFLAGS ?= -Wall -Os -D_GNU_SOURCE -fno-strict-aliasing -Wstrict-prototypes  | CFLAGS ?= -Os | 
|   | CFLAGS += -fno-strict-aliasing | 
|   | CFLAGS += -fno-common | 
|   | CFLAGS += -D_GNU_SOURCE | 
|   | CFLAGS += -Wall | 
|   | CFLAGS += -Wextra -Wstrict-prototypes -Wdeclaration-after-statement | 
|   | #CFLAGS += -Wno-missing-field-initializers | 
|   | #CFLAGS += -ansi        # iptables headers does use typeof which is a gcc extension | 
 |  CC ?= gcc | 
  CC ?= gcc | 
 |  RM = rm -f | 
  RM = rm -f | 
 |  INSTALL = install | 
  INSTALL = install | 
| 
 Line 29  CP = cp
 | 
 Line 39  CP = cp
 | 
 |  INSTALLPREFIX ?= $(PREFIX)/usr | 
  INSTALLPREFIX ?= $(PREFIX)/usr | 
 |  SBININSTALLDIR = $(INSTALLPREFIX)/sbin | 
  SBININSTALLDIR = $(INSTALLPREFIX)/sbin | 
 |  ETCINSTALLDIR = $(PREFIX)/etc/miniupnpd | 
  ETCINSTALLDIR = $(PREFIX)/etc/miniupnpd | 
 |   | 
  MANINSTALLDIR = $(INSTALLPREFIX)/share/man/man8 | 
 |   | 
   | 
 |  BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \ | 
  BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \ | 
 |             upnpreplyparse.o minixml.o \ | 
             upnpreplyparse.o minixml.o \ | 
|                    upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \ |            upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \ | 
 |             options.o upnppermissions.o minissdp.o natpmp.o \ | 
             options.o upnppermissions.o minissdp.o natpmp.o \ | 
|            upnpevents.o upnputils.o getconnstatus.o |            upnpevents.o upnputils.o getconnstatus.o \ | 
|   |            upnppinhole.o | 
 |   | 
   | 
| LNXOBJS = linux/getifstats.o linux/ifacewatcher.o | LNXOBJS = linux/getifstats.o linux/ifacewatcher.o linux/getroute.o | 
| NETFILTEROBJS = netfilter/iptcrdr.o | NETFILTEROBJS = netfilter/iptcrdr.o netfilter/iptpinhole.o | 
 |   | 
   | 
 |  ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) | 
  ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) | 
 |   | 
   | 
 |  ifeq "$(wildcard /etc/gentoo-release )" "" | 
  ifeq "$(wildcard /etc/gentoo-release )" "" | 
 |  LIBS ?= -liptc | 
  LIBS ?= -liptc | 
| else | else # gentoo | 
 |  # the following is better, at least on gentoo with iptables 1.4.6 | 
  # the following is better, at least on gentoo with iptables 1.4.6 | 
 |  # see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=1618 | 
  # see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=1618 | 
 |  # and http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=2183 | 
  # and http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=2183 | 
 |  LIBS ?= -lip4tc | 
  LIBS ?= -lip4tc | 
| CFLAGS := -I/usr/src/linux/include -DIPTABLES_143 $(CFLAGS) | CFLAGS := -DIPTABLES_143 $(CFLAGS) | 
 |  endif | 
  endif | 
 |   | 
   | 
 |  ARCH ?= $(shell uname -m | grep -q "x86_64" && echo 64) | 
  ARCH ?= $(shell uname -m | grep -q "x86_64" && echo 64) | 
| 
 Line 68  CFLAGS := $(CFLAGS) -DIPTABLES_143
 | 
 Line 80  CFLAGS := $(CFLAGS) -DIPTABLES_143
 | 
 |  # the following sucks, but works | 
  # the following sucks, but works | 
 |  LIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o | 
  LIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o | 
 |  #LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a | 
  #LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a | 
| else | else # ifeq ($(TEST), 1) | 
 |  LIBS = $(IPTABLESPATH)/libiptc/libiptc.a | 
  LIBS = $(IPTABLESPATH)/libiptc/libiptc.a | 
| endif | endif # ifeq ($(TEST), 1) | 
| else | else # ($(TARGET_OPENWRT),) | 
|   | # openWRT : | 
 |  # check for system-wide iptables files. Test if iptables version >= 1.4.3 | 
  # 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) | 
  TEST := $(shell test -f /usr/include/iptables/internal.h && grep -q "\#define IPTABLES_VERSION" /usr/include/iptables/internal.h && echo 1) | 
 |  ifeq ($(TEST), 1) | 
  ifeq ($(TEST), 1) | 
 |  CFLAGS := $(CFLAGS) -DIPTABLES_143 | 
  CFLAGS := $(CFLAGS) -DIPTABLES_143 | 
 |  LIBS = -liptc | 
  LIBS = -liptc | 
 |   | 
  endif  # ($(TEST), 1) | 
 |  TEST_LIB := $(shell test -f /usr/lib$(ARCH)/libiptc.a && echo 1) | 
  TEST_LIB := $(shell test -f /usr/lib$(ARCH)/libiptc.a && echo 1) | 
 |  ifeq ($(TEST_LIB), 1) | 
  ifeq ($(TEST_LIB), 1) | 
 |  LIBS = -liptc /usr/lib$(ARCH)/libiptc.a | 
  LIBS = -liptc /usr/lib$(ARCH)/libiptc.a | 
| endif | endif # ($(TEST_LIB), 1) | 
| endif  | endif # ($(TARGET_OPENWRT),) | 
| endif | else # ifdef IPTABLESPATH | 
| endif | # 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 | 
 |   | 
   | 
 |  TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o | 
  TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o | 
 |   | 
   | 
 |  EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \ | 
  EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \ | 
|               testupnppermissions miniupnpdctl testgetifaddr |               testupnppermissions miniupnpdctl testgetifaddr \ | 
|   |               testgetroute | 
 |   | 
   | 
 |  .PHONY: all clean install depend genuuid | 
  .PHONY: all clean install depend genuuid | 
 |   | 
   | 
| 
 Line 99  clean:
 | 
 Line 132  clean:
 | 
 |          $(RM) $(EXECUTABLES) | 
          $(RM) $(EXECUTABLES) | 
 |          $(RM) testupnpdescgen.o testgetifstats.o | 
          $(RM) testupnpdescgen.o testgetifstats.o | 
 |          $(RM) testupnppermissions.o testgetifaddr.o | 
          $(RM) testupnppermissions.o testgetifaddr.o | 
 |   | 
          $(RM) testgetroute.o | 
 |          $(RM) miniupnpdctl.o | 
          $(RM) miniupnpdctl.o | 
 |   | 
   | 
| install:        miniupnpd genuuid | install:        miniupnpd miniupnpd.8 miniupnpd.conf genuuid \ | 
|   |         netfilter/iptables_init.sh netfilter/iptables_removeall.sh \ | 
|   |         netfilter/ip6tables_init.sh netfilter/ip6tables_removeall.sh \ | 
|   |         linux/miniupnpd.init.d.script | 
 |          $(STRIP) miniupnpd | 
          $(STRIP) miniupnpd | 
 |          $(INSTALL) -d $(SBININSTALLDIR) | 
          $(INSTALL) -d $(SBININSTALLDIR) | 
 |          $(INSTALL) miniupnpd $(SBININSTALLDIR) | 
          $(INSTALL) miniupnpd $(SBININSTALLDIR) | 
 |          $(INSTALL) -d $(ETCINSTALLDIR) | 
          $(INSTALL) -d $(ETCINSTALLDIR) | 
 |          $(INSTALL) netfilter/iptables_init.sh $(ETCINSTALLDIR) | 
          $(INSTALL) netfilter/iptables_init.sh $(ETCINSTALLDIR) | 
 |          $(INSTALL) netfilter/iptables_removeall.sh $(ETCINSTALLDIR) | 
          $(INSTALL) netfilter/iptables_removeall.sh $(ETCINSTALLDIR) | 
 |   | 
          $(INSTALL) netfilter/ip6tables_init.sh $(ETCINSTALLDIR) | 
 |   | 
          $(INSTALL) netfilter/ip6tables_removeall.sh $(ETCINSTALLDIR) | 
 |          $(INSTALL) --mode=0644 -b miniupnpd.conf $(ETCINSTALLDIR) | 
          $(INSTALL) --mode=0644 -b miniupnpd.conf $(ETCINSTALLDIR) | 
 |          $(INSTALL) -d $(PREFIX)/etc/init.d | 
          $(INSTALL) -d $(PREFIX)/etc/init.d | 
 |          $(INSTALL) linux/miniupnpd.init.d.script $(PREFIX)/etc/init.d/miniupnpd | 
          $(INSTALL) linux/miniupnpd.init.d.script $(PREFIX)/etc/init.d/miniupnpd | 
 |   | 
          $(INSTALL) miniupnpd.8 $(MANINSTALLDIR) | 
 |   | 
          gzip $(MANINSTALLDIR)/miniupnpd.8 | 
 |   | 
   | 
 |  # genuuid is using the uuidgen CLI tool which is part of libuuid | 
  # genuuid is using the uuidgen CLI tool which is part of libuuid | 
 |  # from the e2fsprogs | 
  # from the e2fsprogs | 
| 
 Line 131  testupnppermissions: testupnppermissions.o upnppermiss
 | 
 Line 172  testupnppermissions: testupnppermissions.o upnppermiss
 | 
 |   | 
   | 
 |  testgetifaddr:  testgetifaddr.o getifaddr.o | 
  testgetifaddr:  testgetifaddr.o getifaddr.o | 
 |   | 
   | 
 |   | 
  testgetroute:   testgetroute.o linux/getroute.o upnputils.o -lnfnetlink | 
 |   | 
   | 
 |  miniupnpdctl:   miniupnpdctl.o | 
  miniupnpdctl:   miniupnpdctl.o | 
 |   | 
   | 
| config.h:       genconfig.sh | config.h:       genconfig.sh VERSION | 
|         ./genconfig.sh |         ./genconfig.sh $(CONFIG_OPTIONS) | 
 |   | 
   | 
 |  depend: config.h | 
  depend: config.h | 
 |          makedepend -f$(MAKEFILE_LIST) -Y \ | 
          makedepend -f$(MAKEFILE_LIST) -Y \ | 
| 
 Line 143  depend: config.h
 | 
 Line 186  depend: config.h
 | 
 |   | 
   | 
 |  # DO NOT DELETE | 
  # DO NOT DELETE | 
 |   | 
   | 
| miniupnpd.o: config.h upnpglobalvars.h upnppermissions.h miniupnpdtypes.h | miniupnpd.o: config.h macros.h upnpglobalvars.h upnppermissions.h | 
| miniupnpd.o: upnphttp.h upnpdescgen.h miniupnpdpath.h getifaddr.h upnpsoap.h | miniupnpd.o: miniupnpdtypes.h upnphttp.h upnpdescgen.h miniupnpdpath.h | 
| miniupnpd.o: options.h minissdp.h upnpredirect.h daemonize.h upnpevents.h | miniupnpd.o: getifaddr.h upnpsoap.h options.h minissdp.h upnpredirect.h | 
| miniupnpd.o: natpmp.h commonrdr.h upnputils.h ifacewatcher.h | miniupnpd.o: upnppinhole.h daemonize.h upnpevents.h natpmp.h commonrdr.h | 
|   | miniupnpd.o: upnputils.h ifacewatcher.h | 
 |  upnphttp.o: config.h upnphttp.h upnpdescgen.h miniupnpdpath.h upnpsoap.h | 
  upnphttp.o: config.h upnphttp.h upnpdescgen.h miniupnpdpath.h upnpsoap.h | 
| upnphttp.o: upnpevents.h | upnphttp.o: upnpevents.h upnputils.h | 
 |  upnpdescgen.o: config.h getifaddr.h upnpredirect.h upnpdescgen.h | 
  upnpdescgen.o: config.h getifaddr.h upnpredirect.h upnpdescgen.h | 
 |  upnpdescgen.o: miniupnpdpath.h upnpglobalvars.h upnppermissions.h | 
  upnpdescgen.o: miniupnpdpath.h upnpglobalvars.h upnppermissions.h | 
 |  upnpdescgen.o: miniupnpdtypes.h upnpdescstrings.h upnpurns.h getconnstatus.h | 
  upnpdescgen.o: miniupnpdtypes.h upnpdescstrings.h upnpurns.h getconnstatus.h | 
| upnpsoap.o: config.h upnpglobalvars.h upnppermissions.h miniupnpdtypes.h | upnpsoap.o: macros.h config.h upnpglobalvars.h upnppermissions.h | 
| upnpsoap.o: upnphttp.h upnpsoap.h upnpreplyparse.h upnpredirect.h getifaddr.h | upnpsoap.o: miniupnpdtypes.h upnphttp.h upnpsoap.h upnpreplyparse.h | 
| upnpsoap.o: getifstats.h getconnstatus.h upnpurns.h | upnpsoap.o: upnpredirect.h upnppinhole.h getifaddr.h getifstats.h | 
|   | upnpsoap.o: getconnstatus.h upnpurns.h | 
 |  upnpreplyparse.o: upnpreplyparse.h minixml.h | 
  upnpreplyparse.o: upnpreplyparse.h minixml.h | 
 |  minixml.o: minixml.h | 
  minixml.o: minixml.h | 
| upnpredirect.o: config.h upnpredirect.h upnpglobalvars.h upnppermissions.h | upnpredirect.o: macros.h config.h upnpredirect.h upnpglobalvars.h | 
| upnpredirect.o: miniupnpdtypes.h upnpevents.h netfilter/iptcrdr.h commonrdr.h | upnpredirect.o: upnppermissions.h miniupnpdtypes.h upnpevents.h | 
|   | upnpredirect.o: netfilter/iptcrdr.h commonrdr.h | 
 |  getifaddr.o: config.h getifaddr.h | 
  getifaddr.o: config.h getifaddr.h | 
 |  daemonize.o: daemonize.h config.h | 
  daemonize.o: daemonize.h config.h | 
 |  upnpglobalvars.o: config.h upnpglobalvars.h upnppermissions.h | 
  upnpglobalvars.o: config.h upnpglobalvars.h upnppermissions.h | 
| 
 Line 168  options.o: miniupnpdtypes.h
 | 
 Line 214  options.o: miniupnpdtypes.h
 | 
 |  upnppermissions.o: config.h upnppermissions.h | 
  upnppermissions.o: config.h upnppermissions.h | 
 |  minissdp.o: config.h upnpdescstrings.h miniupnpdpath.h upnphttp.h | 
  minissdp.o: config.h upnpdescstrings.h miniupnpdpath.h upnphttp.h | 
 |  minissdp.o: upnpglobalvars.h upnppermissions.h miniupnpdtypes.h minissdp.h | 
  minissdp.o: upnpglobalvars.h upnppermissions.h miniupnpdtypes.h minissdp.h | 
| minissdp.o: upnputils.h codelength.h | minissdp.o: upnputils.h getroute.h codelength.h | 
| natpmp.o: config.h natpmp.h upnpglobalvars.h upnppermissions.h | natpmp.o: macros.h config.h natpmp.h upnpglobalvars.h upnppermissions.h | 
| natpmp.o: miniupnpdtypes.h getifaddr.h upnpredirect.h commonrdr.h | natpmp.o: miniupnpdtypes.h getifaddr.h upnpredirect.h commonrdr.h upnputils.h | 
 |  upnpevents.o: config.h upnpevents.h miniupnpdpath.h upnpglobalvars.h | 
  upnpevents.o: config.h upnpevents.h miniupnpdpath.h upnpglobalvars.h | 
| upnpevents.o: upnppermissions.h miniupnpdtypes.h upnpdescgen.h | upnpevents.o: upnppermissions.h miniupnpdtypes.h upnpdescgen.h upnputils.h | 
 |  upnputils.o: config.h upnputils.h | 
  upnputils.o: config.h upnputils.h | 
 |  getconnstatus.o: getconnstatus.h getifaddr.h | 
  getconnstatus.o: getconnstatus.h getifaddr.h | 
 |   | 
  upnppinhole.o: macros.h config.h upnpredirect.h upnpglobalvars.h | 
 |   | 
  upnppinhole.o: upnppermissions.h miniupnpdtypes.h upnpevents.h | 
 |   | 
  upnppinhole.o: netfilter/iptpinhole.h | 
 |  linux/getifstats.o: config.h getifstats.h | 
  linux/getifstats.o: config.h getifstats.h | 
 |  linux/ifacewatcher.o: config.h ifacewatcher.h config.h minissdp.h | 
  linux/ifacewatcher.o: config.h ifacewatcher.h config.h minissdp.h | 
 |  linux/ifacewatcher.o: miniupnpdtypes.h getifaddr.h upnpglobalvars.h | 
  linux/ifacewatcher.o: miniupnpdtypes.h getifaddr.h upnpglobalvars.h | 
 |  linux/ifacewatcher.o: upnppermissions.h natpmp.h | 
  linux/ifacewatcher.o: upnppermissions.h natpmp.h | 
| netfilter/iptcrdr.o: netfilter/iptcrdr.h commonrdr.h config.h | linux/getroute.o: getroute.h upnputils.h | 
| netfilter/iptcrdr.o: upnpglobalvars.h upnppermissions.h miniupnpdtypes.h | netfilter/iptcrdr.o: macros.h config.h netfilter/iptcrdr.h commonrdr.h | 
| testupnpdescgen.o: config.h upnpdescgen.h | netfilter/iptcrdr.o: config.h upnpglobalvars.h upnppermissions.h | 
|   | netfilter/iptcrdr.o: miniupnpdtypes.h | 
|   | netfilter/iptpinhole.o: config.h netfilter/iptpinhole.h upnpglobalvars.h | 
|   | netfilter/iptpinhole.o: upnppermissions.h config.h miniupnpdtypes.h | 
|   | netfilter/iptpinhole.o: netfilter/tiny_nf_nat.h | 
|   | testupnpdescgen.o: macros.h config.h upnpdescgen.h | 
 |  upnpdescgen.o: config.h getifaddr.h upnpredirect.h upnpdescgen.h | 
  upnpdescgen.o: config.h getifaddr.h upnpredirect.h upnpdescgen.h | 
 |  upnpdescgen.o: miniupnpdpath.h upnpglobalvars.h upnppermissions.h | 
  upnpdescgen.o: miniupnpdpath.h upnpglobalvars.h upnppermissions.h | 
 |  upnpdescgen.o: miniupnpdtypes.h upnpdescstrings.h upnpurns.h getconnstatus.h | 
  upnpdescgen.o: miniupnpdtypes.h upnpdescstrings.h upnpurns.h getconnstatus.h |