use DESTDIR for install targets

fix #026
thanks to rofl0r
This commit is contained in:
Thomas Bernard 2013-02-09 16:17:23 +01:00
parent 0b715512b2
commit 803899514e
2 changed files with 37 additions and 32 deletions

View File

@ -3,13 +3,13 @@
# http://miniupnp.free.fr/ # http://miniupnp.free.fr/
# http://miniupnp.tuxfamily.org/ # http://miniupnp.tuxfamily.org/
# https://github.com/miniupnp/miniupnp # https://github.com/miniupnp/miniupnp
# (c) 2005-2012 Thomas Bernard # (c) 2005-2013 Thomas Bernard
# to install use : # to install use :
# $ PREFIX=/tmp/dummylocation make install # $ make DESTDIR=/tmp/dummylocation install
# or # or
# $ INSTALLPREFIX=/usr/local make install # $ INSTALLPREFIX=/usr/local make install
# or # or
# make install (will go to /usr/bin, /usr/lib, etc...) # $ make install (default INSTALLPREFIX is /usr)
OS = $(shell uname -s) OS = $(shell uname -s)
VERSION = $(shell cat VERSION) VERSION = $(shell cat VERSION)
@ -177,31 +177,34 @@ updateversion: miniupnpc.h
sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < miniupnpc.h.bak > miniupnpc.h sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < miniupnpc.h.bak > miniupnpc.h
install: updateversion $(FILESTOINSTALL) install: updateversion $(FILESTOINSTALL)
$(INSTALL) -d $(INSTALLDIRINC) $(INSTALL) -d $(DESTDIR)$(INSTALLDIRINC)
$(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC) $(INSTALL) -m 644 $(HEADERS) $(DESTDIR)$(INSTALLDIRINC)
$(INSTALL) -d $(INSTALLDIRLIB) $(INSTALL) -d $(DESTDIR)$(INSTALLDIRLIB)
$(INSTALL) -m 644 $(LIBRARY) $(INSTALLDIRLIB) $(INSTALL) -m 644 $(LIBRARY) $(DESTDIR)$(INSTALLDIRLIB)
ifneq ($(OS), AmigaOS) ifneq ($(OS), AmigaOS)
$(INSTALL) -m 644 $(SHAREDLIBRARY) $(INSTALLDIRLIB)/$(SONAME) $(INSTALL) -m 644 $(SHAREDLIBRARY) $(DESTDIR)$(INSTALLDIRLIB)/$(SONAME)
ln -fs $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIBRARY) ln -fs $(SONAME) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIBRARY)
endif endif
$(INSTALL) -d $(INSTALLDIRBIN) $(INSTALL) -d $(DESTDIR)$(INSTALLDIRBIN)
ifeq ($(OS), AmigaOS) ifeq ($(OS), AmigaOS)
$(INSTALL) -m 755 upnpc-static $(INSTALLDIRBIN)/upnpc $(INSTALL) -m 755 upnpc-static $(DESTDIR)$(INSTALLDIRBIN)/upnpc
else else
$(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc $(INSTALL) -m 755 upnpc-shared $(DESTDIR)$(INSTALLDIRBIN)/upnpc
endif endif
$(INSTALL) -m 755 external-ip.sh $(INSTALLDIRBIN)/external-ip $(INSTALL) -m 755 external-ip.sh $(DESTDIR)$(INSTALLDIRBIN)/external-ip
ifneq ($(OS), AmigaOS) ifneq ($(OS), AmigaOS)
$(INSTALL) -d $(INSTALLDIRMAN)/man3 $(INSTALL) -d $(DESTDIR)$(INSTALLDIRMAN)/man3
$(INSTALL) man3/miniupnpc.3 $(INSTALLDIRMAN)/man3/miniupnpc.3 $(INSTALL) man3/miniupnpc.3 $(DESTDIR)$(INSTALLDIRMAN)/man3/miniupnpc.3
ifeq ($(OS), Linux)
gzip $(DESTDIR)$(INSTALLDIRMAN)/man3/miniupnpc.3
endif
endif endif
cleaninstall: cleaninstall:
$(RM) -r $(INSTALLDIRINC) $(RM) -r $(DESTDIR)$(INSTALLDIRINC)
$(RM) $(INSTALLDIRLIB)/$(LIBRARY) $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(LIBRARY)
$(RM) $(INSTALLDIRLIB)/$(SHAREDLIBRARY) $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIBRARY)
depend: depend:
makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null

View File

@ -1,6 +1,6 @@
# $Id: Makefile.linux,v 1.76 2013/02/07 15:56:10 nanard Exp $ # $Id: Makefile.linux,v 1.76 2013/02/07 15:56:10 nanard Exp $
# MiniUPnP project # MiniUPnP project
# (c) 2006-2012 Thomas Bernard # (c) 2006-2013 Thomas Bernard
# http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
# Author : Thomas Bernard # Author : Thomas Bernard
# for use with GNU Make # for use with GNU Make
@ -9,11 +9,12 @@
# $ CONFIG_OPTIONS="--ipv6 --igd2" make -f Makefile.linux # $ CONFIG_OPTIONS="--ipv6 --igd2" make -f Makefile.linux
# #
# To install use : # To install use :
# $ PREFIX=/dummyinstalldir make -f Makefile.linux install # $ DESTDIR=/dummyinstalldir make -f Makefile.linux install
# or : # or :
# $ INSTALLPREFIX=/usr/local make -f Makefile.linux install # $ INSTALLPREFIX=/usr/local make -f Makefile.linux install
# or : # or :
# $ make -f Makefile.linux install # $ make -f Makefile.linux install
# (default INSTALLPREFIX is /usr)
# #
# if your system hasn't iptables libiptc headers and binary correctly # if your system hasn't iptables libiptc headers and binary correctly
# installed, you need to get iptables sources from http://netfilter.org/ # installed, you need to get iptables sources from http://netfilter.org/
@ -140,18 +141,19 @@ install: miniupnpd miniupnpd.8 miniupnpd.conf genuuid \
netfilter/ip6tables_init.sh netfilter/ip6tables_removeall.sh \ netfilter/ip6tables_init.sh netfilter/ip6tables_removeall.sh \
linux/miniupnpd.init.d.script linux/miniupnpd.init.d.script
$(STRIP) miniupnpd $(STRIP) miniupnpd
$(INSTALL) -d $(SBININSTALLDIR) $(INSTALL) -d $(DESTDIR)$(SBININSTALLDIR)
$(INSTALL) miniupnpd $(SBININSTALLDIR) $(INSTALL) miniupnpd $(DESTDIR)$(SBININSTALLDIR)
$(INSTALL) -d $(ETCINSTALLDIR) $(INSTALL) -d $(DESTDIR)$(ETCINSTALLDIR)
$(INSTALL) netfilter/iptables_init.sh $(ETCINSTALLDIR) $(INSTALL) netfilter/iptables_init.sh $(DESTDIR)$(ETCINSTALLDIR)
$(INSTALL) netfilter/iptables_removeall.sh $(ETCINSTALLDIR) $(INSTALL) netfilter/iptables_removeall.sh $(DESTDIR)$(ETCINSTALLDIR)
$(INSTALL) netfilter/ip6tables_init.sh $(ETCINSTALLDIR) $(INSTALL) netfilter/ip6tables_init.sh $(DESTDIR)$(ETCINSTALLDIR)
$(INSTALL) netfilter/ip6tables_removeall.sh $(ETCINSTALLDIR) $(INSTALL) netfilter/ip6tables_removeall.sh $(DESTDIR)$(ETCINSTALLDIR)
$(INSTALL) --mode=0644 -b miniupnpd.conf $(ETCINSTALLDIR) $(INSTALL) --mode=0644 -b miniupnpd.conf $(DESTDIR)$(ETCINSTALLDIR)
$(INSTALL) -d $(PREFIX)/etc/init.d $(INSTALL) -d $(DESTDIR)$(PREFIX)/etc/init.d
$(INSTALL) linux/miniupnpd.init.d.script $(PREFIX)/etc/init.d/miniupnpd $(INSTALL) linux/miniupnpd.init.d.script $(DESTDIR)$(PREFIX)/etc/init.d/miniupnpd
$(INSTALL) miniupnpd.8 $(MANINSTALLDIR) $(INSTALL) -d $(DESTDIR)$(MANINSTALLDIR)
gzip $(MANINSTALLDIR)/miniupnpd.8 $(INSTALL) --mode=0644 miniupnpd.8 $(DESTDIR)$(MANINSTALLDIR)
gzip $(DESTDIR)$(MANINSTALLDIR)/miniupnpd.8
# genuuid is using the uuidgen CLI tool which is part of libuuid # genuuid is using the uuidgen CLI tool which is part of libuuid
# from the e2fsprogs # from the e2fsprogs