temperaturecontrol: allow setting background tool without activating
[clinton/Smoothieware.git] / win_install.cmd
CommitLineData
3b1e82d2 1@echo off\r
ce6ee091 2rem Copyright 2013 Adam Green (http://mbed.org/users/AdamGreen/)\r
3b1e82d2
AW
3rem\r
4rem Licensed under the Apache License, Version 2.0 (the "License");\r
5rem you may not use this file except in compliance with the License.\r
6rem You may obtain a copy of the License at\r
7rem\r
8rem http://www.apache.org/licenses/LICENSE-2.0\r
9rem\r
10rem Unless required by applicable law or agreed to in writing, software\r
11rem distributed under the License is distributed on an "AS IS" BASIS,\r
12rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13rem See the License for the specific language governing permissions and\r
14rem limitations under the License.\r
15\r
16\r
17rem Setup batch file specific environment variables.\r
18setlocal\r
19set ROOTDIR=%~dp0\r
20set LOGFILE=%ROOTDIR%win_install.log\r
21set ERRORFILE=%ROOTDIR%win_install.err\r
ce6ee091
JM
22set GCC4ARM_VERSION=gcc-arm-none-eabi-4_8-2014q1\r
23set GCC4ARM_FILENAME=gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip\r
24set GCC4ARM_URL=https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/%GCC4ARM_FILENAME%\r
8fcce42e 25set GCC4ARM_TAR=%ROOTDIR%%GCC4ARM_FILENAME%\r
ce6ee091
JM
26set GCC4ARM_MD5=09c19b3248863074f5498a88f31bee16\r
27set GCC4ARM_MD5_FILENAME=%ROOTDIR%gcc-arm-none-eabi.md5\r
8fcce42e
AG
28set GCC4ARM_DIR=%ROOTDIR%gcc-arm-none-eabi\r
29set GCC4ARM_BINDIR=%GCC4ARM_DIR%\bin\r
39bf9bed 30set OUR_MAKE=%ROOTDIR%build\win32\make.exe\r
8fcce42e 31set BUILDENV_CMD=%GCC4ARM_BINDIR%\buildenv.cmd\r
3b1e82d2 32set BUILDSHELL_CMD=%ROOTDIR%BuildShell.cmd\r
ce6ee091 33set BUILDSHELL_DEBUG_CMD=%ROOTDIR%BuildShellDebug.cmd\r
3b1e82d2
AW
34\r
35\r
36rem Make sure that we are running with current directory set to where this\r
37rem batch file is located.\r
38pushd %ROOTDIR%\r
39\r
40rem Initialize install log files.\r
41echo Logging install results to %LOGFILE%\r
42echo %DATE% %TIME% Starting %0 %*>%LOGFILE%\r
43\r
8fcce42e 44echo Downloading GNU Tools for ARM Embedded Processors...\r
39bf9bed
JM
45echo %DATE% %TIME% Executing build\win32\curl -kL0 %GCC4ARM_URL%>>%LOGFILE%\r
46build\win32\curl -kL0 %GCC4ARM_URL% >%GCC4ARM_TAR%\r
8fcce42e
AG
47if errorlevel 1 goto ExitOnError\r
48\r
ce6ee091
JM
49echo Validating md5 signature of GNU Tools for ARM Embedded Processors...\r
50echo %GCC4ARM_MD5% *%GCC4ARM_FILENAME%>%GCC4ARM_MD5_FILENAME%\r
39bf9bed 51call :RunAndLog build\win32\md5sum --check %GCC4ARM_MD5_FILENAME%\r
8fcce42e 52if errorlevel 1 goto ExitOnError\r
ce6ee091 53del "%GCC4ARM_MD5_FILENAME%"\r
8fcce42e
AG
54\r
55echo Extracting GNU Tools for ARM Embedded Processors...\r
56call :RunAndLog rd /s /q %GCC4ARM_DIR%\r
ce6ee091 57call :RunAndLog md %GCC4ARM_DIR%\r
8fcce42e 58if errorlevel 1 goto ExitOnError\r
ce6ee091 59call :RunAndLog cd %GCC4ARM_DIR%\r
39bf9bed 60call :RunAndLog ..\build\win32\bsdtar xf %GCC4ARM_TAR%\r
3b1e82d2 61if errorlevel 1 goto ExitOnError\r
ce6ee091 62call :RunAndLog cd ..\r
3b1e82d2
AW
63\r
64echo Creating helper scripts...\r
65echo @echo off>%BUILDENV_CMD%\r
66echo REM Uncomment next line and set destination drive to match mbed device>>%BUILDENV_CMD%\r
67echo REM SET LPC_DEPLOY=copy PROJECT.bin f:\>>%BUILDENV_CMD%\r
68echo.>>%BUILDENV_CMD%\r
39bf9bed 69echo SET PATH=%%~dp0;%%~dp0..\..\build\win32;%%PATH%%>>%BUILDENV_CMD%\r
3b1e82d2 70rem\r
8fcce42e 71echo @cmd.exe /K %%~dp0\gcc-arm-none-eabi\bin\buildenv.cmd>%BUILDSHELL_CMD%\r
ce6ee091
JM
72\r
73rem Place GNU Tool for ARM Embedded Processors in the path before building gcc4mbed code.\r
39bf9bed 74set path=%GCC4ARM_BINDIR%;%ROOTDIR%build\win32;%PATH%\r
ce6ee091
JM
75\r
76echo Performing a clean build of the gcc4mbed samples...\r
77call :RunAndLog %OUR_MAKE% clean\r
78if errorlevel 1 goto ExitOnError\r
79call :RunAndLog %OUR_MAKE%\r
80if errorlevel 1 goto ExitOnError\r
3b1e82d2 81\r
8fcce42e 82echo Cleaning up intermediate files...\r
8fcce42e
AG
83call :RunAndLog del /f %GCC4ARM_TAR%\r
84\r
3b1e82d2 85echo **************************************************************************\r
ce6ee091 86echo To build gcc4mbed samples, you will first need to run the following batch\r
3b1e82d2
AW
87echo file so that your environment variables are set correctly:\r
88echo %BUILDSHELL_CMD%\r
89echo You will want to run this each time you start a new Command Prompt. You\r
90echo can simply double-click on this batch file from Explorer to launch a\r
ce6ee091
JM
91echo Command Prompt that has been properly initialized for building gcc4mbed\r
92echo based code.\r
3b1e82d2
AW
93echo **************************************************************************\r
94\r
95rem Restore current directory and exit batch file on success.\r
96echo %DATE% %TIME% Finished successfully>>%LOGFILE%\r
97echo Finished successfully\r
98goto Exit\r
99\r
100\r
101\r
102rem Logs the command to be run and then executes the command while logging the results.\r
103:RunAndLog\r
104echo %DATE% %TIME% Executing %*>>%LOGFILE%\r
105%* 1>>%LOGFILE% 2>%ERRORFILE%\r
106goto :EOF\r
107\r
108\r
109\r
110rem Exits the batch file due to error.\r
ce6ee091
JM
111rem Make sure that any stderr text ends up in win_install.log and then restore\r
112rem the current directory before forcing an early exit.\r
3b1e82d2
AW
113:ExitOnError\r
114type %ERRORFILE% >>%LOGFILE%\r
115echo %DATE% %TIME% Failure forced early exit>>%LOGFILE%\r
116type %LOGFILE%\r
117\r
118\r
119:Exit\r
120del %ERRORFILE%\r
121popd\r
ce6ee091 122pause\r