From: Jose V Beneyto Date: Wed, 24 Feb 2010 22:19:17 +0000 (+0100) Subject: added multi optimized CFLAGS support to pkgmk-cross X-Git-Url: http://gitweb/?a=commitdiff_plain;h=04f9f193fffd6b72d94677890b6522a302f34782;p=pkgutils-cross.git added multi optimized CFLAGS support to pkgmk-cross --- diff --git a/pkgmk-cross b/pkgmk-cross index 6db90be..8c75b0f 100755 --- a/pkgmk-cross +++ b/pkgmk-cross @@ -1,10 +1,36 @@ -#!/bin/sh +#!/bin/bash -TOPDIR="$(cd $(dirname $0); pwd)" +TOPDIR="$(cd $(dirname $(which $0)); pwd)" +echo "TOP: $TOPDIR" +TMP_CONF="$(mktemp)" PKGMK=$TOPDIR/src/pkgmk PKGMK_CONF=$TOPDIR/src/pkgmk.conf +PKGMK_ARGS="" +PKGMK_OPTIMIZE="" -$PKGMK -cf $PKGMK_CONF $@ +while [ "$1" ]; do + echo "arg: $1" + case $1 in + -o) PKGMK_OPTIMIZE="$2" ;; + *) PKGMK_ARGS="$PKGMK_ARGS $1" ;; + esac + shift +done + +if [ ! -z "$PKGMK_OPTIMIZE" ]; then + _cflags="$(grep "^${PKGMK_OPTIMIZE}_CFLAGS=" $PKGMK_CONF | cut -d'=' -f2- | sed 's|"||g')" + if [ ! -z "$_cflags" ]; then + sed '/_CFLAGS=/d' $PKGMK_CONF | sed "s|CFLAGS=.*|CFLAGS=\"$_cflags\"|" > $TMP_CONF + PKGMK_CONF="$TMP_CONF" + else + echo "Error, invalid optimization: '$PKGMK_OPTIMIZE'" + exit 1 + fi +fi + +echo "$PKGMK -cf $PKGMK_CONF $PKGMK_ARGS" + +#rm -f $TMP_CONF # End of file diff --git a/src/pkgmk.conf b/src/pkgmk.conf index e415169..a67a74d 100644 --- a/src/pkgmk.conf +++ b/src/pkgmk.conf @@ -20,7 +20,12 @@ export LD="$CTARGET-ld" export STRIP="$CTARGET-strip" export CFLAGS="-O2 -pipe" -export CXXFLAGS="-O2 -pipe" +export CXXFLAGS="$CFLAGS" + +arm9tdmi_CFLAGS="-O2 -pipe -march=armv4 -mtune=arm9tdmi" +armv5te_CFLAGS="-O2 -pipe -march=armv5te" +strongarm_CFLAGS="-O2 -pipe -march=armv4 -mtune=strongarm" +xscale_CFLAGS="-O2 -pipe -march=armv5te -mtune=xscale" STRIP_CMD="$STRIP"