diff options
Diffstat (limited to 'tools/configure')
-rwxr-xr-x | tools/configure | 161 |
1 files changed, 114 insertions, 47 deletions
diff --git a/tools/configure b/tools/configure index d81f0e2fe0..7f70c332ae 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -66,6 +66,32 @@ findtool(){ | |||
66 | done | 66 | done |
67 | } | 67 | } |
68 | 68 | ||
69 | # parse the argument list, returns the value after the = in case of a | ||
70 | # option=value type option, returns 0 in case of --ccache or --no-ccache, | ||
71 | # returns 1 if the searched argument type wasn't fount in the argument list | ||
72 | # Usage [var = ]`parse_args <argumenttype>`, i.e. `parse_args target` | ||
73 | |||
74 | # var definitons below are needed so that parse_args can see the arguments | ||
75 | arg1=$1 arg2=$2 arg3=$3 arg4=$4 arg5=$5 arg6=$6 arg7=$7 arg8=$8 arg9=$9 | ||
76 | |||
77 | parse_args() { | ||
78 | ret="1" | ||
79 | for i in $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7 $arg8 $arg9 | ||
80 | do | ||
81 | if [ "$1" = "--ccache" ]; then | ||
82 | if [ "$i" = "--ccache" ]; then | ||
83 | ret="0" | ||
84 | fi | ||
85 | elif [ "$1" = "--no-ccache" ]; then | ||
86 | if [ "$i" = "--no-ccache" ]; then | ||
87 | ret="0" | ||
88 | fi | ||
89 | elif [ "$1" = `echo $i|cut -d'=' -f1` ]; then | ||
90 | ret=`echo $i|cut -d'=' -f2` | ||
91 | fi | ||
92 | done | ||
93 | echo "$ret" | ||
94 | } | ||
69 | 95 | ||
70 | simcc () { | 96 | simcc () { |
71 | 97 | ||
@@ -544,7 +570,28 @@ if test "$opt" = "--help"; then | |||
544 | echo "Invoke this in a directory to generate a Makefile to build Rockbox" | 570 | echo "Invoke this in a directory to generate a Makefile to build Rockbox" |
545 | echo "Do *NOT* run this within the tools directory!" | 571 | echo "Do *NOT* run this within the tools directory!" |
546 | echo "" | 572 | echo "" |
547 | echo "Usage: configure [--ccache][--no-ccache]" | 573 | cat <<EOF |
574 | Usage: configure [OPTION]... | ||
575 | Options: | ||
576 | --target=TARGET Sets the target, TARGET can be either the target ID or | ||
577 | corresponding string. Run without this option to see the | ||
578 | available targets. | ||
579 | |||
580 | --ram=RAM Sets the RAM for certain targets. Even though any number | ||
581 | is accepted, not every number is correct. The default | ||
582 | value will be applied, if you entered a wrong number | ||
583 | (which depends on the target). Watch the output. Run | ||
584 | without this option if you are not sure which the right | ||
585 | number is. | ||
586 | |||
587 | --type=TYPE Sets the build type. The shortcut is valied. | ||
588 | Run without this option to see available types. | ||
589 | --ccache Enable ccache use (done by default these days) | ||
590 | --no-ccache Disable ccache use | ||
591 | --help Shows this message (must not be used with other options) | ||
592 | |||
593 | EOF | ||
594 | |||
548 | exit | 595 | exit |
549 | fi | 596 | fi |
550 | 597 | ||
@@ -604,6 +651,9 @@ toolsdir='\$(ROOTDIR)/tools' | |||
604 | # Figure out target platform | 651 | # Figure out target platform |
605 | # | 652 | # |
606 | 653 | ||
654 | if [ "1" != `parse_args --target` ]; then | ||
655 | buildfor=`parse_args --target`; | ||
656 | else | ||
607 | echo "Enter target platform:" | 657 | echo "Enter target platform:" |
608 | cat <<EOF | 658 | cat <<EOF |
609 | ==Archos== ==iriver== ==Apple iPod== | 659 | ==Archos== ==iriver== ==Apple iPod== |
@@ -628,10 +678,12 @@ cat <<EOF | |||
628 | 71) M:Robe 100 | 678 | 71) M:Robe 100 |
629 | ==Creative== | 679 | ==Creative== |
630 | 90) Zen Vision:M | 680 | 90) Zen Vision:M |
681 | |||
631 | EOF | 682 | EOF |
632 | 683 | ||
633 | buildfor=`input`; | 684 | buildfor=`input`; |
634 | 685 | ||
686 | fi | ||
635 | # Set of tools built for all target platforms: | 687 | # Set of tools built for all target platforms: |
636 | toolset="rdf2binary convbdf codepages" | 688 | toolset="rdf2binary convbdf codepages" |
637 | 689 | ||
@@ -1538,36 +1590,42 @@ EOF | |||
1538 | # | 1590 | # |
1539 | 1591 | ||
1540 | if [ -z "$memory" ]; then | 1592 | if [ -z "$memory" ]; then |
1541 | 1593 | case $target_id in | |
1542 | case $target_id in | 1594 | 15) |
1543 | 15) | 1595 | echo "Enter size of your RAM (in MB): (Defaults to 32)" |
1544 | echo "Enter size of your RAM (in MB): (Defaults to 32)" | 1596 | if [ "1" != `parse_args --ram` ]; then |
1545 | size=`input`; | 1597 | size=`parse_args --ram`; |
1546 | case $size in | 1598 | else |
1547 | 60|64) | 1599 | size=`input`; |
1548 | memory="64" | 1600 | fi |
1549 | ;; | 1601 | case $size in |
1550 | *) | 1602 | 60|64) |
1551 | memory="32" | 1603 | memory="64" |
1552 | ;; | 1604 | ;; |
1553 | esac | 1605 | *) |
1554 | ;; | 1606 | memory="32" |
1555 | 1607 | ;; | |
1556 | *) | 1608 | esac |
1557 | echo "Enter size of your RAM (in MB): (defaults to 2)" | 1609 | ;; |
1558 | size=`input`; | 1610 | *) |
1559 | case $size in | 1611 | echo "Enter size of your RAM (in MB): (Defaults to 2)" |
1560 | 8) | 1612 | if [ "1" != `parse_args --ram` ]; then |
1561 | memory="8" | 1613 | size=`parse_args --ram`; |
1562 | ;; | 1614 | else |
1563 | *) | 1615 | size=`input`; |
1564 | memory="2" | 1616 | fi |
1565 | ;; | 1617 | case $size in |
1566 | esac | 1618 | 8) |
1567 | ;; | 1619 | memory="8" |
1568 | esac | 1620 | ;; |
1569 | 1621 | *) | |
1570 | echo "Memory size selected: $memory MB" | 1622 | memory="2" |
1623 | ;; | ||
1624 | esac | ||
1625 | ;; | ||
1626 | esac | ||
1627 | echo "Memory size selected: $memory MB" | ||
1628 | echo "" | ||
1571 | fi | 1629 | fi |
1572 | #remove end | 1630 | #remove end |
1573 | 1631 | ||
@@ -1577,21 +1635,22 @@ fi | |||
1577 | 1635 | ||
1578 | # the ifp7x0 is the only platform that supports building a gdb stub like | 1636 | # the ifp7x0 is the only platform that supports building a gdb stub like |
1579 | # this | 1637 | # this |
1580 | case $modelname in | 1638 | case $modelname in |
1581 | ifp7xx) | 1639 | ifp7xx) |
1582 | gdbstub="(G)DB stub, " | 1640 | gdbstub="(G)DB stub, " |
1583 | ;; | 1641 | ;; |
1584 | e200r|e200) | 1642 | e200r|e200) |
1585 | gdbstub="(I)installer, " | 1643 | gdbstub="(I)installer, " |
1586 | ;; | 1644 | ;; |
1587 | *) | 1645 | *) |
1588 | ;; | 1646 | ;; |
1589 | esac | 1647 | esac |
1590 | 1648 | if [ "1" != `parse_args --type` ]; then | |
1591 | echo "" | 1649 | option=`parse_args --type`; |
1592 | echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual (N)" | 1650 | else |
1593 | 1651 | echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual: (Defaults to N)" | |
1594 | option=`input`; | 1652 | option=`input`; |
1653 | fi | ||
1595 | 1654 | ||
1596 | case $option in | 1655 | case $option in |
1597 | [Ii]) | 1656 | [Ii]) |
@@ -1798,12 +1857,20 @@ if test "$CC" = "m68k-elf-gcc"; then | |||
1798 | # convert -O to -Os to get smaller binaries! | 1857 | # convert -O to -Os to get smaller binaries! |
1799 | GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'` | 1858 | GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'` |
1800 | fi | 1859 | fi |
1860 | for path in $PATH | ||
1861 | do | ||
1862 | # echo "checks for $file in $path" >&2 | ||
1863 | if test -f "$path/$file"; then | ||
1864 | echo "$path/$file" | ||
1865 | return | ||
1866 | fi | ||
1867 | done | ||
1801 | 1868 | ||
1802 | if test "$1" = "--ccache"; then | 1869 | if [ "1" != `parse_args --ccache` ]; then |
1803 | echo "Enable ccache for building" | 1870 | echo "Enable ccache for building" |
1804 | ccache="ccache" | 1871 | ccache="ccache" |
1805 | else | 1872 | else |
1806 | if test "$1" != "--no-ccache"; then | 1873 | if [ "1" = `parse_args --no-ccache` ]; then |
1807 | ccache=`findtool ccache` | 1874 | ccache=`findtool ccache` |
1808 | if test -n "$ccache"; then | 1875 | if test -n "$ccache"; then |
1809 | echo "Found and uses ccache ($ccache)" | 1876 | echo "Found and uses ccache ($ccache)" |