
# This is where the otls will be placed. Feel free to change it
OTLDIR      = ./otls

# This should have all locations where include files are (if any)
VEXINC      = -I. -I./include       # these are just examples for syntax

# This should have any special defines (if any)
VEXDEF      = -DSHADER -Dush_vex    # these are just examples for syntax


#-----------------------------------------------------------------------------
# You should be able to leave what follows alone
#-----------------------------------------------------------------------------
MAKEDEPEND  = cpp -M 

VFLSRCS     = $(wildcard *.vfl)
OTLS        = $(VFLSRCS:%.vfl=$(OTLDIR)/%.otl)

.PHONY: all clobber tell 
all: $(OTLS) 

$(OTLDIR)/%.otl : %.vfl
	@mkdir -p $(OTLDIR)
	@echo Building Dependencies for $< ...
	@$(SHELL) -ec '$(MAKEDEPEND) $(VEXINC) $(VEXDEF) -MT $@ $< \
	             | sed -e '\''s/\($*\)\.otl[ :]*/$*.otl $*.d : /g'\'' > $*.d; \
	             [ -s $*.d ] || rm -f $*.d'
	@echo Compiling and building OTL from $< ...
	vcc $(VEXINC) $(VEXDEF) -L $@ $<


-include $(VFLSRCS:.vfl=.d)

clobber:
	@/bin/rm -f $(OTLS) ./*.d

tell:
	@echo VFLSRCS = $(VFLSRCS)
	@echo OTLS = $(OTLS)

