summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-04-22 17:21:01 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-04-22 17:21:01 +0200
commit37496853cd98e546142c1bef8deaecb78e8db8a2 (patch)
tree64107e00fa46b4b77fd4e71dbdbbae30079eb430
parent3130514bd99bdc4cf8a51e24be2d8bf6f1e47f62 (diff)
Fix DESTDIR support
Adding $(DESTDIR) to paths in config.make.in brings redundant additions when e.g. datarootdir is "${datadir}". The viable way is to just fix the installation rules. * Makeconf (install, install-headers): Prepend $(DESTDIR) to dependencies. ($(DESTDIR)$(installationdir)): New rule. ($(addprefix $(installationdir)/,$(installable))): Prepend $(DESTDIR). ($($(includedir)/$(installhdrsubdir))): Likewise. ($(addprefix $(libdir)/$(libname),_p.a .a _pic.a)): Likewise. ($(libdir)/$(libname).so.$(hurd-version)): Likewise. ($(libdir)/$(libname).so): Likewise. ($(addprefix $(includedir)/$(installhdrsubdir)/,$(installhdrs))): Likewise. ($(installationdirlist)): Likewise. * config.make.in (hurddir, libdir, bindir, sbindir, includedir, libexecdir, bootdir, infodir, sysconfdir, localstatedir, sharedstatedir, datadir, datarootdir): Remove $(DESTDIR). * config/Makefile (install): Prepend $(DESTDIR) to dependencies. ($(sysconfdir)/login): Prepend $(DESTDIR). ($(installed_logins)): Likewise. ($(installed_conf)): Likewise. * console-client/Makefile (install): Prepend $(DESTDIR) to dependencies. ($(module-dir)): Prepend $(DESTDIR). ($(module-dir)/%): Likewise. ($(XKB_BASE)): Likewise. ($(XKB_BASE)/%): Likewise. * hurd/Makefile (install-headers, install-msgids): Prepend $(DESTDIR) to dependencies. ($(includedir)/hurd/%): Prepend $(DESTDIR). ($(datadir)/msgids, $(includedir)/hurd): Prepend $(DESTDIR). * include/Makefile (install): Prepend $(DESTDIR) to dependencies. ($(includedir)/%): Prepend $(DESTDIR). * libstore/Makefile (install): Prepend $(DESTDIR) to dependencies. ($(store-types:%=$(libdir)/libstore_%.a): Prepend $(DESTDIR). * sutils/Makefile (install): Prepend $(DESTDIR) to dependencies. ($(prefix)/dev/MAKEDEV): Prepent $(DESTDIR). ($(prefix)/dev): Likewise.
-rw-r--r--Makeconf22
-rw-r--r--config.make.in26
-rw-r--r--config/Makefile14
-rw-r--r--console-client/Makefile12
-rw-r--r--hurd/Makefile10
-rw-r--r--include/Makefile4
-rw-r--r--libstore/Makefile4
-rw-r--r--sutils/Makefile6
8 files changed, 50 insertions, 48 deletions
diff --git a/Makeconf b/Makeconf
index f718164e..67f7ab1c 100644
--- a/Makeconf
+++ b/Makeconf
@@ -238,8 +238,10 @@ ifneq ($(makemode),library)
installable := $(sort $(linktarg) $(targets))
install-targets := $(targets) $(filter $(build-static:=.static),$(linktarg))
all: $(install-targets)
-install: $(installationdir) $(addprefix $(installationdir)/,$(install-targets))
-$(addprefix $(installationdir)/,$(installable)): $(installationdir)/%: %
+install: $(DESTDIR)$(installationdir) $(addprefix $(DESTDIR)$(installationdir)/,$(install-targets))
+$(DESTDIR)$(installationdir):
+ @$(MKINSTALLDIRS) $@
+$(addprefix $(DESTDIR)$(installationdir)/,$(installable)): $(DESTDIR)$(installationdir)/%: %
$(INSTALL_PROGRAM) $(INSTALL-$<-ops) $< $@
else
@@ -248,11 +250,11 @@ else
all: libs
install libs: add-to-librecord
add-to-librecord: $(targets)
-install: $(libdir) $(includedir)/$(installhdrsubdir) $(libdir)/$(libname).so.$(hurd-version) $(addprefix $(libdir)/,$(targets)) $(addprefix $(includedir)/$(installhdrsubdir)/,$(installhdrs))
+install: $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)/$(installhdrsubdir) $(DESTDIR)$(libdir)/$(libname).so.$(hurd-version) $(addprefix $(DESTDIR)$(libdir)/,$(targets)) $(addprefix $(DESTDIR)$(includedir)/$(installhdrsubdir)/,$(installhdrs))
-install-headers: $(includedir)/$(installhdrsubdir) $(addprefix $(includedir)/$(installhdrsubdir)/,$(installhdrs))
+install-headers: $(DESTDIR)$(includedir)/$(installhdrsubdir) $(addprefix $(DESTDIR)$(includedir)/$(installhdrsubdir)/,$(installhdrs))
-$(includedir)/$(installhdrsubdir): $(includedir)
+$(DESTDIR)$(includedir)/$(installhdrsubdir): $(DESTDIR)$(includedir)
@$(MKINSTALLDIRS) $@
# Arrange to have the headers installed locally anytime we build the library.
@@ -272,17 +274,17 @@ $(patsubst %.o,%.d,$(filter %.o,$(OBJS))): $(INSTALLED_LOCAL_HEADERS)
# relative names with ../$(dir) and make won't notice that's us.
../$(dir)/%: % ;
-$(addprefix $(libdir)/$(libname),_p.a .a _pic.a): $(libdir)/%: %
+$(addprefix $(DESTDIR)$(libdir)/$(libname),_p.a .a _pic.a): $(DESTDIR)$(libdir)/%: %
$(INSTALL_DATA) $< $@
$(RANLIB) $@
-$(libdir)/$(libname).so.$(hurd-version): $(libname).so.$(hurd-version)
+$(DESTDIR)$(libdir)/$(libname).so.$(hurd-version): $(libname).so.$(hurd-version)
$(INSTALL_DATA) $< $@
-$(libdir)/$(libname).so: $(libdir)/$(libname).so.$(hurd-version)
+$(DESTDIR)$(libdir)/$(libname).so: $(DESTDIR)$(libdir)/$(libname).so.$(hurd-version)
ln -f -s $(<F) $@
-$(addprefix $(includedir)/$(installhdrsubdir)/,$(installhdrs)): $(includedir)/$(installhdrsubdir)/%: %
+$(addprefix $(DESTDIR)$(includedir)/$(installhdrsubdir)/,$(installhdrs)): $(DESTDIR)$(includedir)/$(installhdrsubdir)/%: %
$(INSTALL_DATA) $< $@
# Arrange to have the shared libraries available locally in one single
@@ -301,7 +303,7 @@ install:
install-headers:
# Making installation directories
-$(installationdirlist): %:
+$(addprefix $(DESTDIR),$(installationdirlist)): %:
@$(MKINSTALLDIRS) $@
# Building the target
diff --git a/config.make.in b/config.make.in
index cdd812e0..7b62e851 100644
--- a/config.make.in
+++ b/config.make.in
@@ -20,19 +20,19 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
# Directories where things get installed.
-hurddir = $(DESTDIR)${exec_prefix}/hurd
-libdir = $(DESTDIR)@libdir@
-bindir = $(DESTDIR)@bindir@
-sbindir = $(DESTDIR)@sbindir@
-includedir = $(DESTDIR)@includedir@
-libexecdir = $(DESTDIR)@libexecdir@
-bootdir = $(DESTDIR)${exec_prefix}/boot
-infodir = $(DESTDIR)@infodir@
-sysconfdir = $(DESTDIR)@sysconfdir@
-localstatedir = $(DESTDIR)@localstatedir@
-sharedstatedir = $(DESTDIR)@sharedstatedir@
-datadir = $(DESTDIR)@datadir@
-datarootdir = $(DESTDIR)@datarootdir@
+hurddir = ${exec_prefix}/hurd
+libdir = @libdir@
+bindir = @bindir@
+sbindir = @sbindir@
+includedir = @includedir@
+libexecdir = @libexecdir@
+bootdir = ${exec_prefix}/boot
+infodir = @infodir@
+sysconfdir = @sysconfdir@
+localstatedir = @localstatedir@
+sharedstatedir = @sharedstatedir@
+datadir = @datadir@
+datarootdir = @datarootdir@
# All of those directories together:
installationdirlist = $(hurddir) $(libdir) $(bindir) $(sbindir) \
diff --git a/config/Makefile b/config/Makefile
index 00501598..e6cb61c8 100644
--- a/config/Makefile
+++ b/config/Makefile
@@ -40,14 +40,14 @@ endif
include ../Makeconf
-install: $(sysconfdir) $(sysconfdir)/login \
- $(installed_conf) $(installed_logins)
+install: $(DESTDIR)$(sysconfdir) $(DESTDIR)$(sysconfdir)/login \
+ $(addprefix $(DESTDIR),$(installed_conf)) $(addprefix $(DESTDIR),$(installed_logins))
-$(sysconfdir)/login: %:
+$(DESTDIR)$(sysconfdir)/login: %:
mkdir -p $@
-$(installed_logins): $(sysconfdir)/login/%: login-%
- $(INSTALL_DATA) $< $(sysconfdir)/login/$*
+$(addprefix $(DESTDIR),$(installed_logins)): $(DESTDIR)$(sysconfdir)/login/%: login-%
+ $(INSTALL_DATA) $< $(DESTDIR)$(sysconfdir)/login/$*
-$(installed_conf): $(sysconfdir)/%: %
- $(INSTALL_DATA) $< $(sysconfdir)/$*
+$(addprefix $(DESTDIR),$(installed_conf)): $(DESTDIR)$(sysconfdir)/%: %
+ $(INSTALL_DATA) $< $(DESTDIR)$(sysconfdir)/$*
diff --git a/console-client/Makefile b/console-client/Makefile
index 024a053d..1b59b99d 100644
--- a/console-client/Makefile
+++ b/console-client/Makefile
@@ -81,12 +81,12 @@ all: $(addsuffix .so.$(hurd-version), $(modules))
cleantarg += $(addsuffix .so.$(hurd-version), $(modules))
-install: $(module-dir) $(addprefix $(module-dir)/,$(addsuffix .so.$(hurd-version),$(modules)))
+install: $(DESTDIR)$(module-dir) $(addprefix $(DESTDIR)$(module-dir)/,$(addsuffix .so.$(hurd-version),$(modules)))
-$(module-dir):
+$(DESTDIR)$(module-dir):
@$(MKINSTALLDIRS) $@
-$(module-dir)/%: %
+$(DESTDIR)$(module-dir)/%: %
$(INSTALL_DATA) $< $@
# You can use this rule to make a dynamically-loadable version of any
@@ -112,12 +112,12 @@ pc-kbd-CFLAGS = -DXKB_SUPPORT -DXKB_DATA_DIR=\"$(XKB_BASE)\" $(X11_CFLAGS)
$(foreach XKB_UNIT, $(XKB_UNITS), $(eval $(XKB_UNIT)-CFLAGS = $(X11_CFLAGS)))
compose-CFLAGS += -DDATADIR=\"$(datadir)\"
pc_kbd-LDLIBS = $(X11_LIBS)
-install: $(XKB_BASE) $(addprefix $(XKB_BASE)/, $(XKB_DATA_FILES))
+install: $(DESTDIR)$(XKB_BASE) $(addprefix $(DESTDIR)$(XKB_BASE)/, $(XKB_DATA_FILES))
-$(XKB_BASE):
+$(DESTDIR)$(XKB_BASE):
@$(MKINSTALLDIRS) $@
-$(XKB_BASE)/%: xkb/xkb-data/%
+$(DESTDIR)$(XKB_BASE)/%: xkb/xkb-data/%
$(INSTALL_DATA) $< $@
kstoucs.o: xkb/kstoucs_map.c
diff --git a/hurd/Makefile b/hurd/Makefile
index 2902d470..5200baef 100644
--- a/hurd/Makefile
+++ b/hurd/Makefile
@@ -28,13 +28,13 @@ include ../Makeconf
all: $(MSGIDS)
install: install-msgids install-headers
-install-headers: $(includedir)/hurd \
- $(addprefix $(includedir)/hurd/,$(INSTHDRS))
-install-msgids: $(MSGIDS) $(datadir)/msgids; $(INSTALL_DATA) $^
+install-headers: $(DESTDIR)$(includedir)/hurd \
+ $(addprefix $(DESTDIR)$(includedir)/hurd/,$(INSTHDRS))
+install-msgids: $(MSGIDS) $(DESTDIR)$(datadir)/msgids; $(INSTALL_DATA) $^
-$(includedir)/hurd/%: $(srcdir)/%; $(INSTALL_DATA) $< $@
+$(DESTDIR)$(includedir)/hurd/%: $(srcdir)/%; $(INSTALL_DATA) $< $@
-$(datadir)/msgids $(includedir)/hurd:;mkdir -p $@
+$(DESTDIR)$(datadir)/msgids $(DESTDIR)$(includedir)/hurd:;mkdir -p $@
%.msgids: $(srcdir)/%.defs
if grep -q '^subsystem' $<; \
diff --git a/include/Makefile b/include/Makefile
index b8773fe1..bf628103 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -26,7 +26,7 @@ installhdrs := sys/procfs.h
include ../Makeconf
-install-headers install: $(installhdrs:%=$(includedir)/%)
-$(includedir)/%: $(srcdir)/%
+install-headers install: $(installhdrs:%=$(DESTDIR)$(includedir)/%)
+$(DESTDIR)$(includedir)/%: $(srcdir)/%
@$(MKINSTALLDIRS) $(@D)
$(INSTALL_DATA) $< $@
diff --git a/libstore/Makefile b/libstore/Makefile
index 3ba00176..c7af958b 100644
--- a/libstore/Makefile
+++ b/libstore/Makefile
@@ -85,6 +85,6 @@ cleantarg += $(store-types:%=libstore_%.a)
all: $(store-types:%=libstore_%.a)
-install: $(store-types:%=$(libdir)/libstore_%.a)
-$(store-types:%=$(libdir)/libstore_%.a): $(libdir)/%: %
+install: $(addprefix $(DESTDIR),$(store-types:%=$(libdir)/libstore_%.a))
+$(addprefix $(DESTDIR),$(store-types:%=$(libdir)/libstore_%.a)): $(DESTDIR)$(libdir)/%: %
$(INSTALL_DATA) $< $@
diff --git a/sutils/Makefile b/sutils/Makefile
index 85343f4a..5bb92c0b 100644
--- a/sutils/Makefile
+++ b/sutils/Makefile
@@ -36,8 +36,8 @@ fsck: fstab.o clookup.o
swapon swapoff: ../libstore/libstore.a default_pagerUser.o
$(progs): %: %.o ../libshouldbeinlibc/libshouldbeinlibc.a
-install: $(prefix)/dev/MAKEDEV
-$(prefix)/dev/MAKEDEV: $(prefix)/dev
+install: $(DESTDIR)$(prefix)/dev/MAKEDEV
+$(DESTDIR)$(prefix)/dev/MAKEDEV: $(DESTDIR)$(prefix)/dev
ln -sf ../sbin/MAKEDEV $@
-$(prefix)/dev:
+$(DESTDIR)$(prefix)/dev:
@$(MKINSTALLDIRS) $@