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