echo " --source-path=PATH path to source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
echo " --enable-cross-compile assume a cross-compiler is used"
+ echo " --sysroot=PATH root of cross-build tree"
+ echo " --sysinclude=PATH location of cross-build system headers"
echo " --target-os=OS compiler targets OS [$target_os]"
echo " --target-exec=CMD command to run executables on target"
echo " --target-path=DIR path to view of build directory on target"
logfile
nm
source_path
+ sysinclude
+ sysroot
target_exec
target_os
target_path
# gcc stupidly only outputs the basename of targets with -MM, but we need the
# full relative path for objects in subdirectories for non-recursive Make.
-DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
+DEPEND_CMD='$(CC) $(CFLAGS) -MM $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
# find source path
source_path="`dirname \"$0\"`"
ranlib="${cross_prefix}${ranlib}"
strip="${cross_prefix}${strip}"
-set_default cc nm
+sysinclude_default="${sysroot}/usr/include"
+
+set_default cc nm sysinclude
enabled cross_compile || host_cc_default=$cc
set_default host_cc
fi
rm $TMPSH
+if $cc --version 2>/dev/null | grep -q '(GCC)'; then
+ cc_type=gcc
+elif $cc --version 2>/dev/null | grep -q Intel; then
+ cc_type=icc
+elif $cc -v 2>&1 | grep -q xlc; then
+ cc_type=xlc
+fi
+
+test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
+
+if test -n "$sysroot"; then
+ case "$cc_type" in
+ gcc)
+ add_cflags --sysroot="$sysroot"
+ add_ldflags --sysroot="$sysroot"
+ ;;
+ esac
+fi
+
# compiler sanity check
check_exec <<EOF
int main(void){ return 0; }
arm|armv[4567]*l)
arch="arm"
;;
+ avr32)
+ ;;
bfin)
arch="bfin"
;;
#Darwin CC versions
if test $target_os = darwin; then
- if $cc -v 2>&1 | grep -q xlc; then
+ if enabled xlc; then
add_cflags -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto
else
add_cflags -pipe
check_cflags -Os # not all compilers support -Os
optimizations="small"
elif enabled optimizations; then
- if $cc -v 2>&1 | grep -q xlc; then
+ if enabled xlc; then
add_cflags -O5
add_ldflags -O5
else
check_cflags -fno-signed-zeros
# add some flags for Intel C Compiler
-if $cc --version 2> /dev/null | grep -q Intel; then
- # Just warnings, no remarks
- check_cflags -w1
- # -wd: Disable following warnings
- # 144, 167, 556: -Wno-pointer-sign
- # 10006: ignoring unknown option -fno-signed-zeros
- # 10156: ignoring option '-W'; no argument required
- check_cflags -wd144,167,556,10006,10156
- # 11030: Warning unknown option --as-needed
- # 10156: ignoring option '-export'; no argument required
- check_ldflags -wd10156,11030
- # Allow to compile with optimizations
- check_ldflags -march=$cpu
+if enabled icc; then
+ # Just warnings, no remarks
+ check_cflags -w1
+ # -wd: Disable following warnings
+ # 144, 167, 556: -Wno-pointer-sign
+ # 10006: ignoring unknown option -fno-signed-zeros
+ # 10156: ignoring option '-W'; no argument required
+ check_cflags -wd144,167,556,10006,10156
+ # 11030: Warning unknown option --as-needed
+ # 10156: ignoring option '-export'; no argument required
+ check_ldflags -wd10156,11030
+ # Allow to compile with optimizations
+ check_ldflags -march=$cpu
fi
# PIC flags for shared library objects where they are needed