def build(bld):
    if bld.is_asterix() or bld.is_obelix():
        if bld.is_asterix():
            paths = ['pebbleos-nonfree/npm1300/nrf_fuel_gauge/lib/cortex-m4/soft-float']
        elif bld.is_obelix():
            paths = ['pebbleos-nonfree/npm1300/nrf_fuel_gauge/lib/cortex-m33/soft-float']

        bld.read_stlib(
            'nrf_fuel_gauge',
            export_includes=[
                'pebbleos-nonfree/npm1300/nrf_fuel_gauge/include',
                'pebbleos-nonfree/npm1300/models'
            ],
            paths=paths
        )

    if bld.is_obelix():
        bld(
            name='cst816_fw',
            export_includes=[
                'pebbleos-nonfree/cst816',
            ],
        )

    if bld.is_obelix():
        includes = [
            'pebbleos-nonfree/gh3x2x/algo_lib/algo_params/HR/04_EXCLUSIVE',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_algo_code/goodix_algo_application/inc',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_algo_code/goodix_algo_call/inc',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_algo_code/goodix_algo_call/inc/hr_exc',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_algo_code/goodix_algo_call/inc/spo2_pre_exc',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_kernel_code/driver/inc',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_kernel_code/kernel',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_kernel_code/module/gh_agc',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_kernel_code/module/gh_ecg',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_kernel_code/module/gh_other',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_kernel_code/module/gh_protocol',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_kernel_code/module/gh_soft_adt',
            'pebbleos-nonfree/gh3x2x/demo_code/demo_mp_code/inc',
        ]

        bld.read_stlib(
            'star-mc1_arm-gcc14.2.1_softfp+Os_common_dl',
            paths=['pebbleos-nonfree/gh3x2x/algo_lib/COMMON_DL'],
        )

        bld.read_stlib(
            'star-mc1_arm-gcc14.2.1_softfp+Os_common_dsp',
            paths=['pebbleos-nonfree/gh3x2x/algo_lib/COMMON_DSP'],
        )

        bld.read_stlib(
            'GitInfo_star-mc1-arm-none-eabi-gcc1421(softfp+Os)',
            paths=['pebbleos-nonfree/gh3x2x/algo_lib/HR'],
        )

        bld.read_stlib(
            'star-mc1_arm-gcc14.2.1_softfp+Os_hrv',
            paths=['pebbleos-nonfree/gh3x2x/algo_lib/HRV'],
        )

        bld.read_stlib(
            'star-mc1_arm-gcc14.2.1_softfp+Os_nadt',
            paths=['pebbleos-nonfree/gh3x2x/algo_lib/NADT'],
        )

        bld.read_stlib(
            'star-mc1_arm-gcc14.2.1_softfp+Os_spo2',
            paths=['pebbleos-nonfree/gh3x2x/algo_lib/SPO2'],
        )

        bld.read_stlib(
            'arm-none-eabi-gcc-softfp-Os-gh_common',
            paths=['pebbleos-nonfree/gh3x2x/drv_lib']
        )

        sources = bld.path.ant_glob([
            'pebbleos-nonfree/gh3x2x/algo_lib/**/*.c',
            'pebbleos-nonfree/gh3x2x/demo_code/**/*.c',
        ])

        bld.env.append_unique(
            'CFLAGS',
            [
                '-Wno-sign-compare',
            ],
        )

        bld.objects(
            name='gh3x2x',
            source=sources,
            includes=includes,
            export_includes=includes,
            use=[
                'star-mc1_arm-gcc14.2.1_softfp+Os_common_dl',
                'star-mc1_arm-gcc14.2.1_softfp+Os_common_dsp',
                'GitInfo_star-mc1-arm-none-eabi-gcc1421(softfp+Os)',
                'star-mc1_arm-gcc14.2.1_softfp+Os_hrv',
                'star-mc1_arm-gcc14.2.1_softfp+Os_nadt',
                'star-mc1_arm-gcc14.2.1_softfp+Os_spo2',
                'arm-none-eabi-gcc-softfp-Os-gh_common',
            ],
        )
