summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/asm/SOURCES1
-rw-r--r--firmware/asm/asm.make27
-rw-r--r--firmware/firmware.make2
-rwxr-xr-xtools/configure35
4 files changed, 63 insertions, 2 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
11ASM_DUMMY_SRC := $(notdir $(call preprocess, $(FIRMDIR)/asm/SOURCES))
12
13# Get the corresponding real source files under firmware/asm/$ARCH (C or ASM)
14ASM_C_SRC := $(addprefix $(FIRMDIR)/asm/$(ARCH)/,$(ASM_DUMMY_SRC))
15ASM_S_SRC := $(ASM_C_SRC:.c=.S)
16
17# ASM_SRC now contains only files that exist under $ARCH
18ASM_SRC := $(wildcard $(ASM_C_SRC))
19ASM_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
23GEN_SRC := $(filter-out $(notdir $(ASM_SRC:.S=.c)),$(ASM_DUMMY_SRC))
24GEN_SRC := $(addprefix $(FIRMDIR)/asm/,$(GEN_SRC))
25
26FIRMLIB_SRC += $(ASM_SRC)
27FIRMLIB_SRC += $(GEN_SRC)
diff --git a/firmware/firmware.make b/firmware/firmware.make
index aab735aa91..94747613ba 100644
--- a/firmware/firmware.make
+++ b/firmware/firmware.make
@@ -12,6 +12,8 @@ ifndef APP_TYPE
12INCLUDES += -I$(FIRMDIR)/libc/include 12INCLUDES += -I$(FIRMDIR)/libc/include
13endif 13endif
14 14
15include $(FIRMDIR)/asm/asm.make
16
15FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES) 17FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES)
16FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC)) 18FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC))
17ifeq (,$(findstring -DARCHOS_PLAYER,$(TARGET))) 19ifeq (,$(findstring -DARCHOS_PLAYER,$(TARGET)))
diff --git a/tools/configure b/tools/configure
index 789f6c01db..0a4766d505 100755
--- a/tools/configure
+++ b/tools/configure
@@ -49,6 +49,7 @@ input() {
49prefixtools () { 49prefixtools () {
50 prefix="$1" 50 prefix="$1"
51 CC=${prefix}gcc 51 CC=${prefix}gcc
52 CPP=${prefix}cpp
52 WINDRES=${prefix}windres 53 WINDRES=${prefix}windres
53 DLLTOOL=${prefix}dlltool 54 DLLTOOL=${prefix}dlltool
54 DLLWRAP=${prefix}dllwrap 55 DLLWRAP=${prefix}dllwrap
@@ -671,6 +672,7 @@ ypr0cc () {
671 endian="little" 672 endian="little"
672 thread_support="HAVE_SIGALTSTACK_THREADS" 673 thread_support="HAVE_SIGALTSTACK_THREADS"
673 app_type="ypr0" 674 app_type="ypr0"
675 arch="unknown"
674 676
675 # Include path 677 # Include path
676 GCCOPTS="$GCCOPTS -D_GNU_SOURCE=1 -U_FORTIFY_SOURCE -D_REENTRANT" 678 GCCOPTS="$GCCOPTS -D_GNU_SOURCE=1 -U_FORTIFY_SOURCE -D_REENTRANT"
@@ -3639,6 +3641,7 @@ fi
3639HOSTCC=`findtool gcc --lit` 3641HOSTCC=`findtool gcc --lit`
3640HOSTAR=`findtool ar --lit` 3642HOSTAR=`findtool ar --lit`
3641CC=`findtool ${CC} --lit` 3643CC=`findtool ${CC} --lit`
3644CPP=`findtool ${CPP} --lit`
3642LD=`findtool ${AR} --lit` 3645LD=`findtool ${AR} --lit`
3643AR=`findtool ${AR} --lit` 3646AR=`findtool ${AR} --lit`
3644AS=`findtool ${AS} --lit` 3647AS=`findtool ${AS} --lit`
@@ -3648,6 +3651,32 @@ DLLTOOL=`findtool ${DLLTOOL} --lit`
3648DLLWRAP=`findtool ${DLLWRAP} --lit` 3651DLLWRAP=`findtool ${DLLWRAP} --lit`
3649RANLIB=`findtool ${RANLIB} --lit` 3652RANLIB=`findtool ${RANLIB} --lit`
3650 3653
3654
3655if [ -z "$arch" ]; then
3656 cpp_defines=$(echo "" | $CPP -dD)
3657 if [ -n "$(echo $cpp_defines | grep -w __sh__)" ]; then
3658 arch="sh"
3659 elif [ -n "$(echo $cpp_defines | grep -w __m68k__)" ]; then
3660 arch="m68k"
3661 elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then
3662 arch="arm"
3663 elif [ -n "$(echo $cpp_defines | grep -w __mips__)" ]; then
3664 arch="mips"
3665 elif [ -n "$(echo $cpp_defines | grep -w _X86_)" ]; then
3666 arch="x86"
3667 elif [ -n "$(echo $cpp_defines | grep -w __x86_64__)" ]; then
3668 arch="amd64"
3669 else
3670 arch="unknown"
3671 echo "Warning: Could not determine target arch"
3672 fi
3673 if [ "$arch" != "unknown" ]; then
3674 echo "Automatically selected arch: $arch"
3675 fi;
3676else
3677 echo "Manually selected arch: $arch"
3678fi
3679
3651if test -n "$ccache"; then 3680if test -n "$ccache"; then
3652 CC="$ccache $CC" 3681 CC="$ccache $CC"
3653fi 3682fi
@@ -3718,11 +3747,11 @@ EOF
3718if test -n "$t_cpu"; then 3747if test -n "$t_cpu"; then
3719 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model" 3748 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
3720 3749
3721 if [ "$t_cpu" = "hosted" ] && [ "$t_manufacturer" = "maemo" ]; then 3750 if [ "$application" = "yes" ] && [ "$t_manufacturer" = "maemo" ]; then
3722 # Maemo needs the SDL port, too 3751 # Maemo needs the SDL port, too
3723 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/app" 3752 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/app"
3724 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl" 3753 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl"
3725 elif [ "$t_cpu" = "hosted" ] && [ "$t_manufacturer" = "pandora" ]; then 3754 elif [ "$application" = "yes" ] && [ "$t_manufacturer" = "pandora" ]; then
3726 # Pandora needs the SDL port, too 3755 # Pandora needs the SDL port, too
3727 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/app" 3756 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/app"
3728 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl" 3757 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl"
@@ -3780,6 +3809,7 @@ export ARCHOSROM=${archosrom}
3780export FLASHFILE=${flash} 3809export FLASHFILE=${flash}
3781export TARGET_ID=${target_id} 3810export TARGET_ID=${target_id}
3782export TARGET=-D${target} 3811export TARGET=-D${target}
3812export ARCH=${arch}
3783export CPU=${t_cpu} 3813export CPU=${t_cpu}
3784export MANUFACTURER=${t_manufacturer} 3814export MANUFACTURER=${t_manufacturer}
3785export OBJDIR=${pwd} 3815export OBJDIR=${pwd}
@@ -3801,6 +3831,7 @@ export EXTRA_DEFINES=${extradefines}
3801export HOSTCC=${HOSTCC} 3831export HOSTCC=${HOSTCC}
3802export HOSTAR=${HOSTAR} 3832export HOSTAR=${HOSTAR}
3803export CC=${CC} 3833export CC=${CC}
3834export CPP=${CPP}
3804export LD=${LD} 3835export LD=${LD}
3805export AR=${AR} 3836export AR=${AR}
3806export AS=${AS} 3837export AS=${AS}