Annotation of embedaddon/miniupnpd/Makefile, revision 1.1.1.2
1.1.1.2 ! misho 1: # $Id: Makefile,v 1.59 2011/05/26 22:47:32 nanard Exp $
1.1 misho 2: # MiniUPnP project
1.1.1.2 ! misho 3: # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
1.1 misho 4: # Author: Thomas Bernard
1.1.1.2 ! misho 5: #
! 6: # Makefile for miniupnpd (MiniUPnP daemon)
! 7: #
! 8: # This Makefile should work for *BSD and SunOS/Solaris.
! 9: # On Mac OS X, use "bsdmake" to build.
! 10: # This Makefile is NOT compatible with GNU Make.
! 11: # Linux users, please use Makefile.linux :
! 12: # make -f Makefile.linux
! 13:
! 14: CFLAGS += -pipe -Wall
! 15: #CFLAGS = -pipe -Wall -O -g -DDEBUG
1.1 misho 16: CC ?= gcc
17: RM = rm -f
18: MV = mv
19: INSTALL = install
20: STRIP = strip
21:
22: # OSNAME and FWNAME are used for building OS or FW dependent code.
23: OSNAME != uname -s
24: ARCH != uname -m
25: .ifndef FWNAME
26: .if exists(/usr/include/net/pfvar.h)
27: FWNAME = pf
28: .else
29: FWNAME = ipf
30: .endif
31: .endif
32:
33: # better way to find if we are using ipf or pf
34: .if $(OSNAME) == "FreeBSD"
1.1.1.2 ! misho 35: .if defined(/etc/rc.subr) && defined(/etc/rc.conf)
1.1 misho 36: FWNAME != . /etc/rc.subr; . /etc/rc.conf; \
37: if checkyesno ipfilter_enable; then \
38: echo "ipf"; else echo "pf"; fi
39: .endif
1.1.1.2 ! misho 40: .endif
1.1 misho 41:
42: .if $(OSNAME) == "NetBSD"
43: FWNAME != . /etc/rc.subr; . /etc/rc.conf; \
44: if checkyesno ipfilter; then \
45: echo "ipf"; else echo "pf"; fi
46: .endif
47:
48: .if $(OSNAME) == "DragonFly"
49: FWNAME != . /etc/rc.subr; . /etc/rc.conf; \
50: if chechyesno ipfilter; then \
51: echo "ipf"; else echo "pf"; fi
52: .endif
53:
1.1.1.2 ! misho 54: .if $(OSNAME) == "Darwin"
! 55: FWNAME = ipfw
! 56: .endif
! 57:
1.1 misho 58: # Solaris specific CFLAGS
59: .if $(OSNAME) == "SunOS"
60: CFLAGS += -DSOLARIS2=`uname -r | cut -d. -f2`
61: .if $(ARCH) == "amd64"
62: CFLAGS += -m64 -mcmodel=kernel -mno-red-zone -ffreestanding
63: .elif $(ARCH) == "sparc64"
64: CFLAGS += -m64 -mcmodel=medlow
65: .endif
66: .endif
67:
68: STDOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \
69: upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \
70: options.o upnppermissions.o minissdp.o natpmp.o \
1.1.1.2 ! misho 71: upnpevents.o upnputils.o getconnstatus.o
! 72: BSDOBJS = bsd/getifstats.o bsd/ifacewatcher.o
! 73: SUNOSOBJS = solaris/getifstats.o bsd/ifacewatcher.o
! 74: MACOBJS = mac/getifstats.o bsd/ifacewatcher.o
1.1 misho 75: PFOBJS = pf/obsdrdr.o
76: IPFOBJS = ipf/ipfrdr.o
1.1.1.2 ! misho 77: IPFWOBJS = ipfw/ipfwrdr.o
1.1 misho 78: MISCOBJS = upnpreplyparse.o minixml.o
79:
80: ALLOBJS = $(STDOBJS) $(MISCOBJS)
81: .if $(OSNAME) == "SunOS"
82: ALLOBJS += $(SUNOSOBJS)
1.1.1.2 ! misho 83: TESTGETIFSTATSOBJS = testgetifstats.o solaris/getifstats.o
! 84: .elif $(OSNAME) == "Darwin"
! 85: ALLOBJS += $(MACOBJS)
! 86: TESTGETIFSTATSOBJS = testgetifstats.o mac/getifstats.o
1.1 misho 87: .else
88: ALLOBJS += $(BSDOBJS)
1.1.1.2 ! misho 89: TESTGETIFSTATSOBJS = testgetifstats.o bsd/getifstats.o
1.1 misho 90: .endif
91:
92: .if $(FWNAME) == "pf"
93: ALLOBJS += $(PFOBJS)
1.1.1.2 ! misho 94: .elif $(FWNAME) == "ipfw"
! 95: ALLOBJS += $(IPFWOBJS)
1.1 misho 96: .else
97: ALLOBJS += $(IPFOBJS)
98: .endif
99:
100: TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
101: TESTUPNPPERMISSIONSOBJS = testupnppermissions.o upnppermissions.o
102: TESTGETIFADDROBJS = testgetifaddr.o getifaddr.o
103: MINIUPNPDCTLOBJS = miniupnpdctl.o
104:
105: EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
106: testupnppermissions miniupnpdctl \
107: testgetifaddr
1.1.1.2 ! misho 108: .if $(OSNAME) == "Darwin"
! 109: LIBS =
! 110: .else
1.1 misho 111: LIBS = -lkvm
1.1.1.2 ! misho 112: .endif
1.1 misho 113: .if $(OSNAME) == "SunOS"
114: LIBS += -lsocket -lnsl -lkstat -lresolv
115: .endif
116:
117: # set PREFIX variable to install in the wanted place
118:
119: INSTALLBINDIR = $(PREFIX)/sbin
120: INSTALLETCDIR = $(PREFIX)/etc
121: # INSTALLMANDIR = $(PREFIX)/man
122: INSTALLMANDIR = /usr/share/man
123:
124: all: $(EXECUTABLES)
125:
126: clean:
1.1.1.2 ! misho 127: $(RM) $(STDOBJS) $(BSDOBJS) $(SUNOSOBJS) $(MACOBJS) $(EXECUTABLES) \
1.1 misho 128: testupnpdescgen.o \
129: $(MISCOBJS) config.h testgetifstats.o testupnppermissions.o \
130: miniupnpdctl.o testgetifaddr.o \
1.1.1.2 ! misho 131: $(PFOBJS) $(IPFOBJS) $(IPFWOBJS)
1.1 misho 132:
133: install: miniupnpd genuuid
134: $(STRIP) miniupnpd
135: $(INSTALL) -d $(DESTDIR)$(INSTALLBINDIR)
136: $(INSTALL) -m 555 miniupnpd $(DESTDIR)$(INSTALLBINDIR)
137: $(INSTALL) -d $(DESTDIR)$(INSTALLETCDIR)
138: $(INSTALL) -b miniupnpd.conf $(DESTDIR)$(INSTALLETCDIR)
139: # TODO : install man page correctly
140: # $(INSTALL) -d $(INSTALLMANDIR)
141: # $(INSTALL) miniupnpd.1 $(INSTALLMANDIR)/cat1/miniupnpd.0
142:
143: # genuuid is using the uuid cli tool available under OpenBSD 4.0 in
144: # the uuid-1.5.0 package
145: # any other cli tool returning a uuid on stdout should work.
146: UUID != if which uuidgen 2>&1 > /dev/null; then \
147: echo `uuidgen` ; \
148: elif which uuid 2>&1 > /dev/null; then \
149: echo `uuid` ; \
150: else echo "00000000-0000-0000-0000-000000000000"; \
151: fi
152:
153: genuuid:
154: $(MV) miniupnpd.conf miniupnpd.conf.before
1.1.1.2 ! misho 155: sed -e "s/^uuid=[-0-9a-fA-F]*/uuid=$(UUID)/" miniupnpd.conf.before > miniupnpd.conf
1.1 misho 156: $(RM) miniupnpd.conf.before
157:
158: depend: config.h
159: mkdep $(ALLOBJS:.o=.c) testupnpdescgen.c testgetifstats.c \
160: testupnppermissions.c miniupnpdctl.c testgetifaddr.c
161:
162: miniupnpd: config.h $(ALLOBJS)
163: $(CC) $(CFLAGS) -o $@ $(ALLOBJS) $(LIBS)
164:
165: # BSDmake :
166: # $(CC) $(CFLAGS) -o $@ $> $(LIBS)
167:
168: miniupnpdctl: config.h $(MINIUPNPDCTLOBJS)
169: $(CC) $(CFLAGS) -o $@ $(MINIUPNPDCTLOBJS)
170:
171: testupnpdescgen: config.h $(TESTUPNPDESCGENOBJS)
172: $(CC) $(CFLAGS) -o $@ $(TESTUPNPDESCGENOBJS)
173:
174: testgetifstats: config.h $(TESTGETIFSTATSOBJS)
175: $(CC) $(CFLAGS) -o $@ $(TESTGETIFSTATSOBJS) $(LIBS)
176:
177: testgetifaddr: config.h $(TESTGETIFADDROBJS)
178: $(CC) $(CFLAGS) -o $@ $(TESTGETIFADDROBJS)
179:
180: testupnppermissions: config.h $(TESTUPNPPERMISSIONSOBJS)
181: $(CC) $(CFLAGS) -o $@ $(TESTUPNPPERMISSIONSOBJS)
182:
183: # gmake :
184: # $(CC) $(CFLAGS) -o $@ $^
185: # BSDmake :
186: # $(CC) $(CFLAGS) -o $@ $>
187:
188: config.h: genconfig.sh
189: ./genconfig.sh
190:
191: .SUFFIXES: .o .c
192: .c.o:
193: $(CC) $(CFLAGS) -c -o $@ $<
194:
195: # $(CC) $(CFLAGS) -c -o $(.TARGET) $(.IMPSRC)
196:
197:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>