build-sys: introduce install-prog macro to install&strip binaries and use it

Use common rule (macro) to install and strip binaries, and use
it in all places where we install binaries, instead of fixing
bugs like 1319493 in every place.
(This fixes https://bugs.launchpad.net/bugs/1319493)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Michael Tokarev 2014-06-22 10:55:23 +04:00
parent 4196dca63b
commit 0d65942611
3 changed files with 10 additions and 14 deletions

View File

@ -385,12 +385,8 @@ install-sysconfig: install-datadir install-confdir
install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \ install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \
install-datadir install-localstatedir install-datadir install-localstatedir
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
ifneq ($(TOOLS),) ifneq ($(TOOLS),)
$(INSTALL_PROG) $(TOOLS) "$(DESTDIR)$(bindir)" $(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
ifneq ($(STRIP),)
$(STRIP) $(TOOLS:%="$(DESTDIR)$(bindir)/%")
endif
endif endif
ifneq ($(CONFIG_MODULES),) ifneq ($(CONFIG_MODULES),)
$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)" $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
@ -401,11 +397,7 @@ ifneq ($(CONFIG_MODULES),)
done done
endif endif
ifneq ($(HELPERS-y),) ifneq ($(HELPERS-y),)
$(INSTALL_DIR) "$(DESTDIR)$(libexecdir)" $(call install-prog,$(HELPERS-y),$(DESTDIR)$(libexecdir))
$(INSTALL_PROG) $(HELPERS-y) "$(DESTDIR)$(libexecdir)"
ifneq ($(STRIP),)
$(STRIP) $(HELPERS-y:%="$(DESTDIR)$(libexecdir)/%")
endif
endif endif
ifneq ($(BLOBS),) ifneq ($(BLOBS),)
set -e; for x in $(BLOBS); do \ set -e; for x in $(BLOBS); do \

View File

@ -190,10 +190,7 @@ endif
install: all install: all
ifneq ($(PROGS),) ifneq ($(PROGS),)
$(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)" $(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
ifneq ($(STRIP),)
$(STRIP) $(PROGS:%="$(DESTDIR)$(bindir)/%")
endif
endif endif
ifdef CONFIG_TRACE_SYSTEMTAP ifdef CONFIG_TRACE_SYSTEMTAP
$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"

View File

@ -101,6 +101,13 @@ cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc
set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1))) set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
# install-prog list, dir
define install-prog
$(INSTALL_DIR) "$2"
$(INSTALL_PROG) $1 "$2"
$(if $(STRIP),$(STRIP) $(foreach T,$1,"$2/$(notdir $T)"),)
endef
# find-in-path # find-in-path
# Usage: $(call find-in-path, prog) # Usage: $(call find-in-path, prog)
# Looks in the PATH if the argument contains no slash, else only considers one # Looks in the PATH if the argument contains no slash, else only considers one