summaryrefslogtreecommitdiff
path: root/tools/configure
blob: b65dc032959b0760abfe8b359cf18f260510b05f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/sh
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/
# $Id$
#

target=$1

input() {
    read response
    echo $response
}

echo "Setup your Rockbox build environment."
echo "http://bjorn.haxx.se/rockbox/"
echo ""

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"
    ;;
   2)
    target="-DARCHOS_PLAYER"
    ;;

   3)
    target="-DARCHOS_RECORDER"
    ;;

   *)
    target="-DARCHOS_RECORDER"
    ;;
  esac
fi


##################################################################
# Figure out debug on/off
#
echo ""
echo "Build DEBUG version? (y/N)"

option=`input`;

case $option in
  [Yy])
    debug="-DDEBUG"
    ;;
  *)
    debug=""
    ;;

esac

##################################################################
# Figure out where the firmware code is!
#

firmfile="start.s" # a file to check for in the firmware root dir

for dir in firmware . .. ../firmware ../../firmware; do
  if [ -f $dir/$firmfile ]; then
    firmdir=$dir
    break
  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

for dir in apps $firmdir/apps $firmdir/../apps . .. ../apps ../../apps; do
  if [ -f $dir/$appsfile ]; then
    appsdir=$dir
    break
  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

pwd=`pwd`;

sed > Makefile \
 -e "s,@FIRMDIR@,${firmdir},g" \
 -e "s,@APPSDIR@,${appsdir},g" \
 -e "s,@DEBUG@,${debug},g" \
 -e "s,@TARGET@,${target},g" \
 -e "s,@PWD@,${pwd},g" \
<<EOF 
FIRMDIR=@FIRMDIR@
APPSDIR=@APPSDIR@
DEBUG=@DEBUG@
TARGET=@TARGET@
THISDIR="@PWD@"

CFLAGS="\$(DEBUG) \$(TARGET)"

all:
	make -C \$(FIRMDIR) CFLAGS=\$(CFLAGS) OBJDIR=\$(THISDIR)
	make -C \$(APPSDIR) CFLAGS=\$(CFLAGS) OBJDIR=\$(THISDIR)

EOF

echo "Created Makefile"