rockbox/firmware/asm/asm.make
Thomas Martitz 8e8e978de6 Add framework to let make automatically pick optimized asm implementations over generic C ones to firmware.
Example: for a file asm/foo.c, make will look for asm/arm/foo.[cS] and
compile it if found. If not found it'll fall back to asm/foo.c.

Also introduce new ARCH make variable. This is automatically detected by
configure. It is distinct from CPU since CPU defines the dir used for
the target tree (i.e. firmware/target/X, so it can be "hosted").
ARCH really has the target isa and can be x86 for sims/raaa too.

Change-Id: I18e5d2b7b7bbc2ad2be551a74a0fcae5ffbcbf8b
2012-01-22 18:46:45 +01:00

27 lines
1.1 KiB
Makefile

# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# $Id$
#
# Collect dummy C files in firmware/asm
ASM_DUMMY_SRC := $(notdir $(call preprocess, $(FIRMDIR)/asm/SOURCES))
# Get the corresponding real source files under firmware/asm/$ARCH (C or ASM)
ASM_C_SRC := $(addprefix $(FIRMDIR)/asm/$(ARCH)/,$(ASM_DUMMY_SRC))
ASM_S_SRC := $(ASM_C_SRC:.c=.S)
# ASM_SRC now contains only files that exist under $ARCH
ASM_SRC := $(wildcard $(ASM_C_SRC))
ASM_SRC += $(wildcard $(ASM_S_SRC))
# GEN_SRC now contains a .c for each file in ASM_DUMMY_SRC that's not in ASM_SRC
# I.e. fallback to a generic C source if no correspinding file in $ARCH is found
GEN_SRC := $(filter-out $(notdir $(ASM_SRC:.S=.c)),$(ASM_DUMMY_SRC))
GEN_SRC := $(addprefix $(FIRMDIR)/asm/,$(GEN_SRC))
FIRMLIB_SRC += $(ASM_SRC)
FIRMLIB_SRC += $(GEN_SRC)