1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
# $Id: Makefile,v 1.31 2021/11/04 22:58:22 nanard Exp $
# MiniUPnP project
# author: Thomas Bernard
# website: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
# for use with GNU Make (gmake)
# install with :
# $ DESTDIR=/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
CFLAGS ?= -Os
CFLAGS += -Wall
CFLAGS += -W -Wstrict-prototypes
CFLAGS += -fno-strict-aliasing -fno-common
CFLAGS += -D_GNU_SOURCE
#CFLAGS += -ansi
CC ?= gcc
RM = rm -f
INSTALL = install
OS = $(shell $(CC) -dumpmachine)
ifneq (, $(findstring linux, $(OS)))
LDLIBS += -lnfnetlink
endif
ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
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
endif
#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
ALLOBJS = $(MINISSDPDOBJS) $(TESTMINISSDPDOBJS) \
$(SHOWMINISSDPDNOTIFOBJS) \
testcodelength.o
# install directories
ifeq ($(strip $(PREFIX)),)
INSTALLPREFIX ?= /usr
else
INSTALLPREFIX ?= $(PREFIX)
endif
SBININSTALLDIR = $(INSTALLPREFIX)/sbin
MANINSTALLDIR = $(INSTALLPREFIX)/share/man
.PHONY: all clean install depend check test
all: $(EXECUTABLES)
test: check
clean:
$(RM) $(ALLOBJS) $(EXECUTABLES)
install: minissdpd
$(INSTALL) -d $(DESTDIR)$(SBININSTALLDIR)
$(INSTALL) minissdpd $(DESTDIR)$(SBININSTALLDIR)
$(INSTALL) -d $(DESTDIR)$(MANINSTALLDIR)/man1
$(INSTALL) minissdpd.1 $(DESTDIR)$(MANINSTALLDIR)/man1/minissdpd.1
ifeq (, $(findstring darwin, $(OS)))
$(INSTALL) -d $(DESTDIR)/etc/init.d
$(INSTALL) minissdpd.init.d.script $(DESTDIR)/etc/init.d/minissdpd
endif
check: validateminissdpd validatecodelength
validateminissdpd: testminissdpd minissdpd
./testminissdpd.sh
touch $@
validatecodelength: testcodelength
./testcodelength
touch $@
minissdpd: $(MINISSDPDOBJS)
testminissdpd: $(TESTMINISSDPDOBJS)
showminissdpdnotif: $(SHOWMINISSDPDNOTIFOBJS)
testcodelength: testcodelength.o
listifaces: listifaces.o upnputils.o
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
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
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
testcodelength.o: codelength.h
|