# Copyright 2019 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# Generates a host Linux gcc toolchain for a specific target.
#
# Args:
#   toolchain_cflags: Additional C/C++ compiler flags for the target.
#   toolchain_ldflags: Additional linker flags for the target.
template("host_gcc") {
  _cflags_list = [
    # Colorize output. Ninja's GCC invocation disables color by default.
    "-fdiagnostics-color",

    # Disable obnoxious ABI warning.
    #
    # GCC 7.1 adds an over-zealous ABI warning with little useful information
    # on how to resolve the issue. The warning you get is:
    #
    #   note: parameter passing for argument of type '...' changed in GCC 7.1
    #
    # There is no other information, and searching for the error is needed to
    # understand what is happening. For upstream Pigweed, we compile from
    # source so this is irrelevant; so disable it.
    #
    # See: https://gcc.gnu.org/gcc-7/changes.html (search for "psabi").
    #      https://gcc.gnu.org/ml/gcc/2017-05/msg00073.html
    "-Wno-psabi",
  ]

  if (defined(invoker.toolchain_cflags)) {
    _cflags_list += invoker.toolchain_cflags
  }

  _toolchain_cflags = string_join(" ", _cflags_list)

  _toolchain_ldflags = ""
  if (defined(invoker.toolchain_ldflags)) {
    foreach(flag, invoker.toolchain_ldflags) {
      _toolchain_ldflags += " " + flag
    }
  }

  _ar = "ar"
  _cc = "gcc"
  _cxx = "g++"

  toolchain(target_name) {
    tool("asm") {
      depfile = "{{output}}.d"
      command = "$_cc -MMD -MF $depfile $_toolchain_cflags {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
      depsformat = "gcc"
      description = "as {{output}}"
      outputs = [
        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
      ]
    }

    tool("cc") {
      depfile = "{{output}}.d"
      command = "$_cc -MMD -MF $depfile $_toolchain_cflags {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
      depsformat = "gcc"
      description = "cc {{output}}"
      outputs = [
        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
      ]
    }

    tool("cxx") {
      depfile = "{{output}}.d"
      command = "$_cxx -MMD -MF $depfile $_toolchain_cflags {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
      depsformat = "gcc"
      description = "c++ {{output}}"
      outputs = [
        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
      ]
    }

    tool("alink") {
      command = "rm -f {{output}} && $_ar rcs {{output}} {{inputs}}"
      description = "ar {{target_output_name}}{{output_extension}}"
      outputs = [
        "{{target_out_dir}}/{{target_output_name}}{{output_extension}}",
      ]
      default_output_extension = ".a"
    }

    lib_switch = "-l"
    lib_dir_switch = "-L"

    _link_outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
    _link_mapfile = "{{output_dir}}/{{target_output_name}}.map"
    _link_command = "$_cxx {{ldflags}} -Wl,--gc-sections $_toolchain_cflags $_toolchain_ldflags -Wl,--start-group {{inputs}} -Wl,--end-group {{libs}} -Wl,-Map=$_link_mapfile -o $_link_outfile"

    tool("link") {
      command = _link_command
      description = "ld $_link_outfile"
      outputs = [
        _link_outfile,
      ]
      default_output_dir = "{{target_out_dir}}"
      default_output_extension = ""
    }

    tool("solink") {
      command = _link_command + " -shared"
      description = "ld -shared $_link_outfile"
      outputs = [
        _link_outfile,
      ]
      default_output_dir = "{{target_out_dir}}"
      default_output_extension = ".so"
    }

    tool("stamp") {
      command = "touch {{output}}"
      description = "stamp {{output}}"
    }

    tool("copy") {
      command = "cp -af {{source}} {{output}}"
      description = "cp {{source}} {{output}}"
    }
  }
}
