CC := g++ -Wall -Wextra -Wpedantic -Iinclude -Ilibs/OpenMesh/inc -g

LDFLAGS := $(LDFLAGS) -Llibs/OpenMesh/liblinux/ -lOpenMeshCore
CFLAGS := $(CFLAGS)

BUILD_DIR ?= build

OUT := $(notdir $(shell pwd))

SRC := $(wildcard src/*.cpp)
OBJS := $(patsubst src/%.cpp,$(BUILD_DIR)/%.o,$(SRC))
DEPS := $(wildcard $(BUILD_DIR)/*.d)


$(BUILD_DIR)/$(OUT): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $^


-include $(DEPS)
$(BUILD_DIR)/%.o: src/%.cpp
	$(CC) $(CFLAGS) -MP -MD $< -c -o $@


clean:
	-rm -f $(BUILD_DIR)/*.o
	-rm -f $(BUILD_DIR)/*.d
