aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 063d613..83332e9 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,13 @@
PREFIX ?= arm-none-eabi
#PREFIX ?= arm-elf
+
+ifeq ($(DETECT_TOOLCHAIN),)
DESTDIR ?= /usr/local
+else
+DESTDIR ?= $(shell dirname $(shell readlink -f $(shell which $(PREFIX)-gcc)))/..
+endif
+
INCDIR = $(DESTDIR)/$(PREFIX)/include
LIBDIR = $(DESTDIR)/$(PREFIX)/lib
SHAREDIR = $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts