SRCS := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(SRCS))
DEPS := $(patsubst %.c,%.d,$(SRCS))

all: ../Treeps $(DEPS) $(OBJS)

clean: 
	rm -f *~ *.o *.d main

COMPILE ?= g++ -g -Wall -c
LINK ?= g++ -g -Wall 
MAKEDEP ?= g++ -M

MAINOBJECTS=../shared/read_data.o ../shared/dictionary.o treeps.o main.o palette.o options.o

../Treeps: $(MAINOBJECTS)
	$(LINK) $(MAINOBJECTS) -o ../Treeps

%d:%c
	$(MAKEDEP) $< > $@
	$(MAKEDEP) $< | sed s/\\.o/.d/ >> $@

%.o: %.c
	$(COMPILE) $<


-include $(DEPS)
