diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-01-07 19:49:02 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-01-22 18:46:45 +0100 |
commit | 8e8e978de6b6283b66a6829fa8c5e3b94674ce7d (patch) | |
tree | a9b9e3dfe05653f44fdf9e51c214428371d52a31 /firmware/asm | |
parent | 3c17f28eca86ff3ee9e7cef6c4d5198c27b7c03c (diff) | |
download | rockbox-8e8e978de6b6283b66a6829fa8c5e3b94674ce7d.tar.gz rockbox-8e8e978de6b6283b66a6829fa8c5e3b94674ce7d.zip |
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
Diffstat (limited to 'firmware/asm')
-rw-r--r-- | firmware/asm/SOURCES | 1 | ||||
-rw-r--r-- | firmware/asm/asm.make | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/firmware/asm/SOURCES | |||
@@ -0,0 +1 @@ | |||
diff --git a/firmware/asm/asm.make b/firmware/asm/asm.make new file mode 100644 index 0000000000..410cb6ca11 --- /dev/null +++ b/firmware/asm/asm.make | |||
@@ -0,0 +1,27 @@ | |||
1 | # __________ __ ___. | ||
2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
6 | # \/ \/ \/ \/ \/ | ||
7 | # $Id$ | ||
8 | # | ||
9 | |||
10 | # Collect dummy C files in firmware/asm | ||
11 | ASM_DUMMY_SRC := $(notdir $(call preprocess, $(FIRMDIR)/asm/SOURCES)) | ||
12 | |||
13 | # Get the corresponding real source files under firmware/asm/$ARCH (C or ASM) | ||
14 | ASM_C_SRC := $(addprefix $(FIRMDIR)/asm/$(ARCH)/,$(ASM_DUMMY_SRC)) | ||
15 | ASM_S_SRC := $(ASM_C_SRC:.c=.S) | ||
16 | |||
17 | # ASM_SRC now contains only files that exist under $ARCH | ||
18 | ASM_SRC := $(wildcard $(ASM_C_SRC)) | ||
19 | ASM_SRC += $(wildcard $(ASM_S_SRC)) | ||
20 | |||
21 | # GEN_SRC now contains a .c for each file in ASM_DUMMY_SRC that's not in ASM_SRC | ||
22 | # I.e. fallback to a generic C source if no correspinding file in $ARCH is found | ||
23 | GEN_SRC := $(filter-out $(notdir $(ASM_SRC:.S=.c)),$(ASM_DUMMY_SRC)) | ||
24 | GEN_SRC := $(addprefix $(FIRMDIR)/asm/,$(GEN_SRC)) | ||
25 | |||
26 | FIRMLIB_SRC += $(ASM_SRC) | ||
27 | FIRMLIB_SRC += $(GEN_SRC) | ||