# Change the value of the VM variable to match the name you used
#  when you ran VM generateVM:.  This will help in having multiple
#  different versions of the vm and sources around while testing
#  changes.
slateroot=../../../../..
VM=vm
CC=gcc
COPTFLAGS=-O2 -fomit-frame-pointer -DNDEBUG=1 -s
CFLAGS=$(COPTFLAGS) -I../includes -I.. -I. -I${slateroot}
LIBS=-lbe
OBJS=../boot.o ../ansifile.o beosdir.o directory.o ../unix/file.o ../unix/main.o ${slateroot}/$(VM).o
prefix=/boot/home/config
exec_prefix=$(prefix)/bin
execname=slate
#lispdir=$(prefix)/share/emacs/site-lisp
includedir=/boot/develop/headers

%.o : %.cpp
	$(CC) -c $< $(INCLUDES) $(CFLAGS) -o $@

default: all

all: $(VM)

clean:
	-rm -f $(OBJS) ${slateroot}/$(VM) ../includes/slatevm.h

$(VM): $(OBJS)
	$(CC) $(CFLAGS) -o $(slateroot)/$(VM) $(OBJS) $(LIBS)

install: ${slateroot}/$(VM) ${slateroot}/$(VM).h
	install ${slateroot}/$(VM) $(exec_prefix)/$(execname)
#	install -d $(lispdir)/
#	install $(slateroot)/etc/slate-mode.el $(lispdir)/
	install ${slateroot}/$(VM).h $(includedir)/slatevm.h

uninstall:
	-rm $(exec_prefix)/$(execname)
#	-rm $(lispdir)/slate-mode.el
	-rm $(includedir)/slatevm.h

$(OBJS) : ../includes/slatevm.h

../includes/slatevm.h : ${slateroot}/$(VM).h
	ln -s -f $< $@
