ROOT=../..
SRC_3RD=$(ROOT)/src_3rd
CFLAGS = -Wall -g -I$(SRC_3RD) -I..
LIBS = $(SRC_3RD)/libualloc/libualloc.a $(SRC_3RD)/genht/libgenht.a $(SRC_3RD)/genvector/vtp0.o
LDFLAGS = -lm
OBJS=tester.o grbs.o debug.o addr_hash.o rtree.o snapshot.o

# These are #included in grbs.o for best link time optimization
GRBS_C=\
  route_common.c route_next.c route_realize.c route_remove.c route_modify.c \
  route_detach.c route_sanity.c obj_line.c obj_arc.c obj_point.c collision.c \
  addr.c geo.c force_attach.c force_attach.h

tester: $(OBJS)
	$(CC) -o tester $(OBJS) $(LIBS) $(LDFLAGS)

tester.o: tester.c grbs.h debug.h route.h

grbs.o: grbs.c $(GRBS_C)  grbs.h route.h debug.h addr_hash.h

debug.o: debug.c debug.h grbs.h

addr_hash.o: addr_hash.c addr_hash.h grbs.h

clean:
	-rm $(OBJS) tester

test:
	cd regression && ./Test.sh
	@echo "*** QC pass ***"

