#!/bin/bash
i=0
t=()
d=()
find . -path '*/.*' -prune -o -type f -name '*.net' -print > .find.$$
while IFS= read -r P; do
	for G in dot neato; do
		for T in png pdf; do
			t[$i]="g/${P%.net}.$G.$T"
			d[$i]="g/`dirname "$P"`"
			i=$[$i+1]
		done
	done
done < .find.$$
if [ "$i" -gt 0 ]; then
    mkdir -p "${d[@]}"
    make "${t[@]}"
fi
