ini
[aversive.git] / config / gen_headers / all.sh
1 #!/bin/sh
2
3 HDR_DIR=headers
4 XML_DIR=xml
5
6 mkdir -p ${HDR_DIR}
7 mkdir -p ${XML_DIR}
8
9 echo "-- generating header files --"
10
11 rm -rf ${HDR_DIR}
12 mkdir -p ${HDR_DIR}/aversive/parts
13
14 cd ${XML_DIR}
15 for i in *.xml ; do
16     echo $i
17     ../gen_regs.py $i > ../${HDR_DIR}/aversive/parts/${i%.xml}.h
18 done
19 cd -
20
21 cd ${HDR_DIR}/aversive/parts
22
23 EL=
24 cat <<EOF > ../parts.h
25 /*  
26  *  Copyright Droids Corporation, Microb Technology, Eirbot (2009)
27  * 
28  *  This program is free software; you can redistribute it and/or modify
29  *  it under the terms of the GNU General Public License as published by
30  *  the Free Software Foundation; either version 2 of the License, or
31  *  (at your option) any later version.
32  *
33  *  This program is distributed in the hope that it will be useful,
34  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
35  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36  *  GNU General Public License for more details.
37  *
38  *  You should have received a copy of the GNU General Public License
39  *  along with this program; if not, write to the Free Software
40  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
41  *
42  *  Revision : $Id $
43  *
44  */
45
46 /* WARNING : this file is automatically generated by scripts.
47  * You should not edit it. If you find something wrong in it,
48  * write to zer0@droids-corp.org */
49
50 #ifndef _AVERSIVE_PARTS_H_
51 #define _AVERSIVE_PARTS_H_
52
53 EOF
54
55 for i in *.h ; do
56     part=${i%.h}
57     part=${part#aversive_}
58     if [ "$part" = "parts" ]; then
59         continue
60     fi
61     echo "#${EL}if defined (__AVR_${part}__)" >> ../parts.h
62     echo "#include <aversive/parts/$i>" >> ../parts.h
63     EL=el
64 done
65 echo "#else" >> ../parts.h
66 echo "#error \"This arch is not implemented yet\"" >> ../parts.h
67 echo "#endif" >> ../parts.h
68 echo >> ../parts.h
69 echo "#endif /* _AVERSIVE_PARTS_H_ */" >> ../parts.h
70 cd -
71