| 1 |
#!/bin/bash |
| 2 |
PROJECT="DrumGizmo" |
| 3 |
|
| 4 |
function allfile() { |
| 5 |
echo "/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */" > $1; |
| 6 |
echo "/***************************************************************************" >> $1; |
| 7 |
echo " * $1" >> $1; |
| 8 |
echo " *" >> $1 ; |
| 9 |
echo " * `date`" >> $1; |
| 10 |
echo -n " * Copyright " >> $1 |
| 11 |
echo -n `date +%Y | xargs` >> $1 |
| 12 |
if [ "$USER" == "nemo" ]; |
| 13 |
then |
| 14 |
echo " Jonas Suhr Christensen" >> $1; |
| 15 |
echo " * [email protected]" >> $1; |
| 16 |
fi |
| 17 |
if [ "$USER" == "deva" ]; |
| 18 |
then |
| 19 |
echo " Bent Bisballe Nyeng" >> $1; |
| 20 |
echo " * [email protected]" >> $1; |
| 21 |
fi |
| 22 |
if [ "$USER" == "senator" ]; |
| 23 |
then |
| 24 |
echo " Lars Bisballe Jensen" >> $1; |
| 25 |
echo " * [email protected]" >> $1; |
| 26 |
fi |
| 27 |
echo " ****************************************************************************/" >> $1; |
| 28 |
echo "" >> $1; |
| 29 |
echo "/*" >> $1; |
| 30 |
echo " * This file is part of $PROJECT." >> $1; |
| 31 |
echo " *" >> $1; |
| 32 |
echo " * $PROJECT is free software; you can redistribute it and/or modify" >> $1; |
| 33 |
echo " * it under the terms of the GNU General Public License as published by" >> $1; |
| 34 |
echo " * the Free Software Foundation; either version 2 of the License, or" >> $1; |
| 35 |
echo " * (at your option) any later version." >> $1; |
| 36 |
echo " *" >> $1; |
| 37 |
echo " * $PROJECT is distributed in the hope that it will be useful," >> $1; |
| 38 |
echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $1; |
| 39 |
echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" >> $1; |
| 40 |
echo " * GNU General Public License for more details." >> $1; |
| 41 |
echo " *" >> $1; |
| 42 |
echo " * You should have received a copy of the GNU General Public License" >> $1; |
| 43 |
echo " * along with $PROJECT; if not, write to the Free Software" >> $1; |
| 44 |
echo " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA." >> $1; |
| 45 |
echo " */" >> $1; |
| 46 |
} |
| 47 |
|
| 48 |
function ccfile() { |
| 49 |
local hf=`echo -n $1 | cut -d'.' -f1`.h; |
| 50 |
hfile $hf; |
| 51 |
|
| 52 |
allfile $1; |
| 53 |
echo -n '#include "' >> $1; |
| 54 |
echo -n $hf >> $1; |
| 55 |
echo '"' >> $1; |
| 56 |
echo '' >> $1; |
| 57 |
} |
| 58 |
|
| 59 |
function hfile() { |
| 60 |
allfile $1; |
| 61 |
local hn=`echo $1 | tr 'a-z.' 'A-Z_'` |
| 62 |
local pr=`echo $PROJECT | tr 'a-z.' 'A-Z_'` |
| 63 |
echo "#pragma once" >> $1; |
| 64 |
} |
| 65 |
|
| 66 |
if [ "$#" = "1" ]; then |
| 67 |
if [ "CC" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then |
| 68 |
ccfile $1; |
| 69 |
fi; |
| 70 |
if [ "H" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then |
| 71 |
hfile $1; |
| 72 |
fi; |
| 73 |
else echo "Usage: $0 filename"; |
| 74 |
fi; |