#!//bin/ksh
# gmake for machine alpha sous linux

programe="parmela"

for files in *.f
do
 objname="${files:%.f}"
 echo $objname
 objname=${objname}.o
 liste=${liste}" ${files}" 
#echo $liste
 echo ${objname}:${files} >>temp1
 echo "\t \$(FF) -c \$(FFLAGS) "${files} >>temp1

 echo " ">>temp1
done

echo "${programe}: \$(OBJ)" >>temp1
echo "\t \$(FF)  \$(FFLAGS) \$(OBJ) -o "${programe}"\$(VER)" >>temp1
echo " " >>temp1
echo "clean:" >>temp1
echo "\t rm *.o">>temp1

# ecriture dans le fichier de makefile definitif

echo FF=g77 >>makefile
#echo FFLAGS= -g -O4 -m32 -fno-second-underscore -funroll-loops -I. >>makefile
echo FFLAGS= -O4 -m32 -fno-second-underscore -funroll-loops -I. >>makefile

echo " " >>makefile

echo "VER=linux" >>makefile

echo " " >>makefile

echo SRC=${liste} >>makefile
echo " " >>makefile
echo "OBJ=\$(SRC:.f=.o)" >>makefile
echo " " >>makefile
cat temp1 >> makefile

rm -f temp1

#c'est fini
