Saturday, April 2, 2011

Fixxed CFLAGS with a script

I fixed the CFLAGS problem, not by changing the configure or Make process at all, but by running a shell script, after the ./configure, but before the make in order to change one like in each Makefile, notably, the CFLAGS =


I changed CFLAGS = to CFLAGS = -g using a couple shell scripts and a sed naming file. I sent these scripts to everyone who has been active on the wograld project. I thought about posting the scripts here. I suppose I could, but if newbies mess up with them, they could end up deleting the files on the list they created instead of changing one thing about the file, like if they don't have cflagsname in the proper folder.
Maybe I should post them up along with the directions I had. Newbies, you have been warned. These files can also be used to fork projects, but it is suggested you test them before messing up all your files.


Okay, since I guess you have been duly warned now, here are the files. Author is not responsible for use, misuse or abuse of the following. Use at your own risk.


find -name Makefile -type f -print | sed "s#^.#$(pwd)#" > maout.txt


(have mklist.sh mkdebug.sh and cflagsname in the server(or client) subfolder, then type sh ./mklist.sh maout.txt)



cflagsname


# sed comment - This script changes CFLAGS = to CFLAGS = -g
s/^CFLAGS =/CFLAGS = -g/g

mkdebug.sh


#!/bin/sh
file=$1
echo $file
sfile='ug2'
echo $sfile
#!/bin/sh
more $file | sed -f cflagsname > $sfile
more $sfile > $file
touch $sfile
exit 0;


mklist.sh


#!/bin/sh
bfile='ug5'
gfile='ug7'
wc $1 | awk '{print $1}' > $bfile;
count=$(more $bfile);
echo hello newbies;
while [ $count -gt 0 ]
do
echo hi, I got here;
wc $1 | awk '{print $1}' > $bfile;
count=$(more $bfile);
echo $count;
count=`expr $count - 1`
#a="$a-1";
head -n 1 $1 > $bfile;
b=$(more $bfile);
echo $b;
echo $count;
tail -n $count $1 >> $gfile;
sh mkdebug.sh $b;
rm $1;
#rename $gfile $1 $gfile;
#baddwords7 is the proper file
mv $gfile $1;
touch $gfile;
done

No comments: