CC = gcc -std=c11 -pedantic -Wall -g

NBITS = 6

ALL: all.pdf ans.txt

all.pdf: all.tex X Makefile
	@echo "creating all.pdf"
	-pdflatex all.tex
	-pdflatex all.tex

all.tex: all.txt head.tex template.tex tail.tex make.sh
	./make.sh

all.txt: main Makefile
	./main $(NBITS) > all.txt

ans.txt: main Makefile
	./main -s $(NBITS) > ans.txt

main: main.c Makefile
	$(CC) -o main main.c

X:
	@/bin/true

zip: clean
	rm -f FSM-patterns.zip ../FSM-patterns.zip
	cd .. && zip -rq FSM-patterns.zip FSM-patterns -x FSM-patterns/NEW
	mv ../FSM-patterns.zip .

clean:
	rm -f main a.out core all.out all.aux all.log

clobber: clean
	rm -f all.txt all.tex all.pdf
