##// END OF EJS Templates
Merge
Merge

File last commit:

r18:bd9ab647f70a default
r46:7d306b65e7c9 merge dev_alexis
Show More
functions
320 lines | 9.9 KiB | text/plain | TextLexer
Libuc make templates extracted from main script, to make it more modular
r7 #!/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
#-------------------------------------------------------------------------------*/
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 function readFile {
more $1 | sed 's/#.*//' | grep -i $2' '
}
Libuc make templates extracted from main script, to make it more modular
r7 function getFilesList {
sed ':a;N;$!ba;s/\\\n/ /g' $1 | sed ':a;N;$!ba;s/\\ \n/ /g' | grep -i $2 | sed 's/\t//g'
}
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Now uses qmake to compile an Qt-creator compatible!
r18 function getObjFilesList {
SRCFILES=`getFilesList $PROJECTFILE SOURCES | sed 's/SOURCES//' | sed 's/+=//' | sed 's/\.c/\.o/g' | sed 's/\.s/\.o/g'`
echo $SRCFILES
}
Libuc make templates extracted from main script, to make it more modular
r7
function Template {
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMPLATE=`readFile $1 "TEMPLATE" | sed s/TEMPLATE// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
Libuc make templates extracted from main script, to make it more modular
r7 }
function Arch {
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 ARCH=`readFile $1 "ARCH" | sed s/ARCH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.ARCH"`
if [ -z "$TEMP" ] ; then
ARCH=`readFile $1 "*.ARCH" | sed 's/*\.'ARCH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
else
ARCH=`readFile $1 "$2.ARCH" | sed s/$2'\.'ARCH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
fi
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 fi
Libuc make templates extracted from main script, to make it more modular
r7 }
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Now uses qmake to compile an Qt-creator compatible!
r18 function Cpumodel {
if [ -z "$2" ] ; then
CPUMODEL=`readFile $1 "CPUMODEL" | sed s"/CPUMODEL//" | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
else
TEMP=`readFile $1 "$2.CPU"`
if [ -z "$TEMP" ] ; then
CPUMODEL=`readFile $1 "*.CPUMODEL" | sed 's/*\.CPUMODEL//' | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
else
CPUMODEL=`readFile $1 "$2.CPUMODEL" | sed s/$2'\.CPUMODEL//' | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
fi
fi
}
Libuc make templates extracted from main script, to make it more modular
r7 function Target {
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TARGET=`readFile $1 "TARGET" | sed s/TARGET// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TARGET=`readFile $1 "$2.TARGET" | sed s/$2'\.'TARGET// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 fi
}
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Now uses qmake to compile an Qt-creator compatible!
r18 function Bspname {
if [ -z "$2" ] ; then
BSPNAME=`readFile $1 "BSPNAME" | sed s/BSPNAME// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
else
BSPNAME=`readFile $1 "$2.BSPNAME" | sed s/$2'\.'BSPNAME// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
fi
}
just backup
r12
function Objdir {
if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 OBJDIR=`readFile $1 "OBJDIR" | sed s/OBJDIR// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
just backup
r12 if [ -z "$OBJDIR" ] ; then
OBJDIR="obj"
fi
else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.OBJDIR"`
if [ -z "$TEMP" ] ; then
OBJDIR=`readFile $1 "*.OBJDIR" | sed 's/*\.'OBJDIR// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
if [ -z "$OBJDIR" ] ; then
OBJDIR="obj"
fi
else
OBJDIR=`readFile $1 "$2.OBJDIR" | sed s/$2'\.'OBJDIR// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
if [ -z "$OBJDIR" ] ; then
OBJDIR="obj"
fi
just backup
r12 fi
fi
}
function Bindir {
if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 BINDIR=`readFile $1 "BINDIR" | sed s/BINDIR// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
just backup
r12 if [ -z "$BINDIR" ] ; then
BINDIR="bin"
fi
else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.BINDIR"`
if [ -z "$TEMP" ] ; then
BINDIR=`readFile $1 "*.BINDIR" | sed 's/*\.'BINDIR// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
if [ -z "$BINDIR" ] ; then
BINDIR="bin"
fi
else
BINDIR=`readFile $1 "$2.BINDIR" | sed s/$2'\.'BINDIR// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
if [ -z "$BINDIR" ] ; then
BINDIR="bin"
fi
just backup
r12 fi
fi
}
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 function Targets {
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TARGETS=`readFile $1 ".TARGET" | sed 's/\.TARGET.*//'`
Libuc make templates extracted from main script, to make it more modular
r7 }
function Libs_Inc {
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 INCLUDEStmp=`readFile $1 "LIBS" | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 for FILES in $INCLUDEStmp
do
INCLUDES+='$('"LIBUC_INC_DIR_""$FILES""_CMD) "
just backup
r12 INC_LIBS_DEPS+='$('"LIBUC_INC_DIR_""$FILES"") "
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 done
else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.LIBS"`
if [ -z "$TEMP" ] ; then
INCLUDEStmp=`readFile $1 "*.LIBS" | sed 's/*\.'LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
for FILES in $INCLUDEStmp
do
INCLUDES+='$('"LIBUC_INC_DIR_""$FILES""_CMD) "
INC_LIBS_DEPS+='$('"LIBUC_INC_DIR_""$FILES"") "
done
else
INCLUDEStmp=`readFile $1 "$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) "
INC_LIBS_DEPS+='$('"LIBUC_INC_DIR_""$FILES"") "
done
fi
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 fi
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
Added STM32F4 target, improved rules files, added additional Include folder var...
r14 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 INCLUDEStmp=`readFile $1 "INCLUDES" | sed s/INCLUDES// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
Added STM32F4 target, improved rules files, added additional Include folder var...
r14 for FILES in $INCLUDEStmp
do
INCLUDES+="-I "$FILES" "
done
else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.INCLUDES"`
if [ -z "$TEMP" ] ; then
INCLUDEStmp=`readFile $1 "*.INCLUDES" | sed 's/*\.'INCLUDES// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
for FILES in $INCLUDEStmp
do
INCLUDES+="-I "$FILES" "
done
else
INCLUDEStmp=`readFile $1 "$2.INCLUDES" | sed s/$2'\.'INCLUDES// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
for FILES in $INCLUDEStmp
do
INCLUDES+="-I "$FILES" "
done
fi
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
Added STM32F4 target, improved rules files, added additional Include folder var...
r14 fi
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9
Libuc make templates extracted from main script, to make it more modular
r7 }
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9
Libuc make templates extracted from main script, to make it more modular
r7 function Libs_Link {
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 LIBRARIEStmp=`readFile $1 "LIBS" | sed s/LIBS// |sed s/+//|sed s/=//| sed 's/^[ \t]*//;s/[ \t]*$//'`
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 for FILES in $LIBRARIEStmp
do
LIBRARIES+='$('"LIBUC_LIBS_DIR_""$FILES""_CMD) "'$('"LIBUC_LIBS_$FILES) "
just backup
r12 BIN_LIBS_DEPS='$('"LIBUC_LIBS_DIR_""$FILES"")"
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 done
else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.LIBS"`
if [ -z "$TEMP" ] ; then
LIBRARIEStmp=`readFile $1 "*.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) "
BIN_LIBS_DEPS='$('"LIBUC_LIBS_DIR_""$FILES"")"
done
else
LIBRARIEStmp=`readFile $1 "$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) "
BIN_LIBS_DEPS='$('"LIBUC_LIBS_DIR_""$FILES"")"
done
fi
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 fi
Libuc make templates extracted from main script, to make it more modular
r7 }
function HeadersInstallPath {
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 HEADERSINSTALLPATH=`readFile $1 "HEADERSINSTALLPATH" | sed s/HEADERSINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
else
TEMP=`readFile $1 "$2.HEADERSINSTALLPATH"`
if [ -z "$TEMP" ] ; then
HEADERSINSTALLPATH=`readFile $1 "*.HEADERSINSTALLPATH" | sed 's/*\.'HEADERSINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
else
HEADERSINSTALLPATH=`readFile $1 "$2.HEADERSINSTALLPATH" | sed s/$2'\.'HEADERSINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
fi
fi
if [ -z "$HEADERSINSTALLPATH" ] ; then
echo "$0 error on file $1 you forget to give the headers install path"
echo " solution: set the varriable HEADERSINSTALLPATH in $1"
fi
}
function ExtractCFLAGS {
if [ -z "$2" ] ; then
CFLAGS=`readFile $1 "CFLAGS" | sed s/CFLAGS/LIBUC_CFLAGS/ `
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.CFLAGS"`
if [ -z "$TEMP" ] ; then
CFLAGS=`readFile $1 "*.CFLAGS" | sed 's/*\.'CFLAGS/LIBUC_CFLAGS/ `
else
CFLAGS=`readFile $1 "$2.CFLAGS" | sed s/$2'\.'CFLAGS/LIBUC_CFLAGS/ `
fi
fi
Libuc make templates extracted from main script, to make it more modular
r7 }
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15
function ExtractLDFLAGS {
if [ -z "$2" ] ; then
LDFLAGS=`readFile $1 "LDFLAGS" | sed s/LDFLAGS/LIBUC_LDFLAGS/ `
else
TEMP=`readFile $1 "$2.LDFLAGS"`
if [ -z "$TEMP" ] ; then
LDFLAGS=`readFile $1 "*.LDFLAGS" | sed 's/*\.'LDFLAGS/LIBUC_LDFLAGS/ `
else
LDFLAGS=`readFile $1 "$2.LDFLAGS" | sed s/$2'\.'LDFLAGS/LIBUC_LDFLAGS/ `
fi
fi
}
function ExtractODFLAGS {
if [ -z "$2" ] ; then
ODFLAGS=`readFile $1 "ODFLAGS" | sed s/ODFLAGS/LIBUC_ODFLAGS/ `
else
TEMP=`readFile $1 "$2.ODFLAGS"`
if [ -z "$TEMP" ] ; then
ODFLAGS=`readFile $1 "*.ODFLAGS" | sed 's/*\.'ODFLAGS/LIBUC_ODFLAGS/ `
else
ODFLAGS=`readFile $1 "$2.ODFLAGS" | sed s/$2'\.'ODFLAGS/LIBUC_ODFLAGS/ `
fi
fi
}
Libuc make templates extracted from main script, to make it more modular
r7 function TargetInstallPath {
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TARGETINSTALLPATH=`readFile $1 "TARGETINSTALLPATH" | sed s/TARGETINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.TARGETINSTALLPATH"`
if [ -z "$TEMP" ] ; then
TARGETINSTALLPATH=`readFile $1 '*.TARGETINSTALLPATH' | sed 's/*\.'TARGETINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
else
TARGETINSTALLPATH=`readFile $1 "$2.TARGETINSTALLPATH" | sed s/$2'\.'TARGETINSTALLPATH// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
fi
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 fi
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 if [ -z "$TARGETINSTALLPATH" ] ; then
echo "$0 error on file $1 you forget to give the target install path"
echo " solution: set the varriable TARGETINSTALLPATH in $1"
fi
Libuc make templates extracted from main script, to make it more modular
r7 }
function getBSP {
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 if [ -z "$2" ] ; then
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 if(more $1 | sed 's/#.*//' | grep -i "BSP ="); then
BSP=`readFile $1 "BSP" | sed s/BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 fi
else
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 TEMP=`readFile $1 "$2.BSP"`
if [ -z "$TEMP" ] ; then
if(more $1 | sed 's/#.*//' | grep -i "*.BSP ="); then
BSP=`readFile $1 "*.BSP" | sed 's/*\.'BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
fi
else
if(more $1 | sed 's/#.*//' | grep -i "$2.BSP ="); then
BSP=`readFile $1 "$2.BSP" | sed s/$2'\.'BSP// | sed s/=// | sed 's/^[ \t]*//;s/[ \t]*$//'`
fi
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9 fi
fi
jeandet@pc-de-jeandet3.lab-lpp.local
improved PDF generation
r15 if [ -z "$BSP" ] ; then
echo "$0 error on file $1 you forget to give the board support package"
echo " solution: set the varriable BSP in $1"
fi
Libuc make templates extracted from main script, to make it more modular
r7
}
Multi target feature added, It's now possible to generate differents outputs from the same inputs files with differents options...
r9