#!/bin/sh

if test -z $1; then
    printf "specify plugin to compile, 'all' or 'clean'\n"
    exit 0;
fi

if test $1 = "all"; then
    for i in *; do
        if test -d $i; then
    	    (cd $i;
	    if test -e "configure"; then
		if test -e "config.h"; then
		    true
		else
		    ./configure
		fi
	    fi
	    ./makedep
	    make all )
	fi
    done; true
    exit 0;
fi

if test $1 = "clean"; then
    for i in *; do
        if test -d $i; then
    	    (cd $i;
	    ./makedep
	    make clean )
	fi
    done; true
    exit 0;
fi

printf "builing %s\n" $1
cd $1;
./makedep
if test -e "configure"; then
    if test -e "config.h"; then
	true
    else
	./configure
    fi
fi
make all
