
config("tizen_common") {
    defines = []
    cflags = []
    ldflags = []

    if (debug_build) {
        defines += [
            "_DEBUG",
        ]

        cflags += [
            "-g3",
            "-O0",
        ]
    } else {
        cflags += [
            "-O2",
        ]
    }

    if (verbose_build) {
        cflags += ["-v"]
        ldflags += ["-v"]
    }

    if(test_build) {
        defines += [
            "TEST_BUILD",
        ]
    }
}

config("executable_config") {
    cflags = [
        "-fmessage-length=0",
        "-fPIE",
    ]

    ldflags = [
        "-pie",
        "-pthread",
        "-Wl,--version-script=" + rebase_path("//build/.exportmap", root_build_dir),
        "-Wl,--as-needed",
    ]

    configs = [
        ":tizen_common",
    ]
}

config("sharedlib_config") {
    cflags = [
        "-fmessage-length=0",
        "-fPIC",
        "-fvisibility=hidden",
    ]

    ldflags = [
        "-pthread",
        "-Wl,--as-needed",
    ]

    configs = [
        ":tizen_common",
    ]
}

config("staticlib_config") {
    cflags = [
        "-fmessage-length=0",
        "-fPIE",
        "-fvisibility=hidden",
    ]

    ldflags = [
        "-pthread",
        "-Wl,--as-needed",
    ]

    configs = [
        ":tizen_common",
    ]
}

config("test_config") {
    include_dirs = test_incs

    cflags = [
        "-fmessage-length=0",
        "-fPIE",
    ]

    ldflags = [
        "-pie",
        "-pthread",
        "-Wl,--version-script=" + rebase_path("//build/.exportmap", root_build_dir),
        "-Wl,--as-needed",
    ]

    configs = [
        ":tizen_common",
    ]
}

config("profile_config") {
    configs = [
        "${tizen_core}/native/toolchains/tizen-${api_version}:${arch}_${compiler}_config",
        "${tizen_core}/native/rootstraps/${profile}-${api_version}/$rootstrap/$arch:rootstrap_config",
    ]
}
