eclipse-register-toolchain 793 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. project_directory=$1
  3. toolchain_prefix=$2
  4. architecture=$3
  5. TOOLCHAIN_ECLIPSE_FILE=${HOME}/.buildroot-eclipse.toolchains
  6. if test -f ${TOOLCHAIN_ECLIPSE_FILE} ; then
  7. mv ${TOOLCHAIN_ECLIPSE_FILE} ${TOOLCHAIN_ECLIPSE_FILE}.tmp
  8. cat ${TOOLCHAIN_ECLIPSE_FILE}.tmp | while read toolchain ; do
  9. path=$(echo ${toolchain} | cut -f1 -d ':')
  10. # Filter lines corresponding to still existing projects
  11. echo "Testing ${path} ..."
  12. if ! test -d ${path} ; then
  13. continue
  14. fi
  15. # .. and the current project
  16. if test ${path} = ${project_directory} ; then
  17. continue
  18. fi
  19. echo ${toolchain} >> ${TOOLCHAIN_ECLIPSE_FILE}
  20. done
  21. rm ${TOOLCHAIN_ECLIPSE_FILE}.tmp
  22. fi
  23. # Add the toolchain
  24. echo "${project_directory}:${toolchain_prefix}:${architecture}" >> ${TOOLCHAIN_ECLIPSE_FILE}