# 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=../../../..

include $(slateroot)/Makefile.inc

LIBS+=-lncurses
BASENAME=ncurses-console
OBJS=$(BASENAME).lo

default: all

all: $(OBJS) ncurses-console.so

clean:
	-rm -r -f .libs $(OBJS) *.a *.o
	-cd $(slateroot) && rm -f $(BASENAME).dll $(BASENAME).dll.a $(BASENAME).a $(BASENAME).la

../includes/slatevm.h : ${slateroot}/$(VM).h
	cp $< $@

%.o: %.c
	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $<

%.so: %.la
	$(LIBTOOL) --mode=install install $< `pwd`/$(slateroot)

%.la: %.lo
	$(LIBTOOL) --mode=link $(CC) $(LIBS) -module -o $@ $< -rpath `pwd` $(LDFLAGS)

%.lo: %.c
	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $<
