#CC=clang
#CC=gcc
# older GCC needs -std=c99
GCCDEVEL= -std=c99 # -Wformat-overflow=1 # -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable
CLANGDEVEL= # -Wno-unused-function -Wno-unused-variable
MAINSOURCES=i2c.c icode.c ast.c pass1-flat.c
UTILSOURCES=impsup-signals.c flex.c stringpool.c
SOURCES=${MAINSOURCES} ${UTILSOURCES}

all:    # get the benefit of warnings from both compilers.
	gcc -Wall ${GCCDEVEL} -g -static -o i2c ${SOURCES} # && clang -Wall ${CLANGDEVEL} -g -static -o i2c ${SOURCES}
	cc -o uncomment uncomment.c
	./i2c hello.imp
	./i2c --stdout --tidy goodbye.imp > goodbye.c
	./i2c --stdout --line goodbye.imp > goodbye-safe.c
	cc -DPARM_CHECK -g -O2 -o hello hello.c perms.c
	./hello

# uncomment invokes 
uncomment: uncomment.c
	cc -o uncomment uncomment.c

upload:
	zip i2c.zip i2c.c ast.c icode.c  pass1-flat.c impsup-signals.c impsig.h hello.imp goodbye.imp goodbye.c Makefile ast.h icode.h stdperm.inc perms.h perms.inc perms.c imptoc.h impsig.h tables.h flex.c stringpool.c flex.h i2c.h stringpool.h dltest.c uncomment.c uninitcheck.c README.txt recordunions.txt
	scp i2c.zip gtoal@gtoal.com:gtoal.com/tmp/for_fiona/
	scp i2c.zip gtoal@gtoal.com:gtoal.com/history.dcs.ed.ac.uk/archive/languages/imp77-tmp/gtoal/
	ssh gtoal@gtoal.com '( cd gtoal.com/history.dcs.ed.ac.uk/archive/languages/imp77-tmp/gtoal ; unzip -o i2c.zip ; )'
