This commit is contained in:
Thomas Bernard 2012-01-02 11:36:05 +01:00
commit c29468dd05
4 changed files with 26 additions and 19 deletions

View File

@ -16,6 +16,7 @@ CFLAGS = -Wall -Os -D_GNU_SOURCE -fno-strict-aliasing -Wstrict-prototypes
CC = gcc
RM = rm -f
INSTALL = install
OS = $(shell uname -s)
#EXECUTABLES = minissdpd testminissdpd listifaces
EXECUTABLES = minissdpd testminissdpd testcodelength
@ -26,6 +27,8 @@ ALLOBJS = $(MINISSDPDOBJS) $(TESTMINISSDPDOBJS) testcodelength.o
INSTALLPREFIX ?= $(PREFIX)/usr
SBININSTALLDIR = $(INSTALLPREFIX)/sbin
MANINSTALLDIR = $(INSTALLPREFIX)/share/man
.PHONY: all clean install depend
@ -37,8 +40,12 @@ clean:
install: minissdpd
$(INSTALL) -d $(SBININSTALLDIR)
$(INSTALL) minissdpd $(SBININSTALLDIR)
$(INSTALL) -d $(MANINSTALLDIR)/man1
$(INSTALL) minissdpd.1 $(MANINSTALLDIR)/man1/minissdpd.1
ifneq ($(OS), Darwin)
$(INSTALL) -d $(PREFIX)/etc/init.d
$(INSTALL) minissdpd.init.d.script $(PREFIX)/etc/init.d/minissdpd
endif
minissdpd: $(MINISSDPDOBJS)
$(CC) $(CFLAGS) -o $@ $(MINISSDPDOBJS)

View File

@ -85,6 +85,7 @@ INSTALLPREFIX ?= $(PREFIX)/usr
INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
INSTALLDIRLIB = $(INSTALLPREFIX)/lib
INSTALLDIRBIN = $(INSTALLPREFIX)/bin
INSTALLDIRMAN = $(INSTALLPREFIX)/share/man
FILESTOINSTALL = $(LIBRARY) $(EXECUTABLES)
ifneq ($(OS), AmigaOS)
@ -142,6 +143,11 @@ else
$(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc
endif
$(INSTALL) -m 755 external-ip.sh $(INSTALLDIRBIN)/external-ip
ifneq ($(OS), AmigaOS)
$(INSTALL) -d $(INSTALLDIRMAN)/man3
$(INSTALL) man3/miniupnpc.3 $(INSTALLDIRMAN)/man3/miniupnpc.3
endif
cleaninstall:
$(RM) -r $(INSTALLDIRINC)

View File

@ -47,43 +47,37 @@ LIBS =
INSTALL_BINDIR = $(PREFIX)/sbin
INSTALL_ETCDIR = $(PREFIX)/etc/miniupnpd
# INSTALL_MANDIR = $(PREFIX)/man
INSTALL_MANDIR = /usr/share/man/man1
INSTALL_MANDIR = $(PREFIX)/share/man/man1
all: $(EXECUTABLES)
clean:
$(RM) $(ALL_OBJS) $(EXECUTABLES) \
testupnpdescgen.o testgetifstats.o testupnppermissions.o \
miniupnpdctl.o testgetifaddr.o config.h
miniupnpdctl.o testgetifaddr.o config.h \
mac/org.tuxfamily.miniupnpd.plist
install: miniupnpd genuuid
install: miniupnpd genuuid genlaunchd
$(STRIP) miniupnpd
$(INSTALL) -d $(INSTALL_BINDIR)
$(INSTALL) miniupnpd $(INSTALL_BINDIR)
$(INSTALL) -d $(INSTALL_ETCDIR)
$(INSTALL) ipfw/ipfw_init.sh $(INSTALL_ETCDIR)
$(INSTALL) ipfw/ipfw_removeall.sh $(INSTALL_ETCDIR)
$(INSTALL) --mode=0644 -b miniupnpd.conf $(INSTALL_ETCDIR)
$(INSTALL) -m 0644 -b miniupnpd.conf $(INSTALL_ETCDIR)
$(INSTALL) -d $(INSTALL_MANDIR)
$(INSTALL) miniupnpd.1 $(INSTALL_MANDIR)
# TODO Fix these paths and those within the plist
$(INSTALL) -d $(PREFIX)/Library/LaunchDaemons
$(INSTALL) mac/org.tuxfamily.miniupnpd.plist $(PREFIX)/Library/LaunchDaemons
# genuuid is using the uuid cli tool available under MacOSX
UUID != if which uuidgen 2>&1 > /dev/null; then \
echo `uuidgen` ; \
elif which uuid 2>&1 > /dev/null; then \
echo `uuid` ; \
else echo "00000000-0000-0000-0000-000000000000"; \
fi
#$(INSTALL) ipfw/ipfw_init.sh $(INSTALL_ETCDIR)
#$(INSTALL) ipfw/ipfw_removeall.sh $(INSTALL_ETCDIR)
genuuid:
$(MV) miniupnpd.conf miniupnpd.conf.before
sed -e "s/^uuid=[-0-9a-f]*/uuid=$(UUID)/" miniupnpd.conf.before > miniupnpd.conf
sed -e "s/^uuid=[-0-9a-fA-F]*/uuid=`uuidgen 2>/dev/null`/" miniupnpd.conf.before > miniupnpd.conf
$(RM) miniupnpd.conf.before
genlaunchd:
sed -e "s|INSTALLPREFIX|$(PREFIX)|g" mac/org.tuxfamily.miniupnpd.plist.before > mac/org.tuxfamily.miniupnpd.plist
depend: config.h
mkdep $(ALL_OBJS:.o=.c) testupnpdescgen.c testgetifstats.c \
testupnppermissions.c miniupnpdctl.c testgetifaddr.c

View File

@ -7,8 +7,8 @@
<string>org.tuxfamily.miniupnpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/miniupnpd</string>
<string>-f /etc/miniupnpd/miniupnpd.conf</string>
<string>INSTALLPREFIX/sbin/miniupnpd</string>
<string>-f INSTALLPREFIX/etc/miniupnpd/miniupnpd.conf</string>
</array>
<key>RunAtLoad</key>
<true/>