BANTAM_HOME = /usr/local
BINDIR = $(BANTAM_HOME)/bin
LIBDIR = $(BANTAM_HOME)/lib/bantam
DATADIR = $(BANTAM_HOME)/share/bantam

DEFAULT_TARGET = opt

#SRCS = bantam.ml
#BYTE_OBJS = $(SRCS:.ml=.cmo)
#NAT_OBJS = $(SRCS:.ml=.cmx)

include Makefile.build

.PHONY : all byte opt install clean test

install :
	install -d $(BINDIR)
	$$(for sub in config scripts; do \
		install -d $(DATADIR)/skeleton/$$sub; \
	done)
	install bantam.bin $(BINDIR)
	install bantam.sh $(BINDIR)/bantam
	install -m 644 skeleton/config/* $(DATADIR)/skeleton/config
	install skeleton/scripts/* $(DATADIR)/skeleton/scripts
	install -m 644 VERSION skeleton/logo.png $(DATADIR)

clean :
	-rm -f *.cm? *.o *.a bantam.ml
	-rm -rf testdata

distclean : clean
	-rm -f Makefile* bantam.sh awtest.ml new_add_watch_test.sh *.ml

realclean : clean
	-rm -f bantam bantam.sh bantam.bin

test :
	#export BANTAM_USER_DIR=./skeleton
	#export PATH=$$BANTAM_USER_DIR/scripts:$$PATH
	#export BANTAM_BINDIR=.
	#export BANTAM_DATA=.
	#exec bantam.bin
	cp -R skeleton testdata
	BANTAM_USER_DIR=./testdata PATH=./testdata/scripts:$$PATH ./bantam.bin
