DEPENDENCIES=main.c arraychecks.h controller.h cartridge.c jtables.h tables.h utils.h Makefile
COPTS =  -Wall -g -DLINUX
LIBS = -lncursesw
ifeq ($(USER),gtoal)
  # Other users don't have a copy of my modified cpp which is used to add array bound checks
  COPTS += -DPARM_ARRAY
  DEPENDENCIES += .utils.c
else
  DEPENDENCIES += utils.i
endif

all:    main

main: $(DEPENDENCIES)
	cc -o main $(COPTS) main.c $(LIBS)

# utils needs to be .i so that Vide doesn't attemp to compile it as well as include it in main.c
.utils.c: utils.i arraychecks.h
	gtcpp -DPARM_ARRAY utils.i | grep -v \#line > .utils.c

clean:
	rm -f *.o *~ main

upload:
	scp README.txt Makefile Remaze.s arraychecks.h controller.h cartridge.c main.c utils.i utils.h tables.h jtables.h gtoal@gtoal.com:gtoal.com/vectrex/puck/sources/
