1# Copyright (c) 2020 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4
5zephyr_get_compile_options_for_lang_as_string(ASM ASM_compile_options)
6zephyr_get_compile_options_for_lang_as_string(C C_compile_options)
7zephyr_get_compile_options_for_lang_as_string(CXX CXX_compile_options)
8
9set(exports
10  "
11CC = ${CMAKE_C_COMPILER}
12CXX = ${CMAKE_CXX_COMPILER}
13OBJCOPY = ${CMAKE_OBJCOPY}
14OBJDUMP = ${CMAKE_OBJDUMP}
15AS = ${CMAKE_AS}
16AR = ${CMAKE_AR}
17NM = ${CMAKE_NM}
18GDB = ${CMAKE_GDB}
19Z_CFLAGS = -I$<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_INCLUDE_DIRECTORIES>, -I> -isystem $<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>, -isystem > -D$<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_DEFINITIONS>, -D> $<$<COMPILE_LANGUAGE:ASM>:${ASM_compile_options}> $<$<COMPILE_LANGUAGE:C>:${C_compile_options}> $<$<COMPILE_LANGUAGE:CXX>:${CXX_compile_options}>
20"
21  )
22
23# file(GENERATE writes a file at Generation time. Also, it writes one
24# file per detected configuration, in this case, each COMPILE_LANGUAGE
25# is a new configuration.
26#
27# We use 'file(GENERATE' instead of configure_file because we want to
28# generate the file after Configure-time to have all the
29# metadata. Also, we don't use 'add_custom_command' because it cannot
30# read the generator expressions that we use.
31file(GENERATE
32  OUTPUT  ${CMAKE_BINARY_DIR}/Makefile.exports.$<COMPILE_LANGUAGE>
33  CONTENT "${exports}"
34)
35