# Makefile - Don Yang (uguu.org)
#
# For use with GNU make, tested on cygwin and linux.

source = kazari.ml
ifeq ($(OSTYPE),cygwin)
	target = kazari.exe
	ppmtobmp = ppmtobmp.exe
	cflags = -Wall -O3 -finline-functions -mno-cygwin
else
	target = kazari
	ppmtobmp = ppmtobmp
	cflags = -Wall -O3 -finline-functions
endif

all: $(target) $(ppmtobmp)

$(target): $(source)
	ocamlopt $(source) -o $@
	strip $@

$(ppmtobmp): ppmtobmp.c
	gcc $(cflags) $< -o $@
	strip $@

test: $(source)
	perl test.pl $(source)

clean:
	-rm -f $(target) *.cmi *.cmx *.cmo *.o
	-rm -f $(ppmtobmp) *.ppm test_tmp.*

backup:
	-rm -f backup.tar.gz
	tar cf backup.tar *.ml *.pl *.c *.txt Makefile
	gzip -9 backup.tar
