Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
MAKEFILE
# Define the compiler and compiler flags
CXX := g++
CXXFLAGS := -std=c++17 -Wall -g

# Define the names for the executable, source files, and object files
TARGET := main
SOURCES := person.cpp utils.cpp main.cpp
SOURCES := person.cpp utils.cpp main.cpp stacks/expressions_calculator.cpp
OBJECTS := $(SOURCES:.cpp=.o)

# Default rule to build the executable
Expand All @@ -15,17 +16,17 @@ $(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJECTS)

# Generic rule to compile .cpp files into .o files
# $@ is the target, $< is the first prerequisite
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@

# Rules for explicit header dependencies
# These rules tell make which object files depend on which header files.
main.o: main.cpp person.h utils.h
main.o: main.cpp person.h utils.h stacks/expressions_calculator.h
person.o: person.cpp person.h
utils.o: utils.cpp utils.h
stacks/expressions_calculator.o: stacks/expressions_calculator.cpp stacks/expressions_calculator.h

# Rule to clean up generated files
.PHONY: clean
.PHONY: cleanls

clean:
rm -f $(OBJECTS) $(TARGET)