# Makefile, generated with support of ChatGPT # Compiler and flags CXX = g++ CXXFLAGS = -Wall -std=c++17 # Source files PROBLEM2_SRCS = testProblem2.cpp problem2.cpp PROBLEM3_SRCS = testProblem3.cpp problem3.cpp PROBLEM4_SRCS = testProblem4.cpp problem4.cpp SRCS = $(PROBLEM2_SRCS) $(PROBLEM3_SRCS) $(PROBLEM4_SRCS) # Object files PROBLEM2_OBJS = testProblem2.o problem2.o PROBLEM3_OBJS = testProblem3.o problem3.o PROBLEM4_OBJS = testProblem4.o problem4.o OBJS = $(PROBLEM2_OBJS) $(PROBLEM3_OBJS) $(PROBLEM4_OBJS) # Executable names PROBLEM2_EXEC = problem2 PROBLEM3_EXEC = problem3 PROBLEM4_EXEC = problem4 # Default target to build the executable all: $(PROBLEM2_EXEC) $(PROBLEM3_EXEC) $(PROBLEM4_EXEC) # Rule to build the executable from object files $(PROBLEM2_EXEC): $(PROBLEM2_OBJS) Makefile $(CXX) $(CXXFLAGS) -o $(PROBLEM2_EXEC) $(PROBLEM2_OBJS) $(PROBLEM3_EXEC): $(PROBLEM3_OBJS) Makefile $(CXX) $(CXXFLAGS) -o $(PROBLEM3_EXEC) $(PROBLEM3_OBJS) $(PROBLEM4_EXEC): $(PROBLEM4_OBJS) Makefile $(CXX) $(CXXFLAGS) -o $(PROBLEM4_EXEC) $(PROBLEM4_OBJS) # Rules to build object files from source files, with dependency on the Common.h header %.o: %.cpp %.h Makefile $(CXX) $(CXXFLAGS) -c $< -o $@ # Clean target to remove compiled files clean: rm -f $(OBJS) $(EXEC)