# Change "no" to "yes" to use our binaries
USE_BINARIES = no

ifeq ($(USE_BINARIES),yes)
  SRCS = lib/linkedlist.o lib/talloc.o main.c tokenizer.c
  HDRS = tokenizer.h lib/linkedlist.h lib/talloc.h lib/schemeitem.h
else
  SRCS = linkedlist.c talloc.c main.c tokenizer.c
  HDRS = tokenizer.h linkedlist.h talloc.h schemeitem.h
endif

CC = clang
CFLAGS = -gdwarf-4 -fPIC

OBJS = $(SRCS:.c=.o)

.PHONY: interpreter
interpreter: $(OBJS)
	$(CC)  $(CFLAGS) $^  -o $@
	rm -f *.o
	rm -f vgcore.*

.PHONY: phony_target
phony_target:

%.o : %.c $(HDRS) phony_target
	$(CC)  $(CFLAGS) -c $<  -o $@

clean:
	rm -f *.o
	rm -f interpreter
