.PHONY: clean sync

eigenmath: defs.h prototypes.h *.c
	gcc -Wall -O0 -o eigenmath -include defs.h -include prototypes.h *.c -lm

prototypes.h: *.c
	make -s -C ../tools make-prototypes
	../tools/make-prototypes . > prototypes.h

clean:
	rm -f eigenmath prototypes.h

sync:

# sed removes main.c and fmt.c

files := $(shell ls *.c | sed "s/main\.c//;s/fmt\.c//")

sync:
	cp defs.h ../xcode/src
	cat defs.h prototypes.h $(files) > ../xcode/src/eigenmath.c
	make -s -C ../tools make-prototypes
	../tools/make-prototypes ../xcode/src > ../xcode/src/prototypes.h
