1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

Windows-friendly batch file to build or clean all flight targets with one click.

SYNTAX: Makefile.cmd [build | clean | help]
 - build: builds all flight targets including uavobjects, bootloaders and firmware
 - clean: cleans all flight targets including bootloaders and firmware
 - help:  this help

Currently set are OpenPilot, AHRS, PipXtreme targets and their bootloaders.
It could be done even better but it seems that Windows users don't like command line.

Extra batches which could help (not committed) are:

flight-build.cmd:
---------------------------------
@echo off
rem
rem Build all flight targets
rem

Makefile.cmd build
---------------------------------

flight-clean.cmd :
---------------------------------
@echo off
rem
rem Clean all flight targets
rem

Makefile.cmd clean
---------------------------------


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2551 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
osnwt 2011-01-23 19:08:16 +00:00 committed by osnwt
parent 8cddf2913d
commit 90df657a37

100
Makefile.cmd Normal file
View File

@ -0,0 +1,100 @@
@echo off
rem
rem Windows-friendly batch file for all flight targets
rem
rem -------------------------------------------------------------------
rem Help
rem -------------------------------------------------------------------
if '%1' == 'build' goto Proceed
if '%1' == 'clean' goto Proceed
for %%F in (%0) do echo SYNTAX: %%~nF%%~xF [build / clean / help]
echo - build: builds all flight targets including uavobjects, bootloaders and firmware
echo - clean: cleans all flight targets including bootloaders and firmware
echo - help: this help
goto Abort
:Proceed
rem -------------------------------------------------------------------
rem Settings and definitions
rem -------------------------------------------------------------------
rem Set desired targets
set TARGETS_FW=AHRS OpenPilot PipXtreme
set TARGETS_BL=%TARGETS_FW%
rem Set toolset paths (if you don't have them added permanently)
rem set PATH=D:\Work\OpenPilot\Apps\CodeSourcery\bin\;%PATH%
set MAKE=cs-make
rem Set some project path variables
for /F %%D in ('cd') do set CURDIR=%%D
set ROOT_DIR=%CURDIR%
set BUILD_DIR=%ROOT_DIR%\build
set UAVOBJ_XML_DIR=%ROOT_DIR%\shared\uavobjectdefinition
set UAVOBJ_OUT_DIR=%BUILD_DIR%\uavobject-synthetics
rem Find the UAVObjGenerator
for %%G in (debug release) do (
if exist %BUILD_DIR%\ground\uavobjgenerator\%%G\uavobjgenerator.exe (
set UAVOBJGENERATOR="%BUILD_DIR%\ground\uavobjgenerator\%%G\uavobjgenerator.exe"
goto UAVObjGeneratorFound
)
)
echo UAVObjGenerator was not found, please build it first
goto Abort
:UAVObjGeneratorFound
rem -------------------------------------------------------------------
rem Proceed with target
rem -------------------------------------------------------------------
set TARGET=%1
rem -------------------------------------------------------------------
rem UAVObjects for flight build
rem -------------------------------------------------------------------
if '%TARGET%' == 'clean' goto UAVObjectsDone
mkdir %UAVOBJ_OUT_DIR% >NUL 2>&1
pushd %UAVOBJ_OUT_DIR%
%UAVOBJGENERATOR% -flight %UAVOBJ_XML_DIR% %ROOT_DIR%
if errorlevel 1 goto Abort2
popd
:UAVObjectsDone
rem -------------------------------------------------------------------
rem Bootloaders build
rem -------------------------------------------------------------------
for %%G in (%TARGETS_BL%) do (
%MAKE% CODE_SOURCERY=YES USE_BOOTLOADER=NO OUTDIR="%BUILD_DIR%\flight\Bootloaders\%%G" -C "%ROOT_DIR%\flight\Bootloaders\%%G" %TARGET%
if errorlevel 1 goto Abort1
)
rem -------------------------------------------------------------------
rem Firmware build
rem -------------------------------------------------------------------
for %%G in (%TARGETS_FW%) do (
%MAKE% CODE_SOURCERY=YES USE_BOOTLOADER=YES OUTDIR="%BUILD_DIR%\flight\%%G" -C "%ROOT_DIR%\flight\%%G" %TARGET%
if errorlevel 1 goto Abort1
)
goto Done
rem -------------------------------------------------------------------
rem Error handling
rem -------------------------------------------------------------------
:Abort2
popd
:Abort1
echo Error returned, build aborted
:Abort
pause
:Done