#!/bin/bash #/*------------------------------------------------------------------------------ #-- This file is a part of the libuc, microcontroler library #-- Copyright (C) 2011, Alexis Jeandet #-- #-- This program is free software; you can redistribute it and/or modify #-- it under the terms of the GNU General Public License as published by #-- the Free Software Foundation; either version 3 of the License, or #-- (at your option) any later version. #-- #-- This program is distributed in the hope that it will be useful, #-- but WITHOUT ANY WARRANTY; without even the implied warranty of #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #-- GNU General Public License for more details. #-- #-- You should have received a copy of the GNU General Public License #-- along with this program; if not, write to the Free Software #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #------------------------------------------------------------------------------- #-- Author : Alexis Jeandet #-- Mail : alexis.jeandet@gmail.com #-------------------------------------------------------------------------------*/ function getFilesList { sed ':a;N;$!ba;s/\\\n/ /g' $1 | sed ':a;N;$!ba;s/\\ \n/ /g' | grep -i $2 | sed 's/\t//g' } function Template { TEMPLATE=`more $1 | grep -i "TEMPLATE " | sed s/TEMPLATE// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` } function Arch { if [ -z "$2" ] ; then ARCH=`more $1 | grep -i "ARCH " | sed s/ARCH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` else ARCH=`more $1 | grep -i "$2.ARCH " | sed s/$2'\.'ARCH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` fi } function Target { if [ -z "$2" ] ; then TARGET=`more $1 | grep -i "TARGET " | sed s/TARGET// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` else TARGET=`more $1 | grep -i "$2.TARGET " | sed s/$2'\.'TARGET// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` fi } function Targets { TARGETS=`more $1 | grep -i ".SOURCES" | sed 's/\.SOURCES.*//'` } function Libs_Inc { if [ -z "$2" ] ; then INCLUDEStmp=`more $1 | grep -i "LIBS " | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'` for FILES in $INCLUDEStmp do INCLUDES+='$('"LIBUC_INC_DIR_""$FILES""_CMD) " done else INCLUDEStmp=`more $1 | grep -i "$2.LIBS " | sed s/$2'\.'LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'` for FILES in $INCLUDEStmp do INCLUDES+='$('"LIBUC_INC_DIR_""$FILES""_CMD) " done fi } function Libs_Link { if [ -z "$2" ] ; then LIBRARIEStmp=`more $1 | grep -i "LIBS " | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'` for FILES in $LIBRARIEStmp do LIBRARIES+='$('"LIBUC_LIBS_DIR_""$FILES""_CMD) "'$('"LIBUC_LIBS_$FILES) " done else LIBRARIEStmp=`more $1 | grep -i "$2.LIBS " | sed s/$2'\.'LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'` for FILES in $LIBRARIEStmp do LIBRARIES+='$('"LIBUC_LIBS_DIR_""$FILES""_CMD) "'$('"LIBUC_LIBS_$FILES) " done fi } function HeadersInstallPath { if [ -z "$2" ] ; then HEADERSINSTALLPATH=`more $1 | grep -i "HEADERSINSTALLPATH" | sed s/HEADERSINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` else HEADERSINSTALLPATH=`more $1 | grep -i "$2.HEADERSINSTALLPATH" | sed s/$2'\.'HEADERSINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` fi } function TargetInstallPath { if [ -z "$2" ] ; then TARGETINSTALLPATH=`more $1 | grep -i "TARGETINSTALLPATH" | sed s/TARGETINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` else TARGETINSTALLPATH=`more $1 | grep -i "$2.TARGETINSTALLPATH" | sed s/$2'\.'TARGETINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` fi } function getBSP { if [ -z "$2" ] ; then if(more $1 | grep -i "BSP ="); then BSP=`more $1 | grep -i "BSP" | sed s/BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` fi else if(more $1 | grep -i "$2.BSP ="); then BSP=`more $1 | grep -i "$2.BSP" | sed s/$2'\.'BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'` fi fi }