Split optimization flags from headers and library paths
[qi-bootmenu-system/guyou.git] / sources / include.sh
bloba2f5d95b135cf1afb302db0576c99405e053272a
1 #!/bin/bash
3 # Architecture
5 ARCH=armv4tl
6 KARCH=arm
7 ARCH_NAME="$ARCH"
8 STAGE_NAME="native"
10 # Directory layout
11 TOP=`pwd`
12 export SOURCES="${TOP}/sources"
13 export SRCDIR="${TOP}/packages"
14 export ROOT_DIR="${TOP}/rootfs"
15 export ROOT_OVERLAY="${TOP}/rootfs-overlay"
16 export BUILD="${TOP}/build"
17 export CONFIG_DIR="${TOP}/sources"
18 export WORK="${BUILD}/temp-${ARCH}"
19 export STAGING_DIR="${TOP}/staging-dir"
21 # Default flags to point the compiler to the right libraries and
22 # include files. In the case of cross compiling this assumes that
23 # the compiler doesn't add system directories to it's search paths.
24 # This is taken care of by a gcc wrapper script which passes things
25 # like -nostdinc -nostdlibs -nodefaultlibs to gcc.
27 CFLAGS_HEADERS="-I$STAGING_DIR/usr/include"
28 CFLAGS="$CFLAGS_HEADERS -Os -pipe -march=armv4t -mtune=arm9tdmi"
29 LDFLAGS_LIBS="-L$STAGING_DIR/usr/lib"
30 LDFLAGS="$LDFLAGS_LIBS"
32 # Make sure that pkg-config uses the right paths and doesn't pull
33 # in depencies from the host system.
34 export PKG_CONFIG_PATH="${STAGING_DIR}/usr/lib/pkgconfig"
35 export PKG_CONFIG_LIBDIR="${STAGING_DIR}/usr/lib/pkgconfig"
36 export PKG_CONFIG_SYSROOT_DIR="${STAGING_DIR}"
38 # check if we are building natively or if we are cross compiling
40 if [[ ! $(uname -m) == arm* ]]
41 then
42 STAGE_NAME="cross"
43 CROSS_LDFLAGS=
44 CROSS_CFLAGS=
45 # XXX: --build=`config.guess`
46 CROSS_CONFIGURE_FLAGS="--build=i686-pc-linux-gnu \
47 --target=armv4tl-unknown-linux-gnueabi \
48 --host=armv4tl-unknown-linux-gnueabi"
49 # cross compiler prefix used by kernel, uclibc and busybox
50 # build system
51 export CROSS="armv4tl-unknown-linux-gnueabi-"
54 STRIP="${CROSS}strip"
56 umask 022
58 # Tell bash not to cache the $PATH because we modify it. Without
59 # this, bash won't find new executables added after startup.
60 set +h
62 [ -e config ] && source config
63 source sources/functions-fwl.sh
64 source sources/functions.sh
66 # How many processors should make -j use?
68 if [ -z "$CPUS" ]
69 then
70 export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)
71 [ "$CPUS" -lt 1 ] && CPUS=1
74 # This is an if instead of && so the exit code of include.sh is reliably 0
75 if [ ! -z "$BUILD_VERBOSE" ]
76 then
77 VERBOSITY="V=1"