Commit 35c22609 authored by James Knee's avatar James Knee
Browse files

lab5 makefile

parent f96458b4
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ LAB1_SRCS = LabOne.cpp lab1.cpp $(COMMON_SRCS)
LAB2_SRCS = LabTwo.cpp lab2.cpp
LAB3_SRCS = LabThree.cpp
LAB4_SRCS = LabFour.cpp $(COMMON_SRCS)
LAB5_SRCS = LabFive.cpp 

# Object files
COMM_OBJS = Support/Common.o
@@ -19,7 +20,8 @@ LAB1_OBJS = LabOne.o lab1.o $(COMM_OBJS)
LAB2_OBJS = LabTwo.o lab2.o
LAB3_OBJS = LabThree.o
LAB4_OBJS = LabFour.o $(COMM_OBJS)
OBJS = $(COMM_OBJS) $(LAB0_OBJS) $(LAB1_OBJS) $(LAB2_OBJS) $(LAB3_OBJS) $(LAB4_OBJS)
LAB5_OBJS = LabFive.o
OBJS = $(COMM_OBJS) $(LAB0_OBJS) $(LAB1_OBJS) $(LAB2_OBJS) $(LAB3_OBJS) $(LAB4_OBJS) $(LAB5_OBJS)

# Executable names
LAB0_EXEC = lab0
@@ -27,10 +29,11 @@ LAB1_EXEC = lab1
LAB2_EXEC = lab2
LAB3_EXEC = lab3
LAB4_EXEC = lab4
EXEC = $(LAB0_EXEC) $(LAB1_EXEC) $(LAB2_EXEC) $(LAB3_EXEC) $(LAB4_EXEC)
LAB5_EXEC = lab5
EXEC = $(LAB0_EXEC) $(LAB1_EXEC) $(LAB2_EXEC) $(LAB3_EXEC) $(LAB4_EXEC) $(LAB5_EXEC)

# Default target to build the executable
all: $(LAB0_EXEC) $(LAB1_EXEC) $(LAB2_EXEC) $(LAB3_EXEC) $(LAB4_EXEC)
all: $(LAB0_EXEC) $(LAB1_EXEC) $(LAB2_EXEC) $(LAB3_EXEC) $(LAB4_EXEC) $(LAB5_EXEC)

# Rule to build the executable from object files
$(LAB0_EXEC): $(LAB0_OBJS) Makefile
@@ -54,6 +57,10 @@ $(LAB4_EXEC): $(LAB4_OBJS) Makefile lab4.cpp
	$(CXX) $(CXXFLAGS) -o $(LAB4_EXEC) $(LAB4_OBJS)
	./$(LAB4_EXEC)

$(LAB5_EXEC): $(LAB5_OBJS) Makefile lab5.cpp
	$(CXX) $(CXXFLAGS) -o $(LAB5_EXEC) $(LAB5_OBJS)
	./$(LAB5_EXEC)

# Rules to build object files from source files, with dependency on the Common.h header
%.o: %.cpp Support/Common.h Makefile
	$(CXX) $(CXXFLAGS) -c $< -o $@