As @some-programmer-dude commented, I added both of the projects to the all command and now it is making both of the projects:
# Default target: build only the main program
all:$(MAIN_EXEC) $(TEST_EXEC)
# Build main program
$(MAIN_EXEC): $(MAIN_SRC)
$(CXX) $(CXXFLAGS) -o $(MAIN_EXEC) $(MAIN_SRC)
# Build test program
# test: $(TEST_EXEC)
$(TEST_EXEC): $(TEST_SRC)
$(CXX) $(CXXFLAGS) -o $(TEST_EXEC) $(TEST_SRC)