2018-02-23 14:00:18 +00:00
|
|
|
# $Id: Makefile,v 1.30 2018/02/23 13:59:44 nanard Exp $
|
2011-09-28 19:14:08 +00:00
|
|
|
# MiniUPnP project
|
|
|
|
# author: Thomas Bernard
|
|
|
|
# website: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
|
|
|
# for use with GNU Make (gmake)
|
|
|
|
# install with :
|
2021-09-30 21:12:33 +00:00
|
|
|
# $ DESTDIR=/tmp/dummylocation make install
|
2011-09-28 19:14:08 +00:00
|
|
|
# or
|
|
|
|
# $ INSTALLPREFIX=/usr/local make install
|
|
|
|
# or
|
|
|
|
# make install (miniupnpd will be put in /usr/sbin)
|
|
|
|
#
|
|
|
|
# install target is made for linux... sorry BSD users...
|
2014-11-28 16:38:54 +00:00
|
|
|
#CFLAGS = -g -O0
|
2012-05-08 21:06:14 +00:00
|
|
|
CFLAGS ?= -Os
|
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -W -Wstrict-prototypes
|
|
|
|
CFLAGS += -fno-strict-aliasing -fno-common
|
|
|
|
CFLAGS += -D_GNU_SOURCE
|
2016-11-11 13:48:35 +00:00
|
|
|
#CFLAGS += -ansi
|
2015-06-10 09:47:58 +00:00
|
|
|
CC ?= gcc
|
2011-09-28 19:14:08 +00:00
|
|
|
RM = rm -f
|
|
|
|
INSTALL = install
|
2018-02-02 17:46:34 +00:00
|
|
|
OS = $(shell $(CC) -dumpmachine)
|
2011-09-28 19:14:08 +00:00
|
|
|
|
2018-02-02 17:46:34 +00:00
|
|
|
ifneq (, $(findstring linux, $(OS)))
|
2014-11-28 16:38:54 +00:00
|
|
|
LDLIBS += -lnfnetlink
|
2018-02-01 11:09:09 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
|
2014-11-28 16:38:54 +00:00
|
|
|
LDLIBS += -lfreebsd-glue
|
2018-02-03 17:29:35 +00:00
|
|
|
else
|
|
|
|
ifneq (, $(findstring sun, $(OS)))
|
2016-11-11 13:51:57 +00:00
|
|
|
CFLAGS += -D_XOPEN_SOURCE
|
|
|
|
CFLAGS += -D_XOPEN_SOURCE_EXTENDED=1
|
|
|
|
CFLAGS += -D__EXTENSIONS__
|
|
|
|
LDFLAGS += -lsocket -lnsl -lresolv
|
|
|
|
endif
|
2018-02-03 17:29:35 +00:00
|
|
|
endif
|
2014-11-28 16:38:54 +00:00
|
|
|
|
2011-09-28 19:14:08 +00:00
|
|
|
#EXECUTABLES = minissdpd testminissdpd listifaces
|
2016-01-13 15:07:09 +00:00
|
|
|
EXECUTABLES = minissdpd testminissdpd testcodelength \
|
|
|
|
showminissdpdnotif
|
2014-11-28 16:38:54 +00:00
|
|
|
MINISSDPDOBJS = minissdpd.o openssdpsocket.o daemonize.o upnputils.o \
|
2014-12-05 16:35:34 +00:00
|
|
|
ifacewatch.o getroute.o getifaddr.o asyncsendto.o
|
2016-01-13 15:07:09 +00:00
|
|
|
TESTMINISSDPDOBJS = testminissdpd.o printresponse.o
|
|
|
|
SHOWMINISSDPDNOTIFOBJS = showminissdpdnotif.o printresponse.o
|
2011-09-28 19:14:08 +00:00
|
|
|
|
2016-01-13 15:07:09 +00:00
|
|
|
ALLOBJS = $(MINISSDPDOBJS) $(TESTMINISSDPDOBJS) \
|
|
|
|
$(SHOWMINISSDPDNOTIFOBJS) \
|
|
|
|
testcodelength.o
|
2011-09-28 19:14:08 +00:00
|
|
|
|
2021-09-30 21:12:33 +00:00
|
|
|
# install directories
|
|
|
|
ifeq ($(strip $(PREFIX)),)
|
|
|
|
INSTALLPREFIX ?= /usr
|
|
|
|
else
|
|
|
|
INSTALLPREFIX ?= $(PREFIX)
|
|
|
|
endif
|
2011-09-28 19:14:08 +00:00
|
|
|
SBININSTALLDIR = $(INSTALLPREFIX)/sbin
|
2011-12-31 19:06:17 +00:00
|
|
|
MANINSTALLDIR = $(INSTALLPREFIX)/share/man
|
|
|
|
|
2011-09-28 19:14:08 +00:00
|
|
|
|
2015-08-06 10:21:56 +00:00
|
|
|
.PHONY: all clean install depend check test
|
2011-09-28 19:14:08 +00:00
|
|
|
|
|
|
|
all: $(EXECUTABLES)
|
|
|
|
|
2015-08-06 10:21:56 +00:00
|
|
|
test: check
|
|
|
|
|
2011-09-28 19:14:08 +00:00
|
|
|
clean:
|
|
|
|
$(RM) $(ALLOBJS) $(EXECUTABLES)
|
|
|
|
|
|
|
|
install: minissdpd
|
2021-09-30 21:12:33 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(SBININSTALLDIR)
|
|
|
|
$(INSTALL) minissdpd $(DESTDIR)$(SBININSTALLDIR)
|
|
|
|
$(INSTALL) -d $(DESTDIR)$(MANINSTALLDIR)/man1
|
|
|
|
$(INSTALL) minissdpd.1 $(DESTDIR)$(MANINSTALLDIR)/man1/minissdpd.1
|
2018-02-02 17:46:34 +00:00
|
|
|
ifeq (, $(findstring darwin, $(OS)))
|
2021-09-30 21:12:33 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)/etc/init.d
|
|
|
|
$(INSTALL) minissdpd.init.d.script $(DESTDIR)/etc/init.d/minissdpd
|
2011-12-31 19:06:17 +00:00
|
|
|
endif
|
2011-09-28 19:14:08 +00:00
|
|
|
|
2015-09-10 13:32:25 +00:00
|
|
|
check: validateminissdpd validatecodelength
|
2015-08-06 10:21:56 +00:00
|
|
|
|
|
|
|
validateminissdpd: testminissdpd minissdpd
|
|
|
|
./testminissdpd.sh
|
|
|
|
touch $@
|
|
|
|
|
2015-09-10 13:32:25 +00:00
|
|
|
validatecodelength: testcodelength
|
|
|
|
./testcodelength
|
|
|
|
touch $@
|
|
|
|
|
2011-09-28 19:14:08 +00:00
|
|
|
minissdpd: $(MINISSDPDOBJS)
|
|
|
|
|
|
|
|
testminissdpd: $(TESTMINISSDPDOBJS)
|
|
|
|
|
2016-01-13 15:07:09 +00:00
|
|
|
showminissdpdnotif: $(SHOWMINISSDPDNOTIFOBJS)
|
|
|
|
|
2011-09-28 19:14:08 +00:00
|
|
|
testcodelength: testcodelength.o
|
|
|
|
|
2014-02-03 15:48:51 +00:00
|
|
|
listifaces: listifaces.o upnputils.o
|
|
|
|
|
2018-02-23 14:00:18 +00:00
|
|
|
config.h: VERSION
|
|
|
|
@tmp=`grep -n MINISSDPD_VERSION $@` ; \
|
|
|
|
line=`echo $$tmp | cut -d: -f1` ; \
|
|
|
|
old_version=`echo $$tmp | cut -d\\" -f2` ; \
|
|
|
|
new_version=`cat VERSION` ; \
|
|
|
|
if [ "$$new_version" != "$$old_version" ] ; then \
|
|
|
|
echo "updating VERSION in $@ from $$old_version to $$new_version"; \
|
|
|
|
sed "$${line}s/$${old_version}/$${new_version}/" $@ > $@.temp ; \
|
|
|
|
mv $@.temp $@ ; \
|
|
|
|
fi
|
|
|
|
|
2011-09-28 19:14:08 +00:00
|
|
|
depend:
|
|
|
|
makedepend -f$(MAKEFILE_LIST) -Y \
|
|
|
|
$(ALLOBJS:.o=.c) 2>/dev/null
|
|
|
|
|
|
|
|
# DO NOT DELETE
|
|
|
|
|
2014-11-28 16:38:54 +00:00
|
|
|
minissdpd.o: config.h getifaddr.h upnputils.h openssdpsocket.h
|
|
|
|
minissdpd.o: minissdpdtypes.h daemonize.h codelength.h ifacewatch.h
|
2014-12-06 11:06:13 +00:00
|
|
|
minissdpd.o: asyncsendto.h
|
2014-11-28 16:38:54 +00:00
|
|
|
openssdpsocket.o: config.h openssdpsocket.h minissdpdtypes.h upnputils.h
|
2011-09-28 19:14:08 +00:00
|
|
|
daemonize.o: daemonize.h config.h
|
2014-11-28 16:38:54 +00:00
|
|
|
upnputils.o: config.h upnputils.h getroute.h minissdpdtypes.h
|
|
|
|
ifacewatch.o: config.h openssdpsocket.h minissdpdtypes.h upnputils.h
|
|
|
|
getroute.o: getroute.h upnputils.h
|
|
|
|
getifaddr.o: config.h getifaddr.h
|
2014-12-06 11:06:13 +00:00
|
|
|
asyncsendto.o: asyncsendto.h upnputils.h
|
2016-01-13 15:07:09 +00:00
|
|
|
testminissdpd.o: codelength.h printresponse.h
|
|
|
|
printresponse.o: codelength.h
|
|
|
|
showminissdpdnotif.o: codelength.h printresponse.h
|
|
|
|
printresponse.o: codelength.h
|
2011-09-28 19:14:08 +00:00
|
|
|
testcodelength.o: codelength.h
|