-
Notifications
You must be signed in to change notification settings - Fork 10
/
build
executable file
·70 lines (60 loc) · 1.5 KB
/
build
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/bash
echo -e "\nSTART\t: `pwd`/$0\t`date`"
function help() {
echo "Build FireStep (non-Windows)"
echo
echo "EXAMPLES:"
echo " ./build"
echo
echo "OPTIONS:"
echo " -h"
echo " --help"
echo " Print this help text"
}
while getopts "c:" flag
do
case "$flag" in
*) help ; exit 0;;
esac
done
if [ ! -e ArduinoJson ]; then
echo -e "ERROR\t: Installation incomplete"
echo -e "TRY\t: scripts/install.sh"
exit -1
fi
if [ "${FIREDUINO}" == "" ]; then
export FIREDUINO=MOCK_MEGA2560
fi
if [ "${MEMORY_MODEL}" == "" ]; then
export MEMORY_MODEL=MEMORY_MODEL_TINY
fi
echo "DEFINE : MEMORY_MODEL=${MEMORY_MODEL}"
if [ "$DESTDIR" == "" ]; then
echo "INSTALL : using default installation prefix"
export DESTDIR=/usr/local
fi
echo "INSTALL : ${DESTDIR}"
if [ -e CMakeFiles ] ; then
echo "STATUS : removing existing makefiles"
rm -rf core CMakeCache.txt CMakeFiles CMakeFiles.txt target cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake
mkdir target
fi
echo "STATUS : creating makefile"
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=$DESTDIR "$@" \
.
RC=$?; if [ $RC -ne 0 ]; then
echo "ERROR : cmake failed (RC=$RC)"
exit -1
fi
TAG=`git log --pretty=format:'%H' -n 1`
echo 'const char GIT_TAG[] PROGMEM = { "'$TAG'" };' > FireStep/git_tag.h
make
RC=$?; if [ $RC -ne 0 ]; then
echo "ERROR : make failed (RC=$RC)"
exit -1
fi
mv FireStep/git_tag.h target
git checkout FireStep/git_tag.h
echo "----------------------------------"
echo -e "END\t: `pwd`/$0\t`date` (COMPLETE)"