CXX = c++
CXXFLAGS = -Wall -Wextra -Werror -std=c++98
OBJDIR = obj
SOURCES = Main.cpp BitcoinExchange.cpp
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o))
NAME = btc

all: $(NAME)

$(OBJDIR):
	@echo "📁 Creating obj directory..."
	@mkdir -p $(OBJDIR)

$(OBJDIR)/%.o: %.cpp | $(OBJDIR)
	@echo "🧠 Compiling $< ..."
	@$(CXX) $(CXXFLAGS) -c $< -o $@
	@echo "✅ $@ ready!"

$(NAME): $(OBJECTS)
	@echo "🔗 Linking $(NAME) ..."
	@$(CXX) $(CXXFLAGS) $(OBJECTS) -o $(NAME)
	@echo "🎉 $(NAME) is ready!"

clean:
	@echo "🧹 Cleaning object files..."
	@rm -rf $(OBJDIR)
	@echo "✨ Objects cleaned!"

fclean: clean
	@echo "🗑️  Removing $(NAME)..."
	@rm -f $(NAME)
	@echo "💀 Full clean complete!"

re: fclean all

.PHONY: all clean fclean re
