CXX:=g++
CFLAGS:=-O0 -ggdb -std=c++17
CPPFLAGS:=-D DEBUG
LDLIBS:=
LDFLAGS:=
COMP:=$(CXX) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LDLIBS)

OBJD:=obj/
SRCD:=src/
SRC:=main.cpp lexer.cpp algo.cpp
SRC:=$(addprefix ${SRCD},${SRC})
OBJ:=$(subst .cpp,.o,$(subst ${SRCD},${OBJD},${SRC}))

OUTPUT:=ati.out

.PHONY: main clean run

main: ${OBJ}
	${COMP} ${OBJ} -o ${OUTPUT}

obj/%.o: src/%.cpp
	${COMP} -c $< -o ${OBJD}/$*.o

clean:
	-rm ${OBJD}/*
	-rm ./${OUTPUT}

run:
	./${OUTPUT}

gdb:
	sudo gdb --directory=./src -p $(shell pgrep ${OUTPUT})

algo:
	make -C debug/
