diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4395926 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +# Makefile for Scientific Calculator + +CXX = g++ +CXXFLAGS = -std=c++17 -Wall -Wextra -O2 +TARGET = calculator +SRCDIR = src +OBJDIR = obj + +# Source files +SOURCES = $(wildcard $(SRCDIR)/*.cpp) +OBJECTS = $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o) + +# Default target +all: $(TARGET) + +# Create object directory if it doesn't exist +$(OBJDIR): + mkdir -p $(OBJDIR) + +# Link object files to create executable +$(TARGET): $(OBJECTS) | $(OBJDIR) + $(CXX) $(OBJECTS) -o $(TARGET) $(LDFLAGS) + @echo "Build complete: $(TARGET)" + +# Compile source files to object files +$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | $(OBJDIR) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Clean build artifacts +clean: + rm -rf $(OBJDIR) $(TARGET) + @echo "Clean complete" + +# Run the calculator in interactive mode +run: $(TARGET) + ./$(TARGET) + +# Phony targets +.PHONY: all clean run + + diff --git a/calculator b/calculator new file mode 100644 index 0000000..ffdf698 Binary files /dev/null and b/calculator differ