.PHONY: check ch-splitcf ch-pm1dump clean src

SPLITCFTESTS = test-1.in test-2.in test-3.in test-4.in test-5.in test-6.in \
 test-6.out test-7.in test-7.out test-8.in test-8.out

PM1DUMPTESTS = l0000709 m0032768 test-10.out test-11.out \
 test-lowm.txt test-lowp.txt

TESTS = $(SPLITCFTESTS) $(PM1DUMPTESTS)

ALL: check

splitcf: splitcf.c
	gcc -Wall -O2 -s -o $@ $< -lgmp

pm1dump: pm1dump.c
	gcc -Wall -O2 -s -o $@ $< -lgmp

ch-splitcf: splitcf $(SPLITCFTESTS)
	./check-splitcf $(<D)/$<

ch-pm1dump: pm1dump $(PM1DUMPTESTS)
	./check-pm1dump $(<D)/$<

check: ch-splitcf ch-pm1dump

mprime-ecm-utils-0.3.tar.gz: README Makefile splitcf.c pm1dump.c \
 check-splitcf check-pm1dump $(TESTS)
	tar -c $^ | gzip -9 > $@

src: mprime-ecm-utils-0.3.tar.gz

clean:
	rm -f splitcf pm1dump mprime-ecm-utils-0.3.tar.gz
