CXX = c++
CXXFLAGS = -std=c++98 -Wall -Wextra -Werror -g
SRCDIR = src
INCDIR = include
OBJDIR = obj
BINDIR = bin
EXECUTABLE = contacts

SRCS = $(wildcard $(SRCDIR)/*.cpp)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
INCS = -I$(INCDIR)

all: $(BINDIR)/$(EXECUTABLE)

$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
	$(CXX) $(CXXFLAGS) $(INCS) -c $< -o $@

$(BINDIR)/$(EXECUTABLE): $(OBJS)
	$(CXX) $(CXXFLAGS) $^ -o $@

clean:
	rm -rf $(OBJDIR)/*.o

fclean: clean
	rm -fr $(BINDIR)/$(EXECUTABLE)

re: fclean $(BINDIR)/$(EXECUTABLE)
