<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_compiler_options>
<CodeBlocks_compiler_options>
    <if platform="windows">
        <Program name="C"         value="sdcc.exe"/>
        <Program name="CPP"       value="sdcc.exe"/>
        <Program name="LD"        value="sdcc.exe"/>
        <Program name="DBGconfig" value=""/>
        <Program name="LIB"       value="sdar.exe"/>
        <Program name="WINDRES"   value=""/>
        <Program name="MAKE"      value="make.exe"/>
    </if>
    <else>
        <Program name="C"         value="sdcc"/>
        <Program name="CPP"       value="sdcc"/>
        <Program name="LD"        value="sdcc"/>
        <Program name="DBGconfig" value=""/>
        <Program name="LIB"       value="sdar"/>
        <Program name="WINDRES"   value=""/>
        <Program name="MAKE"      value="make"/>
    </else>

    <Switch name="includeDirs"             value="-I"/>
    <Switch name="libDirs"                 value="-L"/>
    <Switch name="linkLibs"                value="-l"/>
    <Switch name="defines"                 value="-D"/>
    <Switch name="genericSwitch"           value="-"/>
    <Switch name="objectExtension"         value="rel"/>
    <Switch name="needDependencies"        value="true"/>
    <Switch name="forceCompilerUseQuotes"  value="false"/>
    <Switch name="forceLinkerUseQuotes"    value="false"/>
    <Switch name="logging"                 value="default"/>
    <Switch name="libPrefix"               value="lib"/>
    <Switch name="libExtension"            value="lib"/>
    <Switch name="linkerNeedsLibPrefix"    value="false"/>
    <Switch name="linkerNeedsLibExtension" value="false"/>

    <Option name="Show actions compiler is performing"
            option="--verbose"/>
    <Option name="Show actual commands compiler is executing"
            option="-V"/>
    <Option name="Make char signed by default"
            option="--fsigned-char"/>
    <Option name="Permit dollar sign ('$') as an identifier character"
            option="--fdollars-in-identifiers"/>

    <Category name="Debugging">
        <Option name="Produce debugging symbols"
                option="--debug"/>
        <Option name="Display complexity of compiled functions"
                option="--cyclomatic"/>
    </Category>

    <Category name="Code Generation">
        <Option name="Make all functions reentrant"
                option="--stack-auto"
                checkAgainst="-mstm8 -mz80 -mz180 -mez80_z80 -mr2k -mtlcs90 -mgbz80"
                checkMessage="stm8 and the z80-related backends always generate reentrant code; --stack-auto is redundant."/>
        <Option name="Callee will always save registers used"
                option="--all-callee-saves"/>
        <Option name="Never use a frame pointer"
                option="--fomit-frame-pointer"
                supersedes="--fno-omit-frame-pointer"/>
        <Option name="Always use a frame pointer"
                option="--fno-omit-frame-pointer"
                supersedes="--fomit-frame-pointer"
                checkAgainst="-mpdk13 -mpdk14 -mpdk15"
                checkMessage="Padauk backends do not support a frame pointer; --fno-omit-frame-pointer will be ignored."/>
        <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;4.2.0" default="true">
            <!-- only with version 4.2.0+ -->
            <Option name="Use ABI calling convention version 0"
                    option="--sdcccall0"
                    supersedes="--sdcccall1"
                    checkAgainst="-mmcs51 -mds390 -mds400 -mpic14 -mpic16 -mhc08 -ms08 -mmos6502"
                    checkMessage="MCS51, DS390/400, PIC, HC08, S08, and 6502 backends do not support changing the calling convention"/>
            <Option name="Use ABI calling convention version 1"
                    option="--sdcccall1"
                    supersedes="--sdcccall0"
                    checkAgainst="-mmcs51 -mds390 -mds400 -mpic14 -mpic16 -mhc08 -ms08 -mmos6502"
                    checkMessage="MCS51, DS390/400, PIC, HC08, S08, and 6502 backends do not support changing the calling convention"/>
        </if>
        <Option name="Don't include C code as comments in ASM files"
                option="--no-c-code-in-asm"/>
        <Option name="Don't include peephole optimizer comments in ASM files"
                option="--no-peep-comments"/>
    </Category>

    <Category name="Optimization">
        <Option name="Optimize for code speed rather than size"
                option="--opt-code-speed"
                supersedes="--opt-code-size"/>
        <Option name="Optimize for code size rather than speed"
                option="--opt-code-size"
                supersedes="--opt-code-speed"/>
        <Option name="Disable peephole optimizer"
                option="--no-peep"/>
        <Option name="Disable lifetime-optimal speculative partial redundancy elimination"
                option="--nolospre"/>
        <Option name="Disable global common subexpression elimination"
                option="--nogcse"/>
        <Option name="Disable loop invariant optimizations"
                option="--noinvariant"/>
        <Option name="Disable loop induction optimizations"
                option="--noinduction"/>
        <Option name="Disable loop reversal optimization"
                option="--noloopreverse"/>
        <Option name="Enable peephole optimization on inline assembly"
                option="--peep-asm"/>
        <Option name="Enable peephole optimization for return instructions (default without --debug)"
                option="--peep-return"
                supersedes="--no-peep-return"/>
        <Option name="Disable peephole optimization for return instructions (default with --debug)"
                option="--no-peep-return"
                supersedes="--peep-return"/>
        <Option name="Allow optimizations to generate unsafe reads"
                option="--allow-unsafe-read"/>
        <Option name="Disable overlay of parameters and local variables of functions"
                option="--nooverlay"/>
    </Category>

    <Category name="Warnings">
        <Option name="Treat warnings as errors"
            option="--Werror"/>
        <Option name="Disable some of the more pedantic warnings"
            option="--less-pedantic"/>
    </Category>

    <Category name="Language"
              exclusive="true">
        <Option name="ISO C90 / ANSI C89"
                option="--std-c89"/>
        <Option name="ISO C90 / ANSI C89 with SDCC extensions"
                option="--std-sdcc89"/>
        <Option name="ISO C95 / ISO C94"
                option="--std-c95"/>
        <Option name="ISO C99"
                option="--std-c99"/>
        <Option name="ISO C99 with SDCC extensions"
                option="--std-sdcc99"/>
        <Option name="ISO C11"
                option="--std-c11"/>
        <Option name="ISO C11 with SDCC extensions (default)"
                option="--std-sdcc11"/>
        <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;3.8.0" default="true">
            <!-- only with version 3.8.0+ -->
            <Option name="ISO C2X"
                    option="--std-c2x"/>
            <Option name="ISO C2X with SDCC extensions"
                    option="--std-sdcc2x"/>
        </if>
    </Category>

    <Category name="Linker Output Format"
              exclusive="true">
        <Option name="Intel Hex (default)"
                option="--out-fmt-ihx"/>
        <Option name="Motorola S19"
                option="--out-fmt-s19"/>
        <Option name="ELF (HC08, S08, and STM8 only)"
                option="--out-fmt-elf"/>
    </Category>

    <Category name="CPU Target Architecture"
              exclusive="true">
        <Option name="[CPU] Intel MCS-51 (default)"
                option="-mmcs51"/>
        <Option name="[CPU] Zilog Z80"
                option="-mz80"/>
        <Option name="[CPU] Zilog Z180"
                option="-mz180"/>
        <Option name="[CPU] Rabbit 2000"
                option="-mr2k"/>
        <Option name="[CPU] Rabbit 3000A"
                option="-mr3ka"/>
        <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;4.2.0" default="true">
            <!-- name changed with version 4.2.0+ -->
            <Option name="[CPU] Sharp SM83 (Nintendo Game Boy)"
                    option="-msm83"/>
        </if>
        <else>
            <Option name="[CPU] Nintendo Game Boy Z80"
                    option="-mgbz80"/>
        </else>
        <Option name="[CPU] Toshiba TLCS-90"
                option="-mtlcs90"/>
        <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;3.9.0" default="true">
            <!-- only with version 3.9.0+ -->
            <Option name="[CPU] Zilog eZ80 in Z80 mode"
                    option="-mez80_z80"/>
        </if>
        <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;4.1.0" default="true">
            <!-- only with version 4.1.0+ -->
            <Option name="[CPU] ZX Spectrum Next Z80N"
                    option="-mz80n"/>
            <Option name="[CPU] Rabbit 2000A/2000B/2000C/3000"
                    option="-mr2ka"/>
        </if>
        <Option name="[CPU] Dallas DS80C390"
                option="-mds390"/>
        <Option name="[CPU] Dallas DS80C400"
                option="-mds400"/>
        <Option name="[CPU] Microchip PIC 16-bit (deprecated)"
                option="-mpic16"/>
        <Option name="[CPU] Microchip PIC 14-bit (deprecated)"
                option="-mpic14"/>
        <Option name="[CPU] Freescale/Motorola HC08"
                option="-mhc08"/>
        <Option name="[CPU] Freescale/NXP S08"
                option="-ms08"/>
        <Option name="[CPU] STMicroelectronics STM8"
                option="-mstm8"/>
        <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;4.0.0" default="true">
            <!-- only with version 4.0.0+ -->
            <Option name="[CPU] Padauk 13-bit (experimental)"
                    option="-mpdk13"/>
        </if>
        <Option name="[CPU] Padauk 14-bit"
                option="-mpdk14"/>
        <Option name="[CPU] Padauk 15-bit"
                option="-mpdk15"/>
        <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;4.2.0" default="true">
            <!-- only with version 4.2.0+ -->
            <Option name="[CPU] MOS Technology 6502 (experimental)"
                    option="-mmos6502"/>
        </if>
    </Category>

    <Category name="MCS51 Options">
        <Option name="[MCS51] Medium model programs (default is small)"
                option="--model-medium"
                supersedes="--model-large --model-huge"/>
        <Option name="[MCS51] Large model programs (default is small)"
                option="--model-large"
                supersedes="--model-medium --model-huge"/>
        <Option name="[MCS51] Huge model programs (default is small)"
                option="--model-huge"
                supersedes="--model-medium --model-large"/>
        <Option name="[MCS51] Use a pseudo stack in the first 256 bytes of the external ram"
                option="--xstack"/>
        <Option name="[MCS51] Linker use old style for allocating memory areas"
                option="--no-pack-iram"/>
        <Option name="[MCS51] Use acall/ajmp instructions instead of lcall/ljmp"
                option="--acall-ajmp"/>
        <Option name="[MCS51] Do not use ret independent of acall/lcall"
                option="--no-ret-without-call"/>
    </Category>

    <Category name="DS390/DS400 Options">
        <Option name="[DS390/DS400] Generate 24-bit flat mode code (default)"
                option="--model-flat24"/>
        <Option name="[DS390/DS400] Use 10-bit stack mode (default)"
                option="--stack-10bit"/>
        <Option name="[DS390/DS400] Disable interrupts during ESP:SP updates"
                option="--protect-sp-update"/>
        <Option name="[DS390/DS400] Generate code for DS390 Arithmetic Accelerator"
                option="--use-accelerator"/>
        <Option name="[DS390/DS400] Use Bank1 for parameter passing"
                option="--parms-in-bank1"/>
    </Category>

    <Category name="Z80/Z180/eZ80/Z80N/Rabbit/TLCS-90/SM83 Options">
        <Option name="[Z80] When linking, skip the standard crt0.rel object file"
                option="--no-std-crt0"/>
        <Option name="[Z80] Generate workaround for NMOS Z80 when saving IFF2"
                option="--nmos-z80"/>
        <Option name="[Z80] Do not use IY register (incompatible with --fomit-frame-pointer)"
                option="--reserve-regs-iy"
                supersedes="--fomit-frame-pointer"/>
        <Option name="[Z80] Use legacy method to call banked functions"
                option="--legacy-banking"/>
        <Option name="[Z80] Use old register allocator (deprecated)"
                option="--oldralloc"/>
    </Category>

    <Category name="HC08/S08 Options">
        <Option name="[HC08/S08] Small 8-bit address space for data (default is large)"
                option="--model-small"/>
        <Option name="[HC08/S08] Use old register allocator"
                option="--oldralloc"/>
    </Category>

    <Category name="STM8 Options">
        <Option name="[STM8] Large model programs (default is medium)"
                option="--model-large"/>
    </Category>
    
    <if exec="C --version" regex="([0-9]+\.[0-9]+\.[0-9]+);ge;4.2.0" default="true">
        <!-- only with version 4.2.0+ -->
        <Category name="MOS6502 Options">
            <Option name="[MOS6502] Small 8-bit address space for data (default is large)"
                    option="--model-small"/>
            <Option name="[MOS6502] When linking, skip the standard crt0.rel object file"
                    option="--no-std-crt0"/>
        </Category>
    </if>

    <Command name="CompileObject"
             value="$compiler $options $includes -c $file -o $object"/>
    <Command name="GenDependencies"
             value="$compiler -MM $options -MF $dep_object -MT $object $includes $file"/>
    <Command name="LinkExe"
             value="$linker $libdirs -o $exe_output $options $link_options $libs $link_objects"/>
    <Command name="LinkConsoleExe"
             value="$linker $libdirs -o $exe_output $options $link_options $libs $link_objects"/>
    <Command name="LinkStatic"
             value="$lib_linker -r $static_output $link_objects"/>
    <Command name="LinkNative"
             value="$linker $libdirs -o $exe_output $options $link_options $libs $link_objects"/>
    <Common name="cmds"/>

    <RegEx name="Fatal error"
           type="error"
           msg="1">
        <![CDATA[FATAL:[[:blank:]]*(.*)]]>
    </RegEx>
    <RegEx name="Compiler warning (.h)"
           type="warning"
           msg="3"
           file="1"
           line="2">
        <![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9:]+[[:blank:]]([Ww]arning[:[:blank:]].*)]]>
    </RegEx>
    <RegEx name="Compiler warning"
           type="warning"
           msg="3"
           file="1"
           line="2">
        <![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]]([Ww]arning[:[:blank:]].*)]]>
    </RegEx>
    <RegEx name="Compiler error"
           type="error"
           msg="3"
           file="1"
           line="2">
        <![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]](.*[Ee]rror[:[:blank:]].*)]]>
    </RegEx>
    <RegEx name="Compiler error (2)"
           type="error"
           msg="3"
           file="1"
           line="2">
        <![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9:]+ (.*: No such .*)]]>
    </RegEx>
    <RegEx name="Linker warning"
           type="warning"
           msg="1">
        <![CDATA[(ASlink-Warning-.*)]]>
    </RegEx>
</CodeBlocks_compiler_options>
