melonvpn/scripts/gcc_multiwrap.sh

35 lines
468 B
Bash
Executable File

#!/bin/bash
echo -e "\033[33mGCC Multiwrap\033[m"
j=0
y="$1"
for ((i=2; i<=$#; i++))
do
a="${!i}"
j=$i
if [ "$a" = "--" ]; then
break
fi
y="$y $a"
done
j=$((j+1))
w="${!j}"
j=$((j+1))
z="${!j}"
j=$(($j+1))
v=""
for ((i=$j; i<=$#; i++))
do
a="${!i}"
b=`basename "${!i:0:-2}"`
echo -e "\033[32mgcc $y -o \"$b.o\" -c \"$a\"\033[m"
gcc $y -o "$z/$b.o" -c "$a"
v="${v} ${z}${b}.o"
done
echo -e '\033[36mar cr '"$w"' '"$v"'\033[m'
ar cr "$w" $v