Add files via upload
This commit is contained in:
parent
76df8a876b
commit
eadef225e4
2 changed files with 41 additions and 0 deletions
41
Makefile
Normal file
41
Makefile
Normal 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
BIN
calculator
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue