cgal/wininst/developer_scripts/examples/C2vcproj

48 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#
# Create a .vcproj Visual C++ makefile for each .C file
# Usage: C2vcproj folder1 ...
#
# For each folder in parameters list
for h in $@ ; do
if [ -d $h ]; then
cd $h;
echo "In " $h;
# Create temporary subdirectory "text"
if [ -e text ]; then
rm -r text;
fi
mkdir text;
# For each source file
for i in *.C ; do
if [ ! $i = "*.C" ]; then
# if $i contains a function "main()"
grep main $i >/dev/null 2>&1
if [[ $? == 0 ]]; then
# Create $jp VC++ makefile if it doesn't exist
jp=`echo $i|sed -e "s/\.C/\.vcproj/"`;
if [[ ! -e $jp ]]; then
echo "Creating $jp"
ofn=`echo $i|sed -e "s/\.C/\.exe/"`;
k=`echo $i|sed -e "s/\.C//"`;
sed -e"s/master/$k/g" ../../developer_scripts/examples/master.vcproj > ./text/temp.txt;
sed -e"s/test_msvc7.exe/$ofn/g" ./text/temp.txt > ./text/temp2.txt;
sed -e"s/test_msvc7/$k/g" ./text/temp2.txt > ./text/$jp;
mv ./text/$jp ./;
rm -rf ./text/temp.txt ./text/temp2.txt
fi
fi
fi
done
# Remove temporary subdirectory "text"
rm -r text
cd ..;
fi
done