| # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| template("lex") { |
| forward_variables_from(invoker, [ "lexer_out_dir" ]) |
| cc_dir = "${root_gen_dir}/lex/${lexer_out_dir}" |
| |
| action_name = "${target_name}_action" |
| outputs_template = [ "${cc_dir}/{{source_name_part}}.c" ] |
| |
| action_foreach(action_name) { |
| outputs = outputs_template |
| script = "//common-mk/file_generator_wrapper.py" |
| sources = invoker.sources |
| args = [ |
| "flex", |
| "-o", |
| ] + outputs + [ "{{source}}" ] |
| } |
| |
| source_set(target_name) { |
| forward_variables_from(invoker, [ "defines" ]) |
| |
| sources = process_file_template(invoker.sources, outputs_template) |
| deps = [ |
| ":$action_name", |
| ] |
| } |
| } |