summaryrefslogtreecommitdiffstats
path: root/support/scripts/eclipse-register-toolchain
blob: dd9f1587f4f6c2c22e022cdc1c39d5ee8f3121e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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}