CFLAGS = -g -ansi -pedantic -Wall -Werror -g -lm
GCC = gcc $(CFLAGS)

array_math:	array_math.c
		$(GCC) $^ -o $@

array_math_test:
		@ echo "Testing with in1.dat and in2.dat of size 10"
		@ cp in1_10.dat in1.dat ; cp in2_10.dat in2.dat ; \
			array_math | tee in1_in2_10.out

		@ echo ; echo "Testing with in1.dat and in2.dat of size 20"
		@ cp in1_20.dat in1.dat ; cp in2_20.dat in2.dat ; \
			array_math | tee in1_in2_20.out

		@ echo ; echo "Testing with in1.dat and in2.dat of size 21"
		@ cp in1_21.dat in1.dat ; cp in2_21.dat in2.dat ; \
			array_math | tee in1_in2_21.out

		@ echo

read_strings:	read_strings.c
		$(GCC) $^ -o $@

read_strings_test:
		@ echo "Input the name of a file: writeup.html" ; \
			echo "writeup.html" | read_strings | \
			sed s%Input\ the\ name\ of\ a\ file:\ %% | \
				tee writeup.out

		@ echo ; echo "Input the name of a file: 6x80.dat" ; \
			 echo "6x80.dat" | read_strings | \
			sed s%Input\ the\ name\ of\ a\ file:\ %% | \
				tee 6x80.out

		@ echo ; echo "Input the name of a file: 1010x80.dat" ; \
			echo "1010x80.dat" | read_strings | \
			sed s%Input\ the\ name\ of\ a\ file:\ %% | \
				tee 1010x80.out

		@ echo ; echo "Input the name of a file: 1010x81.dat" ; \
			echo "1010x81.dat" | read_strings | \
			sed s%Input\ the\ name\ of\ a\ file:\ %% | \
				tee 1010x81.out

clean:
	rm -f array_math read_strings