Support DESTDIR

GNU coding standard recommends supporting DESTDIR in projects Makefiles. This
is already expected by many GNU/Linux distributions. This patch adds DESTDIR
support to sxiv Makefile.

Signed-off-by: Petr Sabata <psabata@redhat.com>
This commit is contained in:
Petr Sabata 2011-05-10 09:31:43 +02:00
parent fdafbf72b7
commit f3cd56e3d3

View file

@ -3,6 +3,7 @@ all: sxiv
VERSION=0.8.1 VERSION=0.8.1
CC?=gcc CC?=gcc
DESTDIR?=
PREFIX?=/usr/local PREFIX?=/usr/local
CFLAGS+= -Wall -pedantic -DVERSION=\"$(VERSION)\" CFLAGS+= -Wall -pedantic -DVERSION=\"$(VERSION)\"
LDFLAGS+= LDFLAGS+=
@ -18,10 +19,10 @@ sxiv: $(OBJFILES)
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
install: all install: all
install -D -m 755 -o root -g root sxiv $(PREFIX)/bin/sxiv install -D -m 755 -o root -g root sxiv ${DESTDIR}$(PREFIX)/bin/sxiv
mkdir -p $(PREFIX)/share/man/man1 mkdir -p ${DESTDIR}$(PREFIX)/share/man/man1
sed "s/VERSION/$(VERSION)/g" sxiv.1 > $(PREFIX)/share/man/man1/sxiv.1 sed "s/VERSION/$(VERSION)/g" sxiv.1 > ${DESTDIR}$(PREFIX)/share/man/man1/sxiv.1
chmod 644 $(PREFIX)/share/man/man1/sxiv.1 chmod 644 ${DESTDIR}$(PREFIX)/share/man/man1/sxiv.1
clean: clean:
rm -f sxiv *.o rm -f sxiv *.o