1: # $Id: Makefile,v 1.1.1.1 2023/09/27 11:25:11 misho Exp $
2: # MiniUPnP project
3: # author: Thomas Bernard
4: # website: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
5: # for use with GNU Make (gmake)
6: # install with :
7: # $ DESTDIR=/tmp/dummylocation make install
8: # or
9: # $ INSTALLPREFIX=/usr/local make install
10: # or
11: # make install (miniupnpd will be put in /usr/sbin)
12: #
13: # install target is made for linux... sorry BSD users...
14: #CFLAGS = -g -O0
15: CFLAGS ?= -Os
16: CFLAGS += -Wall
17: CFLAGS += -W -Wstrict-prototypes
18: CFLAGS += -fno-strict-aliasing -fno-common
19: CFLAGS += -D_GNU_SOURCE
20: #CFLAGS += -ansi
21: CC ?= gcc
22: RM = rm -f
23: INSTALL = install
24: OS = $(shell $(CC) -dumpmachine)
25:
26: ifneq (, $(findstring linux, $(OS)))
27: LDLIBS += -lnfnetlink
28: endif
29: ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
30: LDLIBS += -lfreebsd-glue
31: else
32: ifneq (, $(findstring sun, $(OS)))
33: CFLAGS += -D_XOPEN_SOURCE
34: CFLAGS += -D_XOPEN_SOURCE_EXTENDED=1
35: CFLAGS += -D__EXTENSIONS__
36: LDFLAGS += -lsocket -lnsl -lresolv
37: endif
38: endif
39:
40: #EXECUTABLES = minissdpd testminissdpd listifaces
41: EXECUTABLES = minissdpd testminissdpd testcodelength \
42: showminissdpdnotif
43: MINISSDPDOBJS = minissdpd.o openssdpsocket.o daemonize.o upnputils.o \
44: ifacewatch.o getroute.o getifaddr.o asyncsendto.o
45: TESTMINISSDPDOBJS = testminissdpd.o printresponse.o
46: SHOWMINISSDPDNOTIFOBJS = showminissdpdnotif.o printresponse.o
47:
48: ALLOBJS = $(MINISSDPDOBJS) $(TESTMINISSDPDOBJS) \
49: $(SHOWMINISSDPDNOTIFOBJS) \
50: testcodelength.o
51:
52: # install directories
53: ifeq ($(strip $(PREFIX)),)
54: INSTALLPREFIX ?= /usr
55: else
56: INSTALLPREFIX ?= $(PREFIX)
57: endif
58: SBININSTALLDIR = $(INSTALLPREFIX)/sbin
59: MANINSTALLDIR = $(INSTALLPREFIX)/share/man
60:
61:
62: .PHONY: all clean install depend check test
63:
64: all: $(EXECUTABLES)
65:
66: test: check
67:
68: clean:
69: $(RM) $(ALLOBJS) $(EXECUTABLES)
70:
71: install: minissdpd
72: $(INSTALL) -d $(DESTDIR)$(SBININSTALLDIR)
73: $(INSTALL) minissdpd $(DESTDIR)$(SBININSTALLDIR)
74: $(INSTALL) -d $(DESTDIR)$(MANINSTALLDIR)/man1
75: $(INSTALL) minissdpd.1 $(DESTDIR)$(MANINSTALLDIR)/man1/minissdpd.1
76: ifeq (, $(findstring darwin, $(OS)))
77: $(INSTALL) -d $(DESTDIR)/etc/init.d
78: $(INSTALL) minissdpd.init.d.script $(DESTDIR)/etc/init.d/minissdpd
79: endif
80:
81: check: validateminissdpd validatecodelength
82:
83: validateminissdpd: testminissdpd minissdpd
84: ./testminissdpd.sh
85: touch $@
86:
87: validatecodelength: testcodelength
88: ./testcodelength
89: touch $@
90:
91: minissdpd: $(MINISSDPDOBJS)
92:
93: testminissdpd: $(TESTMINISSDPDOBJS)
94:
95: showminissdpdnotif: $(SHOWMINISSDPDNOTIFOBJS)
96:
97: testcodelength: testcodelength.o
98:
99: listifaces: listifaces.o upnputils.o
100:
101: config.h: VERSION
102: @tmp=`grep -n MINISSDPD_VERSION $@` ; \
103: line=`echo $$tmp | cut -d: -f1` ; \
104: old_version=`echo $$tmp | cut -d\\" -f2` ; \
105: new_version=`cat VERSION` ; \
106: if [ "$$new_version" != "$$old_version" ] ; then \
107: echo "updating VERSION in $@ from $$old_version to $$new_version"; \
108: sed "$${line}s/$${old_version}/$${new_version}/" $@ > $@.temp ; \
109: mv $@.temp $@ ; \
110: fi
111:
112: depend:
113: makedepend -f$(MAKEFILE_LIST) -Y \
114: $(ALLOBJS:.o=.c) 2>/dev/null
115:
116: # DO NOT DELETE
117:
118: minissdpd.o: config.h getifaddr.h upnputils.h openssdpsocket.h
119: minissdpd.o: minissdpdtypes.h daemonize.h codelength.h ifacewatch.h
120: minissdpd.o: asyncsendto.h
121: openssdpsocket.o: config.h openssdpsocket.h minissdpdtypes.h upnputils.h
122: daemonize.o: daemonize.h config.h
123: upnputils.o: config.h upnputils.h getroute.h minissdpdtypes.h
124: ifacewatch.o: config.h openssdpsocket.h minissdpdtypes.h upnputils.h
125: getroute.o: getroute.h upnputils.h
126: getifaddr.o: config.h getifaddr.h
127: asyncsendto.o: asyncsendto.h upnputils.h
128: testminissdpd.o: codelength.h printresponse.h
129: printresponse.o: codelength.h
130: showminissdpdnotif.o: codelength.h printresponse.h
131: printresponse.o: codelength.h
132: testcodelength.o: codelength.h
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>