Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/linux-sunxi/sunxi-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Campbell <ijc@hellion.org.uk>2015-10-14 23:10:08 +0300
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>2015-10-23 23:20:41 +0300
commit0f69187846cf98f7dcce3c81464d54e0906e32ac (patch)
tree26be52f71489d729b3e817cb0cdbb917302c890b /Makefile
parentbf4ec9a0178c9720a3d67f787d615d93977aed9c (diff)
Makefile: Add an install rule
Allow for separate installation of tools and target-tools, to aid in packaging. By default everything the tools are installed into /usr/local/bin but this can be overridden using PREFIX= or BINDIR= on the make invocation. To enable this it was necessary to split fex2bin and bin2fex out from $(TOOLS) into $(FEXC_LINKS), because install(1) does not seem to have a mode which preserves symlinks so it needs to be done separately. Supports DESTDIR to allow for convenient installation into a staging dir for distro packaging convenience. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Acked-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 31 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 67dfafa..c5a2906 100644
--- a/Makefile
+++ b/Makefile
@@ -22,8 +22,10 @@ CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200112L
CFLAGS += -Iinclude/
# Tools useful on host and target
-TOOLS = sunxi-fexc bin2fex fex2bin sunxi-bootinfo sunxi-fel
-TOOLS += sunxi-nand-part
+TOOLS = sunxi-fexc sunxi-bootinfo sunxi-fel sunxi-nand-part
+
+# Symlinks to sunxi-fexc
+FEXC_LINKS = bin2fex fex2bin
# Tools which are only useful on the target
TARGET_TOOLS = sunxi-pio
@@ -32,18 +34,40 @@ MISC_TOOLS = phoenix_info
CROSS_COMPILE ?= arm-none-eabi-
-.PHONY: all clean tools target-tools
+DESTDIR ?=
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+
+.PHONY: all clean tools target-tools install install-tools install-target-tools
all: tools target-tools
-tools: $(TOOLS)
+tools: $(TOOLS) $(FEXC_LINKS)
target-tools: $(TARGET_TOOLS)
misc: $(MISC_TOOLS)
-clean:
- @rm -vf $(TOOLS) $(TARGET_TOOLS) $(MISC_TOOLS) *.o *.elf *.sunxi *.bin *.nm *.orig
+install: install-tools install-target-tools
+
+install-tools: $(TOOLS)
+ install -d $(DESTDIR)$(BINDIR)
+ @set -ex ; for t in $^ ; do \
+ install -m0755 $$t $(DESTDIR)$(BINDIR)/$$t ; \
+ done
+ @set -ex ; for l in $(FEXC_LINKS) ; do \
+ ln -nfs sunxi-fexc $(DESTDIR)$(BINDIR)/$$l ; \
+ done
+install-target-tools: $(TARGET_TOOLS)
+ install -d $(DESTDIR)$(BINDIR)
+ @set -ex ; for t in $^ ; do \
+ install -m0755 $$t $(DESTDIR)$(BINDIR)/$$t ; \
+ done
+
+
+clean:
+ @rm -vf $(TOOLS) $(FEXC_LINKS) $(TARGET_TOOLS) $(MISC_TOOLS)
+ @rm -vf *.o *.elf *.sunxi *.bin *.nm *.orig
$(TOOLS) $(TARGET_TOOLS): Makefile common.h
@@ -122,6 +146,6 @@ sunxi-meminfo: meminfo.c
$(CROSS_COMPILE)gcc -g -O0 -Wall -static -o $@ $^
.gitignore: Makefile
- @for x in $(TOOLS) $(TARGET_TOOLS) '*.o' '*.swp'; do \
+ @for x in $(TOOLS) $(FEXC_LINKS) $(TARGET_TOOLS) '*.o' '*.swp'; do \
echo "$$x"; \
done > $@