1/*
2 * Copyright (c) 2021 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/*
8 * This hackish way of including files is due to CMake issues:
9 *   https://gitlab.kitware.com/cmake/cmake/issues/11985
10 *   https://gitlab.kitware.com/cmake/cmake/issues/13718
11 *
12 * When using the "Unix Makefiles" generator, CMake simply
13 * greps for "#include" to generate dependency list.
14 * So if doing it normally, both files are being included
15 * in the dependency list. This creates weird dependency
16 * issue:
17 *
18 *   1. Using A.ld to create a linker script A.cmd.
19 *   2. Using A.cmd to generate A_prebuilt.elf.
20 *   3. Using A_prebuilt.elf to create B.ld.
21 *   4. Creating B.cmd with B.ld.
22 *   5. Creating B_prebuilt.elf using B.cmd.
23 *
24 * Since the dependency list of A.cmd contains both
25 * A.ld and B.ld, when make is invoked again, B.ld
26 * is newer than A.cmd so everything from this point on
27 * gets rebuilt. In order to break this cycle, this
28 * hackish needs to be used since CMake does not parse
29 * macros, and thus these will not appear in
30 * the dependency list. The dependencies should then be
31 * put in CMakeLists.txt instead.
32 *
33 * Note: Ninja generator does not suffer from this issue.
34 */
35#ifdef LINKER_APP_SMEM_UNALIGNED
36#define APP_SMEM_LD <app_smem_pinned_unaligned.ld>
37#else
38#define APP_SMEM_LD <app_smem_pinned_aligned.ld>
39#endif
40
41#include APP_SMEM_LD
42#undef APP_SMEM_LD
43