miniupnp/minissdpd/Makefile

114 lines
3.1 KiB
Makefile
Raw Normal View History

2015-08-06 10:21:56 +00:00
# $Id: Makefile,v 1.25 2015/08/06 10:17:52 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 :
# $ PREFIX=/tmp/dummylocation make install
# 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...
#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
CC ?= gcc
2011-09-28 19:14:08 +00:00
RM = rm -f
INSTALL = install
OS = $(shell $(CC) -dumpmachine)
2011-09-28 19:14:08 +00:00
ifneq (, $(findstring linux, $(OS)))
LDLIBS += -lnfnetlink
else ifneq (, $(findstring freebsd, $(OS)))
LDLIBS += -lfreebsd-glue
else ifneq (, $(findstring sun, $(OS)))
CFLAGS += -D_XOPEN_SOURCE
CFLAGS += -D_XOPEN_SOURCE_EXTENDED=1
CFLAGS += -D__EXTENSIONS__
LDFLAGS += -lsocket -lnsl -lresolv
endif
2011-09-28 19:14:08 +00:00
#EXECUTABLES = minissdpd testminissdpd listifaces
EXECUTABLES = minissdpd testminissdpd testcodelength \
showminissdpdnotif
MINISSDPDOBJS = minissdpd.o openssdpsocket.o daemonize.o upnputils.o \
ifacewatch.o getroute.o getifaddr.o asyncsendto.o
TESTMINISSDPDOBJS = testminissdpd.o printresponse.o
SHOWMINISSDPDNOTIFOBJS = showminissdpdnotif.o printresponse.o
2011-09-28 19:14:08 +00:00
ALLOBJS = $(MINISSDPDOBJS) $(TESTMINISSDPDOBJS) \
$(SHOWMINISSDPDNOTIFOBJS) \
testcodelength.o
2011-09-28 19:14:08 +00:00
INSTALLPREFIX ?= $(PREFIX)/usr
SBININSTALLDIR = $(INSTALLPREFIX)/sbin
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
$(INSTALL) -d $(SBININSTALLDIR)
$(INSTALL) minissdpd $(SBININSTALLDIR)
$(INSTALL) -d $(MANINSTALLDIR)/man1
$(INSTALL) minissdpd.1 $(MANINSTALLDIR)/man1/minissdpd.1
ifeq (, $(findstring darwin, $(OS)))
2011-09-28 19:14:08 +00:00
$(INSTALL) -d $(PREFIX)/etc/init.d
$(INSTALL) minissdpd.init.d.script $(PREFIX)/etc/init.d/minissdpd
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)
showminissdpdnotif: $(SHOWMINISSDPDNOTIFOBJS)
2011-09-28 19:14:08 +00:00
testcodelength: testcodelength.o
listifaces: listifaces.o upnputils.o
2011-09-28 19:14:08 +00:00
depend:
makedepend -f$(MAKEFILE_LIST) -Y \
$(ALLOBJS:.o=.c) 2>/dev/null
# DO NOT DELETE
minissdpd.o: config.h getifaddr.h upnputils.h openssdpsocket.h
minissdpd.o: minissdpdtypes.h daemonize.h codelength.h ifacewatch.h
minissdpd.o: asyncsendto.h
openssdpsocket.o: config.h openssdpsocket.h minissdpdtypes.h upnputils.h
2011-09-28 19:14:08 +00:00
daemonize.o: daemonize.h config.h
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
asyncsendto.o: asyncsendto.h upnputils.h
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