'Make' for the MonkeyC compiler

I am trying to start with monkey c just now and try to live without eclipse - as it tries to change my windows system settings during the setup.

So I did a small batch file which is able to compile the samples very easily. All you need is to copy the following script 'make.cmd' into the connect iq directory and create a private key ('YourKey.der').

Then you can compile and start one of the samples by entering:

make ApplicationName resource-codes [simulation]

where the resource-codes is a string with characters to include various xml files (e.g. 'r' for resources.xml) and additional compiler flags (e.g. '*' to exclude debug information).

Have fun,
Michael

@echo off

if /%2==/ (

set sample=SimpleDataField
set options=brs

) else (

set sample=%1
set options=%2

)

: -------------------------------------------------------------

set loc=samples\%sample%\
set res=%loc%resources\
set src=%loc%source\
set all=
set flags=

:loop
set check=%options:~0,1%
set options=%options:~1%

if /%check%==/r ( set all=%all%;%res%resources.xml)
if /%check%==/R ( set all=%all%;%res%resource\resources.xml)
if /%check%==/s ( set all=%all%;%res%strings.xml)
if /%check%==/S ( set all=%all%;%res%strings\strings.xml)
if /%check%==/l ( set all=%all%;%res%layout.xml)
if /%check%==/L ( set all=%all%;%res%layouts\layout.xml)
if /%check%==/b ( set all=%all%;%res%bitmaps.xml)
if /%check%==/B ( set all=%all%;%res%images\bitmaps.xml)
if /%check%==/D ( set all=%all%;%res%drawables\drawables.xml)
if /%check%==/M ( set all=%all%;%res%menus\menu.xml)
if /%check%==/X ( set all=%all%;%res%menus\auxmenu.xml)
if /%check%==/* ( set flags=%flags% --release )
if /%check%==/! ( set flags=%flags% --warn )
if /%check%==/0 ( set flags=%flags% --device round_watch )

if not /%options%==/ goto loop

set all=%all:~1%

: -------------------------------------------------------------

echo.
echo Compile: '%src%%sample%*.mc':
echo.

if "%all%"=="~1" (
echo /!\ No valid resource file
goto :eof )

setlocal enabledelayedexpansion
echo Resource files:
set /a count=0
for %%i in (%all%) do (
set /a count+=1
set "v_!count!=%%i" )

for /l %%i in (1,1,%count%) do ( echo - !v_%%i! )
endlocal

echo.
if not "%flags%"=="" (
echo Flags: %flags%
echo. )

:compile
call bin\monkeyc -o test.prg -m %loc%manifest.xml %flags% -z %all% %src%%sample%*.mc -y YourKey.der

:run
set options=%3.
set check=%options:~0,1%
set options=%options:~1%

if not "%check%"=="!" ( goto :eof )

set check=square_watch
if "%options%"=="0." ( set check=round_watch)
if "%options%"=="9." ( set check=fr935)

bin\monkeydo test.prg %check%
  • I think, most of you are using Eclipse, but on my old notebook it's just to slow - so I am using a fine text editor and the command line window, that's it. Meantime I have three batch files and a small exe which starts the simulator (and wait until it is in memory) when needed. You can load them here...

    Before you start, you have to copy all files into your Connect IQ directory (but not in the 'Bin' sub directory) and change the following settings in the make.cmd:
    • your developer key file have to be specified (change the line set key=Information\Tools\###YOURKEY###.der)
    • if java is not in the default path, you have to change the line below (variable add)
    • if you are using the new SDK (2.3.x) you need to specify the location of the local garmin directory (variable bugfix).
      This is needed because the simulator is not able to start a prg from any directory anymore, so the prg file will be copied into that directory
    • if you use a sub directory in the samples directory where all your projects reside, specify that for the variable birdnest

    When you have done this, a make projektname options will compile your program, the options are just some characters to specify the resource files. Here are some examples how sample file from the SDK will be compiled:
    • make Strings brs
    • make ObjectStore bps
    • make Keyboard r
    • make Attention brs+resources\menu\mainmenu.xml

    Beside the resource options you can also add some compiler options and choose the destination plattform, make Keyboard r9* will make a release version for the Forerunner 935.

    To see most of available the options, enter make ?

    make [type*]ApplicationName [[_]resources] [simulation]
    -------------------------------------------------------
    Type options:
    adfw sets the application directory (App, Datafield, Watchface, Widget)

    Resource options:
    a-z set the include file assigned to the given letter (rslbdmxfop)
    +xxx add resource file (at local path)
    @xxx add resource file (at ressource path)
    / add source files in subdirectories
    * create program release
    . show compiler warnings
    ~ use test option
    $ use new SDK versiom
    : suppress compiler output (redirected into 'monkey.out')
    _xxx use default options and add options 'xxx'

    Simulator options:
    0 round watch o Oregon 7xx
    1 Edge 1000 8 Edge 820
    2 Forerunner 235 3 Fenix 3
    4 Forerunner 920XT 5 Fenix 5
    6 Forerunner 630 x Fenix 5x
    7 Forerunner 735XT h Vivoactive HR
    9 Forerunner 935 v Vivoactive
    e Epix i Rino 7xxx



    The other two scripts are for starting the simulator (test) and to list all compiled programs (list) - just play around, maybe so like to create programs by using your favorite editor and nothing else...