diff options
-rwxr-xr-x | tools/configure | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/tools/configure b/tools/configure new file mode 100755 index 0000000000..44f359b97c --- /dev/null +++ b/tools/configure | |||
@@ -0,0 +1,137 @@ | |||
1 | #!/bin/sh | ||
2 | # __________ __ ___. | ||
3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | # \/ \/ \/ \/ \/ | ||
8 | # $Id$ | ||
9 | # | ||
10 | |||
11 | target=$1 | ||
12 | |||
13 | input() { | ||
14 | read response | ||
15 | echo $response | ||
16 | } | ||
17 | |||
18 | echo "Setup your Rockbox build environment." | ||
19 | echo "http://bjorn.haxx.se/rockbox/" | ||
20 | echo "" | ||
21 | |||
22 | if [ -z "$target" ]; then | ||
23 | |||
24 | ################################################################## | ||
25 | # Figure out target platform | ||
26 | # | ||
27 | |||
28 | echo "Enter target platform: (defaults to Recorder)" | ||
29 | |||
30 | echo "1 - Archos Player old LCD" | ||
31 | echo "2 - Archos Player/Studio new LCD" | ||
32 | echo "3 - Archos Recorder" | ||
33 | |||
34 | getit=`input`; | ||
35 | |||
36 | case $getit in | ||
37 | |||
38 | 1) | ||
39 | target="-DARCHOS_PLAYER_OLD" | ||
40 | ;; | ||
41 | 2) | ||
42 | target="-DARCHOS_PLAYER" | ||
43 | ;; | ||
44 | |||
45 | 3) | ||
46 | target="-DARCHOS_RECORDER" | ||
47 | ;; | ||
48 | |||
49 | *) | ||
50 | target="-DARCHOS_RECORDER" | ||
51 | ;; | ||
52 | esac | ||
53 | fi | ||
54 | |||
55 | |||
56 | ################################################################## | ||
57 | # Figure out debug on/off | ||
58 | # | ||
59 | echo "" | ||
60 | echo "Build DEBUG version? (y/N)" | ||
61 | |||
62 | option=`input`; | ||
63 | |||
64 | case $option in | ||
65 | [Yy]) | ||
66 | debug="-DDEBUG" | ||
67 | ;; | ||
68 | *) | ||
69 | debug="" | ||
70 | ;; | ||
71 | |||
72 | esac | ||
73 | |||
74 | ################################################################## | ||
75 | # Figure out where the firmware code is! | ||
76 | # | ||
77 | |||
78 | firmfile="start.s" # a file to check for in the firmware root dir | ||
79 | |||
80 | for dir in . .. ../firmware ../../firmware; do | ||
81 | if [ -f $dir/$firmfile ]; then | ||
82 | firmdir=$dir | ||
83 | fi | ||
84 | done | ||
85 | |||
86 | if [ -z "$firmdir" ]; then | ||
87 | echo "This script couldn't find your firmware directory. Please enter the" | ||
88 | echo "full path to the firmware directory here:" | ||
89 | |||
90 | firmdir=`input` | ||
91 | fi | ||
92 | |||
93 | ################################################################## | ||
94 | # Figure out where the apps code is! | ||
95 | # | ||
96 | |||
97 | appsfile="credits.c" # a file to check for in the apps root dir | ||
98 | |||
99 | for dir in $firmdir/apps $firmdir/../apps . .. ../apps ../../apps; do | ||
100 | if [ -f $dir/$appsfile ]; then | ||
101 | appsdir=$dir | ||
102 | fi | ||
103 | done | ||
104 | |||
105 | if [ -z "$appsdir" ]; then | ||
106 | echo "This script couldn't find your apps directory. Please enter the" | ||
107 | echo "full path to the apps directory here:" | ||
108 | |||
109 | appsdir=`input` | ||
110 | fi | ||
111 | |||
112 | echo "Firmware directory: $firmdir" | ||
113 | echo "Apps directory: $appsdir" | ||
114 | echo "CFLAGS=\"$debug $target\"" | ||
115 | |||
116 | pwd=`pwd`; | ||
117 | |||
118 | sed \ | ||
119 | -e "s,@FIRMDIR@,$firmdir,g" \ | ||
120 | -e "s,@APPSDIR@,$appsdir,g" \ | ||
121 | -e "s,@DEBUG@,$debug,g" \ | ||
122 | -e "s,@TARGET@,$target,g" \ | ||
123 | -e "s,@PWD@,$pwd,g" \ | ||
124 | <<EOF > Makefile | ||
125 | FIRMDIR=@FIRMDIR@ | ||
126 | APPSDIR=@APPSDIR@ | ||
127 | DEBUG=@DEBUG@ | ||
128 | TARGET=@TARGET@ | ||
129 | THISDIR=@PWD@ | ||
130 | |||
131 | CFLAGS=$(DEBUG) $(TARGET) | ||
132 | |||
133 | all: | ||
134 | make -C $(FIRMDIR) CFLAGS=$(CFLAGS) OBJDIR=$(THISDIR) | ||
135 | make -C $(APPSDIR) CFLAGS=$(CFLAGS) OBJDIR=$(THISDIR) | ||
136 | |||
137 | EOF | ||