BASE_PATH?=$(shell git rev-parse --show-toplevel)
COMMON_PATH?=$(BASE_PATH)/_common
BUILD_PATH?=build

SHELL:=bash

CXX=g++
CXXFLAGS=-std=c++20 -Wall -Wextra -Wshadow -Wno-unused-parameter
CXXFLAGS+=-Wno-unused-variable -O2 -g
CXXFLAGS+=-I "$(COMMON_PATH)/include"
CXXFLAGS+=$(CFLAGS_EXTRA)

EXES:=$(sort $(addprefix $(BUILD_PATH)/, $(binaries)))

$(BUILD_PATH)/%: %.cpp
	@mkdir -p $(dir $@)
	$(CXX) -o $@ $< $(CXXFLAGS)

.PHONY: all rebuild clean
all: $(EXES)
rebuild: clean all
clean:
	-rm -r build/
