CC     ?= gcc
CFLAGS ?= -O2 -Wall
all: kltab klread
# -Wno-parentheses only: kltab.c leans on C operator precedence in its bit
# manipulation throughout, which is correct but noisy.  Everything else is
# still reported.
kltab: kltab.c
	$(CC) $(CFLAGS) -Wno-parentheses -o $@ kltab.c
klread: klread.c
	$(CC) $(CFLAGS) -o $@ klread.c
tables: kltab                # n=10 takes about two minutes
	for n in 4 5 6 7 8 9 10; do ./kltab $$n || exit 1; done
check: all
	./check.sh
clean:                       # .exe too, for Cygwin and MinGW
	rm -f kltab klread kltab.exe klread.exe
distclean: clean
	rm -f kl*.p1 kl*.pol KLP* Polytab* Polylen* KLMU*
