1 #!/bin/sh
2 #
3 # Convert Energia sketch files into buildable C/C++ files
4 #
5 # Usage: ino2cpp [-o output] [-Dname=value] [-E] [-T tplt] sketch target
6 #
7 # Note: ino2cpp can run without an existing installation of Energia
8 #
9 root="`dirname $0`"
11 ## locate a java command
12 JAVA=java
13 for j in "$ENERGIA/java/bin/java" "`which java 2> /dev/null`" "$JAVA_HOME/bin/java"; do
14 if [ -x "$j" -o -x "$j.exe" ]; then
15 JAVA="$j"
16 break
17 fi
18 done
20 ## run the ino2cpp preprocessor
21 $JAVA -jar "$root"/ino2cpp.jar -r "$root" -T $root/templates/Variables.mk.template "$@"