--- embedaddon/miniupnpd/Makefile 2012/02/21 23:16:02 1.1.1.1 +++ embedaddon/miniupnpd/Makefile 2013/07/22 00:32:35 1.1.1.3 @@ -1,11 +1,29 @@ -# $Id: Makefile,v 1.1.1.1 2012/02/21 23:16:02 misho Exp $ +# $Id: Makefile,v 1.1.1.3 2013/07/22 00:32:35 misho Exp $ # MiniUPnP project -# http://miniupnp.free.fr/ +# http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ # Author: Thomas Bernard -# This Makefile should work for *BSD and SunOS/Solaris -# Linux users, please use Makefile.linux -CFLAGS ?= -Wall -Os -#CFLAGS = -Wall -O -g -DDEBUG +# +# Makefile for miniupnpd (MiniUPnP daemon) +# +# This Makefile should work for *BSD and SunOS/Solaris. +# On Mac OS X, use "bsdmake" to build. +# This Makefile is NOT compatible with GNU Make. +# Linux users, please use Makefile.linux : +# make -f Makefile.linux +# +# options can be passed to genconfig.sh through CONFIG_OPTIONS : +# $ CONFIG_OPTIONS="--ipv6 --igd2" make +# + +CFLAGS ?= -pipe -Os +#CFLAGS = -pipe -O -g -DDEBUG +CFLAGS += -ansi +CFLAGS += -Wall +CFLAGS += -W +CFLAGS += -Wstrict-prototypes +#CFLAGS += -Wdeclaration-after-statement +#CFLAGS += -Wno-missing-field-initializers +CFLAGS += -fno-common CC ?= gcc RM = rm -f MV = mv @@ -24,6 +42,7 @@ FWNAME = ipf .endif # better way to find if we are using ipf or pf +.if defined(/etc/rc.subr) && defined(/etc/rc.conf) .if $(OSNAME) == "FreeBSD" FWNAME != . /etc/rc.subr; . /etc/rc.conf; \ if checkyesno ipfilter_enable; then \ @@ -41,7 +60,12 @@ FWNAME != . /etc/rc.subr; . /etc/rc.conf; \ if chechyesno ipfilter; then \ echo "ipf"; else echo "pf"; fi .endif +.endif +.if $(OSNAME) == "Darwin" +FWNAME = ipfw +.endif + # Solaris specific CFLAGS .if $(OSNAME) == "SunOS" CFLAGS += -DSOLARIS2=`uname -r | cut -d. -f2` @@ -55,41 +79,52 @@ CFLAGS += -m64 -mcmodel=medlow STDOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \ upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \ options.o upnppermissions.o minissdp.o natpmp.o \ - upnpevents.o -BSDOBJS = bsd/getifstats.o -SUNOSOBJS = solaris/getifstats.o -PFOBJS = pf/obsdrdr.o + upnpevents.o upnputils.o getconnstatus.o \ + upnppinhole.o +BSDOBJS = bsd/getifstats.o bsd/ifacewatcher.o bsd/getroute.o +SUNOSOBJS = solaris/getifstats.o bsd/ifacewatcher.o bsd/getroute.o +MACOBJS = mac/getifstats.o bsd/ifacewatcher.o bsd/getroute.o +PFOBJS = pf/obsdrdr.o pf/pfpinhole.o IPFOBJS = ipf/ipfrdr.o +IPFWOBJS = ipfw/ipfwrdr.o ipfw/ipfwaux.o MISCOBJS = upnpreplyparse.o minixml.o ALLOBJS = $(STDOBJS) $(MISCOBJS) .if $(OSNAME) == "SunOS" ALLOBJS += $(SUNOSOBJS) +TESTGETIFSTATSOBJS = testgetifstats.o solaris/getifstats.o +TESTGETROUTEOBJS = testgetroute.o upnputils.o bsd/getroute.o +.elif $(OSNAME) == "Darwin" +ALLOBJS += $(MACOBJS) +TESTGETIFSTATSOBJS = testgetifstats.o mac/getifstats.o +TESTGETROUTEOBJS = testgetroute.o upnputils.o bsd/getroute.o .else ALLOBJS += $(BSDOBJS) +TESTGETIFSTATSOBJS = testgetifstats.o bsd/getifstats.o +TESTGETROUTEOBJS = testgetroute.o upnputils.o bsd/getroute.o .endif .if $(FWNAME) == "pf" ALLOBJS += $(PFOBJS) +.elif $(FWNAME) == "ipfw" +ALLOBJS += $(IPFWOBJS) .else ALLOBJS += $(IPFOBJS) .endif TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o -.if $(OSNAME) == "SunOS" -TESTGETIFSTATSOBJS = testgetifstats.o solaris/getifstats.o -.else -TESTGETIFSTATSOBJS = testgetifstats.o bsd/getifstats.o -.endif TESTUPNPPERMISSIONSOBJS = testupnppermissions.o upnppermissions.o TESTGETIFADDROBJS = testgetifaddr.o getifaddr.o MINIUPNPDCTLOBJS = miniupnpdctl.o EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \ testupnppermissions miniupnpdctl \ - testgetifaddr - + testgetifaddr testgetroute +.if $(OSNAME) == "Darwin" +LIBS = +.else LIBS = -lkvm +.endif .if $(OSNAME) == "SunOS" LIBS += -lsocket -lnsl -lkstat -lresolv .endif @@ -104,11 +139,11 @@ INSTALLMANDIR = /usr/share/man all: $(EXECUTABLES) clean: - $(RM) $(STDOBJS) $(BSDOBJS) $(SUNOSOBJS) $(EXECUTABLES) \ + $(RM) $(STDOBJS) $(BSDOBJS) $(SUNOSOBJS) $(MACOBJS) $(EXECUTABLES) \ testupnpdescgen.o \ $(MISCOBJS) config.h testgetifstats.o testupnppermissions.o \ - miniupnpdctl.o testgetifaddr.o \ - $(PFOBJS) $(IPFOBJS) + miniupnpdctl.o testgetifaddr.o testgetroute.o \ + $(PFOBJS) $(IPFOBJS) $(IPFWOBJS) install: miniupnpd genuuid $(STRIP) miniupnpd @@ -118,7 +153,7 @@ install: miniupnpd genuuid $(INSTALL) -b miniupnpd.conf $(DESTDIR)$(INSTALLETCDIR) # TODO : install man page correctly # $(INSTALL) -d $(INSTALLMANDIR) -# $(INSTALL) miniupnpd.1 $(INSTALLMANDIR)/cat1/miniupnpd.0 +# $(INSTALL) miniupnpd.8 $(INSTALLMANDIR)/cat8/miniupnpd.0 # genuuid is using the uuid cli tool available under OpenBSD 4.0 in # the uuid-1.5.0 package @@ -132,12 +167,13 @@ UUID != if which uuidgen 2>&1 > /dev/null; then \ genuuid: $(MV) miniupnpd.conf miniupnpd.conf.before - sed -e "s/^uuid=[-0-9a-f]*/uuid=$(UUID)/" miniupnpd.conf.before > miniupnpd.conf + sed -e "s/^uuid=[-0-9a-fA-F]*/uuid=$(UUID)/" miniupnpd.conf.before > miniupnpd.conf $(RM) miniupnpd.conf.before depend: config.h mkdep $(ALLOBJS:.o=.c) testupnpdescgen.c testgetifstats.c \ - testupnppermissions.c miniupnpdctl.c testgetifaddr.c + testupnppermissions.c miniupnpdctl.c testgetifaddr.c \ + testgetroute.c miniupnpd: config.h $(ALLOBJS) $(CC) $(CFLAGS) -o $@ $(ALLOBJS) $(LIBS) @@ -160,13 +196,16 @@ testgetifaddr: config.h $(TESTGETIFADDROBJS) testupnppermissions: config.h $(TESTUPNPPERMISSIONSOBJS) $(CC) $(CFLAGS) -o $@ $(TESTUPNPPERMISSIONSOBJS) +testgetroute: config.h $(TESTGETROUTEOBJS) + $(CC) $(CFLAGS) -o $@ $(TESTGETROUTEOBJS) + # gmake : # $(CC) $(CFLAGS) -o $@ $^ # BSDmake : # $(CC) $(CFLAGS) -o $@ $> -config.h: genconfig.sh - ./genconfig.sh +config.h: genconfig.sh VERSION + ./genconfig.sh $(CONFIG_OPTIONS) .SUFFIXES: .o .c .c.o: @@ -174,4 +213,4 @@ config.h: genconfig.sh # $(CC) $(CFLAGS) -c -o $(.TARGET) $(.IMPSRC) - +