From 1bce8f210428019f0e4165145c678bc2590ac729 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 16 Mar 2010 00:08:54 +0100 Subject: [PATCH] makefiles: support PREFIX and SYSCONFDIR --- Makefile | 18 +++++++++--------- common.mk | 6 ++++++ i3-input/Makefile | 4 ++-- i3-msg/Makefile | 4 ++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 8f44771e..9a4a52ea 100644 --- a/Makefile +++ b/Makefile @@ -56,15 +56,15 @@ src/cfgparse.y.o: src/cfgparse.y ${HEADERS} install: all echo "INSTALL" - $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin - $(INSTALL) -d -m 0755 $(DESTDIR)/etc/i3 - $(INSTALL) -d -m 0755 $(DESTDIR)/usr/include/i3 - $(INSTALL) -d -m 0755 $(DESTDIR)/usr/share/xsessions - $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/ - test -e $(DESTDIR)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)/etc/i3/config - $(INSTALL) -m 0644 i3.welcome $(DESTDIR)/etc/i3/welcome - $(INSTALL) -m 0644 i3.desktop $(DESTDIR)/usr/share/xsessions/ - $(INSTALL) -m 0644 include/i3/ipc.h $(DESTDIR)/usr/include/i3/ + $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin + $(INSTALL) -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/i3 + $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/include/i3 + $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/share/xsessions + $(INSTALL) -m 0755 i3 $(DESTDIR)$(PREFIX)/bin/ + test -e $(DESTDIR)$(SYSCONFDIR)/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)$(SYSCONFDIR)/i3/config + $(INSTALL) -m 0644 i3.welcome $(DESTDIR)$(SYSCONFDIR)/i3/welcome + $(INSTALL) -m 0644 i3.desktop $(DESTDIR)$(PREFIX)/share/xsessions/ + $(INSTALL) -m 0644 include/i3/ipc.h $(DESTDIR)$(PREFIX)/include/i3/ $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg install $(MAKE) TOPDIR=$(TOPDIR) -C i3-input install diff --git a/common.mk b/common.mk index b1940140..0334ac61 100644 --- a/common.mk +++ b/common.mk @@ -1,6 +1,12 @@ UNAME=$(shell uname) DEBUG=1 INSTALL=install +PREFIX=/usr +ifeq ($(PREFIX),/usr) +SYSCONFDIR=/etc +else +SYSCONFDIR=$(PREFIX)/etc +endif GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))" VERSION:=$(shell git describe --tags --abbrev=0) diff --git a/i3-input/Makefile b/i3-input/Makefile index c8881654..74f3f8da 100644 --- a/i3-input/Makefile +++ b/i3-input/Makefile @@ -18,8 +18,8 @@ all: ${FILES} install: all echo "INSTALL" - $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin - $(INSTALL) -m 0755 i3-input $(DESTDIR)/usr/bin/ + $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin + $(INSTALL) -m 0755 i3-input $(DESTDIR)$(PREFIX)/bin/ clean: rm -f *.o diff --git a/i3-msg/Makefile b/i3-msg/Makefile index ec4ba6e6..d75d807c 100644 --- a/i3-msg/Makefile +++ b/i3-msg/Makefile @@ -20,8 +20,8 @@ all: ${FILES} install: all echo "INSTALL" - $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin - $(INSTALL) -m 0755 i3-msg $(DESTDIR)/usr/bin/ + $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin + $(INSTALL) -m 0755 i3-msg $(DESTDIR)$(PREFIX)/bin/ clean: rm -f *.o -- 2.39.5