1: # MiniUPnP project
2: # http://miniupnp.free.fr/
3: # Author: Thomas Bernard
4: # This Makefile should work for MacOSX
5: #
6: # To install use :
7: # $ PREFIX=/dummyinstalldir make -f Makefile.macosx install
8: # or :
9: # $ make -f Makefile.macosx install
10: #
11: CFLAGS = -Wall -O -g3 -DDEBUG
12: #CFLAGS = -Wall -Os
13: CC = gcc
14: RM = rm -f
15: MV = mv
16: INSTALL = install
17: STRIP = strip
18:
19: # OSNAME and FWNAME are used for building OS or FW dependent code.
20: OSNAME = $(shell uname)
21: ARCH = $(shell uname -p)
22: FWNAME = ipfw
23:
24: STD_OBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \
25: upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \
26: options.o upnppermissions.o minissdp.o natpmp.o \
27: upnpevents.o getconnstatus.o upnputils.o
28: MAC_OBJS = mac/getifstats.o bsd/ifacewatcher.o
29: IPFW_OBJS = ipfw/ipfwrdr.o ipfw/ipfwaux.o
30: MISC_OBJS = upnpreplyparse.o minixml.o
31:
32: ALL_OBJS = $(STD_OBJS) $(MISC_OBJS) $(MAC_OBJS) $(IPFW_OBJS)
33:
34: TEST_UPNPDESCGEN_OBJS = testupnpdescgen.o upnpdescgen.o
35: TEST_GETIFSTATS_OBJS = testgetifstats.o mac/getifstats.o
36: TEST_UPNPPERMISSIONS_OBJS = testupnppermissions.o upnppermissions.o
37: TEST_GETIFADDR_OBJS = testgetifaddr.o getifaddr.o
38: MINIUPNPDCTL_OBJS = miniupnpdctl.o
39:
40: EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
41: testupnppermissions miniupnpdctl \
42: testgetifaddr
43:
44: LIBS =
45:
46: # set PREFIX variable to install in the wanted place
47:
48: INSTALL_BINDIR = $(PREFIX)/sbin
49: INSTALL_ETCDIR = $(PREFIX)/etc/miniupnpd
50: INSTALL_MANDIR = $(PREFIX)/share/man/man8
51:
52: all: $(EXECUTABLES)
53:
54: clean:
55: $(RM) $(ALL_OBJS) $(EXECUTABLES) \
56: testupnpdescgen.o testgetifstats.o testupnppermissions.o \
57: miniupnpdctl.o testgetifaddr.o config.h \
58: mac/org.tuxfamily.miniupnpd.plist
59:
60: install: miniupnpd genuuid genlaunchd
61: $(STRIP) miniupnpd
62: $(INSTALL) -d $(INSTALL_BINDIR)
63: $(INSTALL) miniupnpd $(INSTALL_BINDIR)
64: $(INSTALL) -d $(INSTALL_ETCDIR)
65: $(INSTALL) -m 0644 -b miniupnpd.conf $(INSTALL_ETCDIR)
66: $(INSTALL) -d $(INSTALL_MANDIR)
67: $(INSTALL) miniupnpd.8 $(INSTALL_MANDIR)
68: $(INSTALL) -d $(PREFIX)/Library/LaunchDaemons
69: $(INSTALL) mac/org.tuxfamily.miniupnpd.plist $(PREFIX)/Library/LaunchDaemons
70: #$(INSTALL) ipfw/ipfw_init.sh $(INSTALL_ETCDIR)
71: #$(INSTALL) ipfw/ipfw_removeall.sh $(INSTALL_ETCDIR)
72:
73: genuuid:
74: $(MV) miniupnpd.conf miniupnpd.conf.before
75: sed -e "s/^uuid=[-0-9a-fA-F]*/uuid=`uuidgen 2>/dev/null`/" miniupnpd.conf.before > miniupnpd.conf
76: $(RM) miniupnpd.conf.before
77:
78: genlaunchd:
79: sed -e "s|INSTALLPREFIX|$(PREFIX)|g" mac/org.tuxfamily.miniupnpd.plist.before > mac/org.tuxfamily.miniupnpd.plist
80:
81: depend: config.h
82: mkdep $(ALL_OBJS:.o=.c) testupnpdescgen.c testgetifstats.c \
83: testupnppermissions.c miniupnpdctl.c testgetifaddr.c
84:
85: miniupnpd: config.h $(ALL_OBJS)
86: $(CC) $(CFLAGS) -o $@ $(ALL_OBJS) $(LIBS)
87:
88: miniupnpdctl: config.h $(MINIUPNPDCTL_OBJS)
89: $(CC) $(CFLAGS) -o $@ $(MINIUPNPDCTL_OBJS)
90:
91: testupnpdescgen: config.h $(TEST_UPNPDESCGEN_OBJS)
92: $(CC) $(CFLAGS) -o $@ $(TEST_UPNPDESCGEN_OBJS)
93:
94: testgetifstats: config.h $(TEST_GETIFSTATS_OBJS)
95: $(CC) $(CFLAGS) -o $@ $(TEST_GETIFSTATS_OBJS) $(LIBS)
96:
97: testgetifaddr: config.h $(TEST_GETIFADDR_OBJS)
98: $(CC) $(CFLAGS) -o $@ $(TEST_GETIFADDR_OBJS)
99:
100: testupnppermissions: config.h $(TEST_UPNPPERMISSIONS_OBJS)
101: $(CC) $(CFLAGS) -o $@ $(TEST_UPNPPERMISSIONS_OBJS)
102:
103:
104: config.h: genconfig.sh
105: ./genconfig.sh
106:
107: .SUFFIXES: .o .c
108: .c.o:
109: $(CC) $(CFLAGS) -c -o $@ $<
110: # $(CC) $(CFLAGS) -c -o $(.TARGET) $(.IMPSRC)
111:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>