File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / miniupnpd / Makefile.linux
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:16:02 2012 UTC (12 years, 4 months ago) by misho
Branches: miniupnpd, elwix, MAIN
CVS tags: v1_5, HEAD
miniupnpd

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

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