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