small-util/compile
2015-07-23 13:53:23 +03:00

15 lines
256 B
Bash
Executable File

#!/bin/sh
function compile_file(){
Name="$(echo "$1" | sed "s/\(.*\)\.c/\1/")"
gcc -Wall -Werror -lX11 -lm -lpthread "${Name}.c" -o "$Name"
}
if [ "$1" != "" ]; then
compile_file "$1"
else
for file in *.c; do
compile_file "$file"
done
fi
rm -f *.o