2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 # Collect dummy C files in firmware/asm
11 ASM_DUMMY_SRC
:= $(notdir $(call preprocess
, $(FIRMDIR
)/asm
/SOURCES
))
13 # Get the corresponding real source files under firmware/asm/$ARCH (C or ASM)
14 # strip arch_ prefix from $(ARCH)
15 ASM_ARCH
:= $(subst arch_
,,$(ARCH
))
16 ASM_C_SRC
:= $(addprefix $(FIRMDIR
)/asm
/$(ASM_ARCH
)/,$(ASM_DUMMY_SRC
))
17 ASM_S_SRC
:= $(ASM_C_SRC
:.c
=.S
)
19 # ASM_SRC now contains only files that exist under $ARCH
20 ASM_SRC
:= $(wildcard $(ASM_C_SRC
))
21 ASM_SRC
+= $(wildcard $(ASM_S_SRC
))
23 # GEN_SRC now contains a .c for each file in ASM_DUMMY_SRC that's not in ASM_SRC
24 # I.e. fallback to a generic C source if no corresponding file in $ARCH is found
25 GEN_SRC
:= $(filter-out $(notdir $(ASM_SRC
:.S
=.c
)),$(ASM_DUMMY_SRC
))
26 GEN_SRC
:= $(addprefix $(FIRMDIR
)/asm
/,$(GEN_SRC
))
28 FIRMLIB_SRC
+= $(ASM_SRC
)
29 FIRMLIB_SRC
+= $(GEN_SRC
)