--- embedaddon/miniupnpd/Makefile 2012/02/21 23:16:02 1.1.1.1 +++ embedaddon/miniupnpd/Makefile 2012/05/29 12:55:57 1.1.1.2 @@ -1,11 +1,18 @@ -# $Id: Makefile,v 1.1.1.1 2012/02/21 23:16:02 misho Exp $ +# $Id: Makefile,v 1.1.1.2 2012/05/29 12:55:57 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 + +CFLAGS += -pipe -Wall +#CFLAGS = -pipe -Wall -O -g -DDEBUG CC ?= gcc RM = rm -f MV = mv @@ -25,10 +32,12 @@ FWNAME = ipf # better way to find if we are using ipf or pf .if $(OSNAME) == "FreeBSD" +.if defined(/etc/rc.subr) && defined(/etc/rc.conf) FWNAME != . /etc/rc.subr; . /etc/rc.conf; \ if checkyesno ipfilter_enable; then \ echo "ipf"; else echo "pf"; fi .endif +.endif .if $(OSNAME) == "NetBSD" FWNAME != . /etc/rc.subr; . /etc/rc.conf; \ @@ -42,6 +51,10 @@ FWNAME != . /etc/rc.subr; . /etc/rc.conf; \ echo "ipf"; else echo "pf"; fi .endif +.if $(OSNAME) == "Darwin" +FWNAME = ipfw +.endif + # Solaris specific CFLAGS .if $(OSNAME) == "SunOS" CFLAGS += -DSOLARIS2=`uname -r | cut -d. -f2` @@ -55,32 +68,36 @@ 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 + upnpevents.o upnputils.o getconnstatus.o +BSDOBJS = bsd/getifstats.o bsd/ifacewatcher.o +SUNOSOBJS = solaris/getifstats.o bsd/ifacewatcher.o +MACOBJS = mac/getifstats.o bsd/ifacewatcher.o PFOBJS = pf/obsdrdr.o IPFOBJS = ipf/ipfrdr.o +IPFWOBJS = ipfw/ipfwrdr.o MISCOBJS = upnpreplyparse.o minixml.o ALLOBJS = $(STDOBJS) $(MISCOBJS) .if $(OSNAME) == "SunOS" ALLOBJS += $(SUNOSOBJS) +TESTGETIFSTATSOBJS = testgetifstats.o solaris/getifstats.o +.elif $(OSNAME) == "Darwin" +ALLOBJS += $(MACOBJS) +TESTGETIFSTATSOBJS = testgetifstats.o mac/getifstats.o .else ALLOBJS += $(BSDOBJS) +TESTGETIFSTATSOBJS = testgetifstats.o bsd/getifstats.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 @@ -88,8 +105,11 @@ MINIUPNPDCTLOBJS = miniupnpdctl.o EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \ testupnppermissions miniupnpdctl \ testgetifaddr - +.if $(OSNAME) == "Darwin" +LIBS = +.else LIBS = -lkvm +.endif .if $(OSNAME) == "SunOS" LIBS += -lsocket -lnsl -lkstat -lresolv .endif @@ -104,11 +124,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) + $(PFOBJS) $(IPFOBJS) $(IPFWOBJS) install: miniupnpd genuuid $(STRIP) miniupnpd @@ -132,7 +152,7 @@ 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