aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rwxr-xr-xsupport/scripts/eclipse-register-toolchain28
-rw-r--r--toolchain/toolchain-common.in7
3 files changed, 42 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index f40863247..1fc51e9cb 100644
--- a/Makefile
+++ b/Makefile
@@ -347,6 +347,10 @@ TARGETS+=target-generatelocales
endif
endif
+ifeq ($(BR2_ECLIPSE_REGISTER),y)
+TARGETS+=toolchain-eclipse-register
+endif
+
include fs/common.mk
TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
@@ -542,6 +546,9 @@ target-generatelocales: host-localedef
done
endif
+toolchain-eclipse-register:
+ ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
+
source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
external-deps:
diff --git a/support/scripts/eclipse-register-toolchain b/support/scripts/eclipse-register-toolchain
new file mode 100755
index 000000000..dd9f1587f
--- /dev/null
+++ b/support/scripts/eclipse-register-toolchain
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+project_directory=$1
+toolchain_prefix=$2
+architecture=$3
+
+TOOLCHAIN_ECLIPSE_FILE=${HOME}/.buildroot-eclipse.toolchains
+
+if test -f ${TOOLCHAIN_ECLIPSE_FILE} ; then
+ mv ${TOOLCHAIN_ECLIPSE_FILE} ${TOOLCHAIN_ECLIPSE_FILE}.tmp
+ cat ${TOOLCHAIN_ECLIPSE_FILE}.tmp | while read toolchain ; do
+ path=$(echo ${toolchain} | cut -f1 -d ':')
+ # Filter lines corresponding to still existing projects
+ echo "Testing ${path} ..."
+ if ! test -d ${path} ; then
+ continue
+ fi
+ # .. and the current project
+ if test ${path} = ${project_directory} ; then
+ continue
+ fi
+ echo ${toolchain} >> ${TOOLCHAIN_ECLIPSE_FILE}
+ done
+ rm ${TOOLCHAIN_ECLIPSE_FILE}.tmp
+fi
+
+# Add the toolchain
+echo "${project_directory}:${toolchain_prefix}:${architecture}" >> ${TOOLCHAIN_ECLIPSE_FILE}
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index 9f11a3984..f6905ae23 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -131,3 +131,10 @@ config BR2_TARGET_LDFLAGS
string "Target linker options"
help
Extra options to pass to the linker when building for the target.
+
+config BR2_ECLIPSE_REGISTER
+ bool "Register toolchain within Eclipse Buildroot plug-in"
+ help
+ This options tells Buildroot to generate the necessary
+ configuration files to make your toolchain appear within
+ Eclipse, through the Eclipse Buildroot plugin.