CFLAGS = -O -Wall -std=gnu11
LDLIBS = -lm

.PHONEY:default
default: \
	out.cmdopt.txt \
	out.stdio.txt \
	err.stdio.txt \
	out.file.txt \
	out.cmdline.txt

out.cmdline.txt:cmdline input.txt
	./cmdline $$(cat input.txt) > $@

out.cmdopt.txt: cmdopt
	./cmdopt -e 0.1 -n 10 > $@
	./cmdopt -e 0.05 -n 20 >> $@
	./cmdopt -e 0.01 -n 30 >> $@

out.stdio.txt err.stdio.txt out.file.txt: input.txt stdio Makefile
	./stdio < input.txt 1> out.stdio.txt 2> err.stdio.txt

input.txt: Makefile
	cat /dev/null > $@
	for x in $$(seq 0 0.5 5); do echo "$$x" >> $@; done

.PHONEY:clean
clean:
	$(RM) input.txt out* err* stdio cmdopt cmdline
