Annotation of embedaddon/miniupnpd/Makefile.linux, revision 1.1.1.2

1.1.1.2 ! misho       1: # $Id: Makefile.linux,v 1.59 2011/07/25 16:04:54 nanard Exp $
1.1       misho       2: # MiniUPnP project
1.1.1.2 ! misho       3: # (c) 2006-2011 Thomas Bernard
1.1       misho       4: # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
                      5: # Author : Thomas Bernard
                      6: # for use with GNU Make
                      7: #
                      8: # To install use :
                      9: # $ PREFIX=/dummyinstalldir make -f Makefile.linux install
                     10: # or :
                     11: # $ INSTALLPREFIX=/usr/local make -f Makefile.linux install
                     12: # or :
                     13: # $ make -f Makefile.linux install
                     14: #
                     15: # if your system hasn't iptables libiptc headers and binary correctly
                     16: # installed, you need to get iptables sources from http://netfilter.org/
                     17: # ./configure them and build them then miniupnpd will build using :
                     18: # $ IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux
                     19: #
                     20: #CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG
1.1.1.2 ! misho      21: CFLAGS ?= -Wall -Os -D_GNU_SOURCE -fno-strict-aliasing -Wstrict-prototypes 
        !            22: CC ?= gcc
1.1       misho      23: RM = rm -f
                     24: INSTALL = install
1.1.1.2 ! misho      25: STRIP ?= strip
        !            26: CP = cp
        !            27: 
1.1       misho      28: 
                     29: INSTALLPREFIX ?= $(PREFIX)/usr
                     30: SBININSTALLDIR = $(INSTALLPREFIX)/sbin
                     31: ETCINSTALLDIR = $(PREFIX)/etc/miniupnpd
                     32: 
                     33: BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \
                     34:            upnpreplyparse.o minixml.o \
                     35:                   upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \
                     36:            options.o upnppermissions.o minissdp.o natpmp.o \
1.1.1.2 ! misho      37:            upnpevents.o upnputils.o getconnstatus.o
1.1       misho      38: 
1.1.1.2 ! misho      39: LNXOBJS = linux/getifstats.o linux/ifacewatcher.o
1.1       misho      40: NETFILTEROBJS = netfilter/iptcrdr.o
                     41: 
                     42: ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS)
                     43: 
1.1.1.2 ! misho      44: ifeq "$(wildcard /etc/gentoo-release )" ""
        !            45: LIBS ?= -liptc
        !            46: else
1.1       misho      47: # the following is better, at least on gentoo with iptables 1.4.6
                     48: # see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=1618
1.1.1.2 ! misho      49: # and http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=2183
        !            50: LIBS ?= -lip4tc
        !            51: CFLAGS := -I/usr/src/linux/include -DIPTABLES_143 $(CFLAGS)
        !            52: endif
1.1       misho      53: 
1.1.1.2 ! misho      54: ARCH ?= $(shell uname -m | grep -q "x86_64" && echo 64)
1.1       misho      55: ifdef IPTABLESPATH
                     56: CFLAGS := $(CFLAGS) -I$(IPTABLESPATH)/include/
                     57: LDFLAGS := $(LDFLAFGS) -L$(IPTABLESPATH)/libiptc/
                     58: # get iptables version and set IPTABLES_143 macro if needed
1.1.1.2 ! misho      59: ifeq ($(TARGET_OPENWRT),)
1.1       misho      60: IPTABLESVERSION := $(shell grep "\#define VERSION" $(IPTABLESPATH)/config.h | tr -d \" |cut -d" " -f3 )
                     61: IPTABLESVERSION1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 )
                     62: IPTABLESVERSION2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 )
                     63: IPTABLESVERSION3 := $(shell echo $(IPTABLESVERSION) | cut -d. -f3 )
                     64: # test if iptables version >= 1.4.3
                     65: TEST := $(shell [ \( \( $(IPTABLESVERSION1) -ge 1 \) -a \( $(IPTABLESVERSION2) -ge 4 \) \) -a \( $(IPTABLESVERSION3) -ge 3 \) ] && echo 1 )
                     66: ifeq ($(TEST), 1)
                     67: CFLAGS := $(CFLAGS) -DIPTABLES_143
                     68: # the following sucks, but works
1.1.1.2 ! misho      69: LIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o
        !            70: #LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
1.1       misho      71: else
                     72: LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
                     73: endif
                     74: else
                     75: # check for system-wide iptables files. Test if iptables version >= 1.4.3
                     76: TEST := $(shell test -f /usr/include/iptables/internal.h && grep -q "\#define IPTABLES_VERSION" /usr/include/iptables/internal.h && echo 1)
                     77: ifeq ($(TEST), 1)
                     78: CFLAGS := $(CFLAGS) -DIPTABLES_143
                     79: LIBS = -liptc
                     80: TEST_LIB := $(shell test -f /usr/lib$(ARCH)/libiptc.a && echo 1)
                     81: ifeq ($(TEST_LIB), 1)
                     82: LIBS = -liptc /usr/lib$(ARCH)/libiptc.a
                     83: endif
                     84: endif 
                     85: endif
1.1.1.2 ! misho      86: endif
1.1       misho      87: 
                     88: TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
                     89: 
                     90: EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
                     91:               testupnppermissions miniupnpdctl testgetifaddr
                     92: 
                     93: .PHONY:        all clean install depend genuuid
                     94: 
                     95: all:   $(EXECUTABLES)
                     96: 
                     97: clean:
                     98:        $(RM) $(ALLOBJS)
                     99:        $(RM) $(EXECUTABLES)
                    100:        $(RM) testupnpdescgen.o testgetifstats.o
                    101:        $(RM) testupnppermissions.o testgetifaddr.o
                    102:        $(RM) miniupnpdctl.o
                    103: 
                    104: install:       miniupnpd genuuid
                    105:        $(STRIP) miniupnpd
                    106:        $(INSTALL) -d $(SBININSTALLDIR)
                    107:        $(INSTALL) miniupnpd $(SBININSTALLDIR)
                    108:        $(INSTALL) -d $(ETCINSTALLDIR)
                    109:        $(INSTALL) netfilter/iptables_init.sh $(ETCINSTALLDIR)
                    110:        $(INSTALL) netfilter/iptables_removeall.sh $(ETCINSTALLDIR)
                    111:        $(INSTALL) --mode=0644 -b miniupnpd.conf $(ETCINSTALLDIR)
                    112:        $(INSTALL) -d $(PREFIX)/etc/init.d
                    113:        $(INSTALL) linux/miniupnpd.init.d.script $(PREFIX)/etc/init.d/miniupnpd
                    114: 
                    115: # genuuid is using the uuidgen CLI tool which is part of libuuid
                    116: # from the e2fsprogs
                    117: genuuid:
1.1.1.2 ! misho     118: ifeq ($(TARGET_OPENWRT),)
        !           119:        sed -i -e "s/^uuid=[-0-9a-f]*/uuid=`(genuuid||uuidgen||uuid) 2>/dev/null`/" miniupnpd.conf
        !           120: else
        !           121:        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
        !           122: endif
1.1       misho     123: 
                    124: miniupnpd:     $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS)
                    125: 
                    126: testupnpdescgen:       $(TESTUPNPDESCGENOBJS)
                    127: 
                    128: testgetifstats:        testgetifstats.o linux/getifstats.o
                    129: 
                    130: testupnppermissions:   testupnppermissions.o upnppermissions.o
                    131: 
                    132: testgetifaddr: testgetifaddr.o getifaddr.o
                    133: 
                    134: miniupnpdctl:  miniupnpdctl.o
                    135: 
                    136: config.h:      genconfig.sh
                    137:        ./genconfig.sh
                    138: 
                    139: depend:        config.h
                    140:        makedepend -f$(MAKEFILE_LIST) -Y \
                    141:        $(ALLOBJS:.o=.c) $(TESTUPNPDESCGENOBJS:.o=.c) \
                    142:        testgetifstats.c 2>/dev/null
                    143: 
                    144: # DO NOT DELETE
                    145: 
                    146: miniupnpd.o: config.h upnpglobalvars.h upnppermissions.h miniupnpdtypes.h
                    147: miniupnpd.o: upnphttp.h upnpdescgen.h miniupnpdpath.h getifaddr.h upnpsoap.h
                    148: miniupnpd.o: options.h minissdp.h upnpredirect.h daemonize.h upnpevents.h
1.1.1.2 ! misho     149: miniupnpd.o: natpmp.h commonrdr.h upnputils.h ifacewatcher.h
1.1       misho     150: upnphttp.o: config.h upnphttp.h upnpdescgen.h miniupnpdpath.h upnpsoap.h
                    151: upnphttp.o: upnpevents.h
1.1.1.2 ! misho     152: upnpdescgen.o: config.h getifaddr.h upnpredirect.h upnpdescgen.h
        !           153: upnpdescgen.o: miniupnpdpath.h upnpglobalvars.h upnppermissions.h
        !           154: upnpdescgen.o: miniupnpdtypes.h upnpdescstrings.h upnpurns.h getconnstatus.h
1.1       misho     155: upnpsoap.o: config.h upnpglobalvars.h upnppermissions.h miniupnpdtypes.h
                    156: upnpsoap.o: upnphttp.h upnpsoap.h upnpreplyparse.h upnpredirect.h getifaddr.h
1.1.1.2 ! misho     157: upnpsoap.o: getifstats.h getconnstatus.h upnpurns.h
1.1       misho     158: upnpreplyparse.o: upnpreplyparse.h minixml.h
                    159: minixml.o: minixml.h
                    160: upnpredirect.o: config.h upnpredirect.h upnpglobalvars.h upnppermissions.h
                    161: upnpredirect.o: miniupnpdtypes.h upnpevents.h netfilter/iptcrdr.h commonrdr.h
1.1.1.2 ! misho     162: getifaddr.o: config.h getifaddr.h
1.1       misho     163: daemonize.o: daemonize.h config.h
                    164: upnpglobalvars.o: config.h upnpglobalvars.h upnppermissions.h
                    165: upnpglobalvars.o: miniupnpdtypes.h
                    166: options.o: options.h config.h upnppermissions.h upnpglobalvars.h
                    167: options.o: miniupnpdtypes.h
                    168: upnppermissions.o: config.h upnppermissions.h
                    169: minissdp.o: config.h upnpdescstrings.h miniupnpdpath.h upnphttp.h
                    170: minissdp.o: upnpglobalvars.h upnppermissions.h miniupnpdtypes.h minissdp.h
1.1.1.2 ! misho     171: minissdp.o: upnputils.h codelength.h
1.1       misho     172: natpmp.o: config.h natpmp.h upnpglobalvars.h upnppermissions.h
                    173: natpmp.o: miniupnpdtypes.h getifaddr.h upnpredirect.h commonrdr.h
                    174: upnpevents.o: config.h upnpevents.h miniupnpdpath.h upnpglobalvars.h
                    175: upnpevents.o: upnppermissions.h miniupnpdtypes.h upnpdescgen.h
1.1.1.2 ! misho     176: upnputils.o: config.h upnputils.h
        !           177: getconnstatus.o: getconnstatus.h getifaddr.h
        !           178: linux/getifstats.o: config.h getifstats.h
        !           179: linux/ifacewatcher.o: config.h ifacewatcher.h config.h minissdp.h
        !           180: linux/ifacewatcher.o: miniupnpdtypes.h getifaddr.h upnpglobalvars.h
        !           181: linux/ifacewatcher.o: upnppermissions.h natpmp.h
1.1       misho     182: netfilter/iptcrdr.o: netfilter/iptcrdr.h commonrdr.h config.h
                    183: netfilter/iptcrdr.o: upnpglobalvars.h upnppermissions.h miniupnpdtypes.h
                    184: testupnpdescgen.o: config.h upnpdescgen.h
1.1.1.2 ! misho     185: upnpdescgen.o: config.h getifaddr.h upnpredirect.h upnpdescgen.h
        !           186: upnpdescgen.o: miniupnpdpath.h upnpglobalvars.h upnppermissions.h
        !           187: upnpdescgen.o: miniupnpdtypes.h upnpdescstrings.h upnpurns.h getconnstatus.h
1.1       misho     188: testgetifstats.o: getifstats.h

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>