#!/bin/sh

if [ "$1" = "getmods" ] ; then
        wget -nv -r -l 1 -A c -nd -nc http://modules.anope.org/download/
        rm -f robots.txt
        exit 0
fi

echo -n "SRCS=" > ./Makefile.inc
FIRST=1
for oldfile in *.c
do
	if [ "$FIRST" = 1 ] ; then
		echo -n " "$oldfile >> ./Makefile.inc
	else
		echo "\\" >> ./Makefile.inc
		echo -n "     " $oldfile >> ./Makefile.inc
	fi
	FIRST=0
done
echo "" >> ./Makefile.inc

gmake

if [ "$1" = "install" ] ; then
	gmake install
fi
