Add files via upload

This commit is contained in:
Mohammed Rahhal 2025-11-10 09:29:14 +01:00 committed by GitHub
parent 76df8a876b
commit eadef225e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 41 additions and 0 deletions

41
Makefile Normal file
View file

@ -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

BIN
calculator Normal file

Binary file not shown.