# %.o: %.hs
# 	ghc -Wall -c "$<" -o "$@"

TEST_SPLIT0_SRCS=test-Split0.hs Split0.hs
TEST_MD5S_SRCS=test-Md5s.hs Md5s.hs
STAT_SRCS=stat.hs
STAT2_SRCS=stat2.hs
JUST_SIZE_TUPLES_SRCS=just-size-tuples.hs Split0.hs
DPH_SRCS=dph.hs Split0.hs
EQUIVS3_SRCS=equivs3-haskell.hs Split0.hs Md5s.hs

go: run-dph run-test-Md5s run-test-Split0 run-just-size-tuples run-equivs3-haskell
#go: run-stat run-stat2

run-dph: dph
	printf '/etc/services\0/etc/protocols\0' | ./dph

run-stat: stat
	./stat

run-stat2: stat2
	./stat2

run-test-Md5s: test-Md5s
	./test-Md5s

run-test-Split0: test-Split0
	find inputs -type f -print0 | ./test-Split0
	printf 'equivs3-haskell.hs\0Split0.hs' | ./test-Split0

run-just-size-tuples: just-size-tuples
	find inputs -type f -print0 | ./just-size-tuples

run-equivs3-haskell: equivs3-haskell
	find inputs -type f -print0 | ./equivs3-haskell

stat: $(STAT_SRCS)
	# --make will go out and find what to build
	ghc -Wall --make -o stat $(STAT_SRCS)

stat2: $(STAT2_SRCS)
	# --make will go out and find what to build
	ghc -Wall --make -o stat2 $(STAT2_SRCS)

test-Md5s: $(TEST_MD5S_SRCS)
	# --make will go out and find what to build
	ghc -Wall --make -o test-Md5s $(TEST_MD5S_SRCS)

dph: $(DPH_SRCS)
	# --make will go out and find what to build
	ghc -Wall --make -o dph $(DPH_SRCS)

test-Split0: $(TEST_SPLIT0_SRCS)
	# --make will go out and find what to build
	ghc -Wall --make -o test-Split0 $(TEST_SPLIT0_SRCS)

equivs3-haskell: $(EQUIVS3_SRCS)
	ctags-exuberant $(EQUIVS3_SRCS)
	# --make will go out and find what to build
	ghc -Wall --make -o equivs3-haskell $(EQUIVS3_SRCS)

just-size-tuples: $(JUST_SIZE_TUPLES_SRCS)
	# --make will go out and find what to build
	ghc -Wall --make -o just-size-tuples $(JUST_SIZE_TUPLES_SRCS)

clean:
	rm -f *.o *.hi equivs3-haskell just-size-tuples test-Split0 stat stat2 test-Md5s tags