2002-05-23 09:11:35 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
target=$1
|
2002-05-23 10:10:44 +00:00
|
|
|
debug=$2
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-08-11 09:17:47 +00:00
|
|
|
extra_defines="-"
|
|
|
|
|
2002-05-23 09:11:35 +00:00
|
|
|
input() {
|
|
|
|
read response
|
|
|
|
echo $response
|
|
|
|
}
|
|
|
|
|
2002-06-06 13:33:38 +00:00
|
|
|
simul () {
|
2002-08-02 12:06:07 +00:00
|
|
|
|
|
|
|
if [ -z "$simver" ]; then
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
# Figure out win32/x11 GUI
|
|
|
|
#
|
|
|
|
echo ""
|
|
|
|
echo "Build (W)in32 or (X)11 GUI version? (X)"
|
|
|
|
|
|
|
|
option=`input`;
|
|
|
|
|
|
|
|
case $option in
|
|
|
|
[Ww])
|
|
|
|
simver="win32"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
simver="x11"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2002-05-31 07:22:38 +00:00
|
|
|
##################################################################
|
|
|
|
# Figure out where the firmware code is!
|
|
|
|
#
|
|
|
|
|
2002-08-02 12:06:07 +00:00
|
|
|
simfile="$simver/lcd-$simver.c" # a file to check for in the uisimulator root dir
|
2002-05-31 07:22:38 +00:00
|
|
|
|
|
|
|
for dir in uisimulator . .. ../uisimulator ../../uisimulator; do
|
|
|
|
if [ -f "$dir/$simfile" ]; then
|
2002-08-02 12:06:07 +00:00
|
|
|
simdir="$dir/$simver"
|
2002-05-31 07:22:38 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$simdir" ]; then
|
2002-08-02 12:06:07 +00:00
|
|
|
echo "This script couldn't find your uisimulator/$simver directory. Please enter the"
|
|
|
|
echo "full path to your uisimulator/$simver directory here:"
|
2002-05-31 07:22:38 +00:00
|
|
|
|
|
|
|
simdir=`input`
|
|
|
|
fi
|
|
|
|
|
|
|
|
sed > Makefile \
|
|
|
|
-e "s,@SIMDIR@,${simdir},g" \
|
|
|
|
-e "s,@TARGET@,${target},g" \
|
|
|
|
-e "s,@DEBUG@,${debug},g" \
|
|
|
|
-e "s,@DISPLAY@,${display},g" \
|
|
|
|
-e "s,@KEYPAD@,${keypad},g" \
|
|
|
|
-e "s,@PWD@,${pwd},g" \
|
2002-08-02 12:06:07 +00:00
|
|
|
-e "s,@SIMVER@,${simver},g" \
|
2002-08-11 09:17:47 +00:00
|
|
|
-e "s,@EXTRA_DEFINES@,${extra_defines},g" \
|
2002-05-31 07:22:38 +00:00
|
|
|
<<EOF
|
2002-08-11 09:17:47 +00:00
|
|
|
## Automaticly generated. http://rockbox.haxx.se
|
2002-05-31 07:22:38 +00:00
|
|
|
|
|
|
|
SIMDIR=@SIMDIR@
|
|
|
|
DEBUG=@DEBUG@
|
|
|
|
TARGET=@TARGET@
|
|
|
|
DISPLAY=@DISPLAY@
|
|
|
|
KEYPAD=@KEYPAD@
|
|
|
|
THISDIR="@PWD@"
|
2002-08-02 12:06:07 +00:00
|
|
|
SIMVER=@SIMVER@
|
2002-07-15 13:19:00 +00:00
|
|
|
VERSION=\$(shell date +%y%m%d-%H%M)
|
2002-08-11 09:17:47 +00:00
|
|
|
EXTRA_DEFINES=@EXTRA_DEFINES@
|
2002-05-31 07:22:38 +00:00
|
|
|
|
2002-07-26 14:13:03 +00:00
|
|
|
.PHONY:
|
2002-05-31 07:22:38 +00:00
|
|
|
|
|
|
|
all: sim
|
|
|
|
|
|
|
|
sim:
|
2002-08-11 09:17:47 +00:00
|
|
|
\$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) EXTRA_DEFINES=\$(EXTRA_DEFINES)
|
2002-05-31 07:22:38 +00:00
|
|
|
|
2002-08-15 10:07:27 +00:00
|
|
|
clean:
|
2002-08-07 14:37:53 +00:00
|
|
|
\$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) clean
|
2002-05-31 07:22:38 +00:00
|
|
|
|
2002-08-15 10:07:27 +00:00
|
|
|
tags:
|
|
|
|
@rm -f TAGS
|
|
|
|
make -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) tags
|
2002-05-31 07:22:38 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2002-06-06 13:33:38 +00:00
|
|
|
echo "Created Makefile"
|
2002-05-31 08:38:35 +00:00
|
|
|
|
2002-06-06 13:33:38 +00:00
|
|
|
if [ -d "archos" ]; then
|
|
|
|
echo "sub directory archos already present"
|
|
|
|
else
|
|
|
|
mkdir archos
|
|
|
|
echo "created an archos subdirectory for simulating the hard disk"
|
|
|
|
fi
|
2002-05-31 08:38:35 +00:00
|
|
|
|
2002-05-31 07:22:38 +00:00
|
|
|
}
|
|
|
|
|
2002-05-31 08:21:20 +00:00
|
|
|
if [ "$target" = "--help" -o \
|
|
|
|
"$target" = "-h" ]; then
|
|
|
|
echo "Just invoke the script and answer the questions."
|
|
|
|
echo "This script will write a Makefile for you"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2002-05-31 07:22:38 +00:00
|
|
|
# get our current directory
|
|
|
|
pwd=`pwd`;
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-05-23 10:10:44 +00:00
|
|
|
if [ "$target" = "update" ]; then
|
|
|
|
target=""
|
|
|
|
if [ -f Makefile ]; then
|
|
|
|
if { grep "^## Auto" Makefile >/dev/null 2>&1 ; } then
|
|
|
|
echo "Existing generated Makefile found. Getting defaults from it."
|
|
|
|
target=`grep "^TARGET=" Makefile | cut -d= -f2-`
|
|
|
|
debug=`grep "^DEBUG=" Makefile | cut -d= -f2-`
|
2002-08-11 09:17:47 +00:00
|
|
|
extra_defines=`grep "^EXTRA_DEFINES=" Makefile | cut -d= -f2-`
|
2002-06-03 21:56:48 +00:00
|
|
|
|
|
|
|
if [ "$debug" = "SIMULATOR=1" ]; then
|
|
|
|
simulator="yes"
|
2002-06-03 22:26:56 +00:00
|
|
|
display=`grep "^DISPLAY=" Makefile | cut -d= -f2-`
|
|
|
|
keypad=`grep "^KEYPAD=" Makefile | cut -d= -f2-`
|
2002-08-02 12:06:07 +00:00
|
|
|
simver=`grep "^SIMVER=" Makefile | cut -d= -f2-`
|
2002-06-03 21:56:48 +00:00
|
|
|
fi
|
2002-05-23 10:10:44 +00:00
|
|
|
fi
|
|
|
|
fi
|
2002-05-31 07:22:38 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
echo "Setup your Rockbox build environment."
|
2002-08-11 09:17:47 +00:00
|
|
|
echo "http://rockbox.haxx.se/"
|
2002-05-31 07:22:38 +00:00
|
|
|
echo ""
|
|
|
|
|
2002-05-23 10:10:44 +00:00
|
|
|
fi
|
|
|
|
|
2002-05-23 09:11:35 +00:00
|
|
|
if [ -z "$target" ]; then
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
# Figure out target platform
|
|
|
|
#
|
|
|
|
|
|
|
|
echo "Enter target platform: (defaults to Recorder)"
|
|
|
|
|
|
|
|
echo "1 - Archos Player old LCD"
|
|
|
|
echo "2 - Archos Player/Studio new LCD"
|
|
|
|
echo "3 - Archos Recorder"
|
|
|
|
|
|
|
|
getit=`input`;
|
|
|
|
|
|
|
|
case $getit in
|
|
|
|
|
|
|
|
1)
|
|
|
|
target="-DARCHOS_PLAYER_OLD"
|
2002-05-31 07:22:38 +00:00
|
|
|
display="-DHAVE_LCD_CHARCELLS"
|
|
|
|
keypad="-DHAVE_PLAYER_KEYPAD"
|
2002-05-23 09:11:35 +00:00
|
|
|
;;
|
2002-05-31 07:22:38 +00:00
|
|
|
|
2002-05-23 09:11:35 +00:00
|
|
|
2)
|
|
|
|
target="-DARCHOS_PLAYER"
|
2002-05-31 07:22:38 +00:00
|
|
|
display="-DHAVE_LCD_CHARCELLS"
|
|
|
|
keypad="-DHAVE_PLAYER_KEYPAD"
|
2002-05-23 09:11:35 +00:00
|
|
|
;;
|
|
|
|
|
2002-05-31 07:22:38 +00:00
|
|
|
*|3)
|
2002-05-23 09:11:35 +00:00
|
|
|
target="-DARCHOS_RECORDER"
|
2002-05-31 07:22:38 +00:00
|
|
|
display="-DHAVE_LCD_BITMAP"
|
|
|
|
keypad="-DHAVE_RECORDER_KEYPAD"
|
2002-05-23 09:11:35 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2002-08-11 14:19:18 +00:00
|
|
|
if [ "-" = "$extra_defines" ]; then
|
2002-08-11 09:17:47 +00:00
|
|
|
if [ "-DARCHOS_RECORDER" = "$target" ] ; then
|
|
|
|
|
|
|
|
echo "Loadable fonts support? (N)"
|
|
|
|
getit=`input`;
|
2002-08-13 08:40:40 +00:00
|
|
|
if [ "y" = "$getit" -o "Y" = "$getit" ] ; then
|
2002-08-11 09:17:47 +00:00
|
|
|
extra_defines="-DLOADABLE_FONTS"
|
|
|
|
else
|
|
|
|
echo "Proportional font support? (N)"
|
|
|
|
getit=`input`;
|
2002-08-13 08:40:40 +00:00
|
|
|
if [ "y" = "$getit" -o "Y" = "$getit" ] ; then
|
2002-08-11 09:17:47 +00:00
|
|
|
extra_defines="-DLCD_PROPFONTS"
|
|
|
|
else
|
|
|
|
extra_defines=""
|
|
|
|
fi
|
|
|
|
fi
|
2002-08-11 20:22:53 +00:00
|
|
|
else
|
|
|
|
extra_defines=""
|
2002-08-11 09:17:47 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2002-05-23 10:10:44 +00:00
|
|
|
if [ -z "$debug" ]; then
|
|
|
|
##################################################################
|
|
|
|
# Figure out debug on/off
|
|
|
|
#
|
|
|
|
echo ""
|
2002-05-31 07:22:38 +00:00
|
|
|
echo "Build (N)ormal, (D)ebug or (S)imulated version? (N)"
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-05-23 10:10:44 +00:00
|
|
|
option=`input`;
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-05-23 10:10:44 +00:00
|
|
|
case $option in
|
2002-05-31 07:22:38 +00:00
|
|
|
[Ss])
|
|
|
|
debug="SIMULATOR=1"
|
|
|
|
simulator="yes"
|
|
|
|
;;
|
|
|
|
[Dd])
|
2002-05-23 10:10:44 +00:00
|
|
|
debug="DEBUG=1"
|
|
|
|
;;
|
|
|
|
*)
|
2002-05-24 10:14:10 +00:00
|
|
|
debug="NODEBUG=1"
|
2002-05-23 10:10:44 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
fi
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-06-06 13:33:38 +00:00
|
|
|
if [ "yes" = "$simulator" ]; then
|
2002-05-31 07:22:38 +00:00
|
|
|
# we deal with the simulator Makefile separately
|
2002-06-06 13:33:38 +00:00
|
|
|
simul
|
2002-05-31 07:22:38 +00:00
|
|
|
exit
|
|
|
|
fi
|
2002-05-23 09:11:35 +00:00
|
|
|
|
|
|
|
##################################################################
|
|
|
|
# Figure out where the firmware code is!
|
|
|
|
#
|
|
|
|
|
2002-05-27 12:33:30 +00:00
|
|
|
firmfile="crt0.S" # a file to check for in the firmware root dir
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-05-23 09:18:14 +00:00
|
|
|
for dir in firmware . .. ../firmware ../../firmware; do
|
2002-05-23 09:11:35 +00:00
|
|
|
if [ -f $dir/$firmfile ]; then
|
|
|
|
firmdir=$dir
|
2002-05-23 09:18:14 +00:00
|
|
|
break
|
2002-05-23 09:11:35 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$firmdir" ]; then
|
|
|
|
echo "This script couldn't find your firmware directory. Please enter the"
|
|
|
|
echo "full path to the firmware directory here:"
|
|
|
|
|
|
|
|
firmdir=`input`
|
|
|
|
fi
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
# Figure out where the apps code is!
|
|
|
|
#
|
|
|
|
|
|
|
|
appsfile="credits.c" # a file to check for in the apps root dir
|
|
|
|
|
2002-05-23 12:48:04 +00:00
|
|
|
for dir in apps . .. ../apps ../../apps $firmdir/apps $firmdir/../apps; do
|
2002-05-23 09:11:35 +00:00
|
|
|
if [ -f $dir/$appsfile ]; then
|
|
|
|
appsdir=$dir
|
2002-05-23 09:18:14 +00:00
|
|
|
break
|
2002-05-23 09:11:35 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$appsdir" ]; then
|
|
|
|
echo "This script couldn't find your apps directory. Please enter the"
|
|
|
|
echo "full path to the apps directory here:"
|
|
|
|
|
|
|
|
appsdir=`input`
|
|
|
|
fi
|
|
|
|
|
2002-05-23 09:39:31 +00:00
|
|
|
sed > Makefile \
|
|
|
|
-e "s,@FIRMDIR@,${firmdir},g" \
|
|
|
|
-e "s,@APPSDIR@,${appsdir},g" \
|
|
|
|
-e "s,@DEBUG@,${debug},g" \
|
|
|
|
-e "s,@TARGET@,${target},g" \
|
2002-08-11 09:17:47 +00:00
|
|
|
-e "s,@EXTRA_DEFINES@,${extra_defines},g" \
|
2002-05-23 09:39:31 +00:00
|
|
|
-e "s,@PWD@,${pwd},g" \
|
|
|
|
<<EOF
|
2002-08-11 09:17:47 +00:00
|
|
|
## Automaticly generated. http://rockbox.haxx.se
|
2002-05-23 10:10:44 +00:00
|
|
|
|
2002-05-23 09:11:35 +00:00
|
|
|
FIRMDIR=@FIRMDIR@
|
|
|
|
APPSDIR=@APPSDIR@
|
|
|
|
DEBUG=@DEBUG@
|
|
|
|
TARGET=@TARGET@
|
2002-05-23 09:39:31 +00:00
|
|
|
THISDIR="@PWD@"
|
2002-07-15 13:19:00 +00:00
|
|
|
VERSION=\$(shell date +%y%m%d-%H%M)
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-08-11 09:17:47 +00:00
|
|
|
EXTRA_DEFINES=@EXTRA_DEFINES@
|
2002-07-26 14:13:03 +00:00
|
|
|
.PHONY: firmware apps
|
2002-05-23 13:55:26 +00:00
|
|
|
|
2002-05-31 08:38:35 +00:00
|
|
|
all: firmware apps
|
2002-05-23 13:55:26 +00:00
|
|
|
|
|
|
|
firmware:
|
2002-08-11 09:17:47 +00:00
|
|
|
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) EXTRA_DEFINES=\$(EXTRA_DEFINES)
|
2002-05-23 13:55:26 +00:00
|
|
|
|
|
|
|
apps:
|
2002-08-11 09:17:47 +00:00
|
|
|
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) EXTRA_DEFINES=\$(EXTRA_DEFINES)
|
2002-05-23 09:11:35 +00:00
|
|
|
|
2002-05-24 09:33:37 +00:00
|
|
|
clean-firmware:
|
2002-08-07 14:37:53 +00:00
|
|
|
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean
|
2002-05-24 09:33:37 +00:00
|
|
|
|
|
|
|
clean-apps:
|
2002-08-07 14:37:53 +00:00
|
|
|
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean
|
2002-05-24 09:33:37 +00:00
|
|
|
|
2002-05-23 13:55:26 +00:00
|
|
|
clean:
|
2002-08-07 14:37:53 +00:00
|
|
|
\$(MAKE) clean-firmware clean-apps
|
2002-05-23 13:55:26 +00:00
|
|
|
|
2002-08-15 09:32:59 +00:00
|
|
|
tags-firmware:
|
|
|
|
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) tags
|
|
|
|
|
|
|
|
tags-apps:
|
|
|
|
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) tags
|
|
|
|
|
|
|
|
tags:
|
|
|
|
@rm -f TAGS
|
|
|
|
\$(MAKE) tags-firmware tags-apps
|
2002-05-23 09:11:35 +00:00
|
|
|
EOF
|
2002-05-23 09:39:31 +00:00
|
|
|
|
|
|
|
echo "Created Makefile"
|