GitHub

@@ -1,16 +1,17 @@

11

#!/bin/bash

223-

# Convenience wrapper to set CROSS_COMPILE variable to musl-cross-make pathname

4-

# using "mcm" symlink to musl-cross-make output directory.

3+

# Convenience wrapper to set CROSS_COMPILE variable from short name using "ccc"

4+

# symlink (Cross cc) to directory of cross compilers named $TARGET-*-cross.

5+

# Tested with musl-cross-make output directory.

566-

# Usage: ./cross.sh TARGET ./mkroot.sh

7+

# Usage: ./cross.sh TARGET make defconfig toybox_clean root

78

# With no arguments, lists available targets.

89

# Use target "all" to iterate through all targets.

91010-

MCM="$(dirname "$(readlink -f "$0")")"/mcm

11-

if [ ! -d "$MCM" ]

11+

CCC="$(dirname "$(readlink -f "$0")")"/ccc

12+

if [ ! -d "$CCC" ]

1213

then

13-

echo "Create symlink 'mcm' to musl-cross-make output directory"

14+

echo "Create symlink 'ccc' to cross compiler directory"

1415

exit 1

1516

fi

1617

@@ -19,7 +20,7 @@ unset X Y

1920

# Display target list?

2021

list()

2122

{

22-

ls "$MCM" | sed 's/-.*//' | sort -u | xargs

23+

ls "$CCC" | sed 's/-.*//' | sort -u | xargs

2324

}

2425

[ $# -eq 0 ] && list && exit

2526

@@ -42,7 +43,7 @@ fi

42434344

# Call command with CROSS_COMPILE= as its first argument

444545-

Y=$(readlink -f "$MCM"/$X-*cross)

46+

Y=$(readlink -f "$CCC"/$X-*cross)

4647

X=$(basename "$Y")

4748

X="$Y/bin/${X/-cross/-}"

4849

[ ! -e "${X}cc" ] && echo "${X}cc not found" && exit 1

Read the original on github.com ↗