First shot of libt and some examples
libt serves (well, might serve at some point) as a basic
library for Tea language. Added directory with examples
demostration Tea (and libt)
Both includes makefiles to compile libt and examples to
compile them down to machine code. This also demonstrates
how to use `teak`, a standalone Tea compiler.
# Sources
SOURCES = $(wildcard *.tea)
OBJECTS = $(patsubst %.tea,%.o,$(SOURCES))
LIBT = ../libt/libt.bc
# Tools
AR=ar
LD=ld
CC=gcc
TEAK = ../compiler/cli/teak
LLVM_CONFIG ?= llvm-config-3.8
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir)
LLVM_LLC = $(LLVM_BINDIR)/llc
LLVM_LINK = $(LLVM_BINDIR)/llvm-link
LLVM_OPT = $(LLVM_BINDIR)/opt
# Flags
LLVM_OPT_FLAGS = -O2
all: $(OBJECTS)
# ----------vvvvvvvvvv should be replace by real dependendies of .tea file
%.bc: %.tea
$(TEAK) $(SOURCES)
%.all.bc: %.bc
$(LLVM_LINK) -o=$@ $< $(LIBT)
%.opt.bc: %.all.bc
$(LLVM_OPT) $(LLVM_OPT_FLAGS) -o=$@ $<
%.o: %.opt.bc
$(LLVM_LLC) -filetype=obj -o=$@ $<
clean:
rm -f *.bc *.o