From 889672e1db559d3b54a84a903697d82bc041e0ce Mon Sep 17 00:00:00 2001
From: "Marcus M. Darden" <mmdarden@umich.edu>
Date: Mon, 4 May 2020 16:02:03 -0400
Subject: [PATCH] Add the 'ungraded' target

Prior to this change, a student would need to create their own tarball
if they wanted to only upload code to facilitate staff viewing their
code on the AG. This makes a source-only archive with no tests or
Makefile, to guarantee that a submission is not used.
---
 Makefile | 46 +++++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 7360c90..c7836a0 100644
--- a/Makefile
+++ b/Makefile
@@ -61,8 +61,9 @@ SOURCES     := $(filter-out $(TESTSOURCES), $(SOURCES))
 OBJECTS     = $(SOURCES:%.cpp=%.o)
 
 # name of the tarball created for submission
-PARTIAL_SUBMITFILE = partialsubmit.tar.gz
 FULL_SUBMITFILE = fullsubmit.tar.gz
+PARTIAL_SUBMITFILE = partialsubmit.tar.gz
+UNGRADED_SUBMITFILE = ungraded.tar.gz
 
 # name of the perf data file, only used by the clean target
 PERF_FILE = perf.data*
@@ -144,31 +145,46 @@ alltests: $(TESTS)
 # make clean - remove .o files, executables, tarball
 clean:
 	rm -f $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE)_debug $(EXECUTABLE)_profile \
-      $(TESTS) $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) $(PERF_FILE)
+      $(TESTS) $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) $(PERF_FILE) \
+      $(UNGRADED_SUBMITFILE)
 	rm -Rf *.dSYM
 
+
+# get a list of all files that might be included in a submit
+# different submit types can do additional filtering to remove unwanted files
+FULL_SUBMITFILES=$(filter-out $(TESTSOURCES), \
+                   $(wildcard Makefile *.h *.hpp *.cpp test*.txt))
+
+# make fullsubmit.tar.gz - cleans, runs dos2unix, creates tarball
+# including test files
+$(FULL_SUBMITFILE): $(FULL_SUBMITFILES)
+	rm -f $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) $(UNGRADED_SUBMITFILE)
+	COPYFILE_DISABLE=true tar -vczf $(FULL_SUBMITFILE) $(FULL_SUBMITFILES)
+	@echo !!! Final submission prepared, test files included... READY FOR GRADING !!!
+
 # make partialsubmit.tar.gz - cleans, creates tarball
 # omitting test files
-PARTIAL_SUBMITFILES=$(filter-out $(TESTSOURCES), \
-                      $(wildcard Makefile *.h *.hpp *.cpp))
+PARTIAL_SUBMITFILES=$(filter-out $(wildcard test*.txt), $(FULL_SUBMITFILES))
 $(PARTIAL_SUBMITFILE): $(PARTIAL_SUBMITFILES)
-	rm -f $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE)
+	rm -f $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) $(UNGRADED_SUBMITFILE)
 	COPYFILE_DISABLE=true tar -vczf $(PARTIAL_SUBMITFILE) \
       $(PARTIAL_SUBMITFILES)
 	@echo !!! WARNING: No test files included. Use 'make fullsubmit' to include test files. !!!
 
-# make fullsubmit.tar.gz - cleans, runs dos2unix, creates tarball
-# including test files
-FULL_SUBMITFILES=$(filter-out $(TESTSOURCES), \
-                   $(wildcard Makefile *.h *.hpp *.cpp test*.txt))
-$(FULL_SUBMITFILE): $(FULL_SUBMITFILES)
-	rm -f $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE)
-	COPYFILE_DISABLE=true tar -vczf $(FULL_SUBMITFILE) $(FULL_SUBMITFILES)
-	@echo !!! Final submission prepared, test files included... READY FOR GRADING !!!
+# make ungraded.tar.gz - cleans, creates tarball omitting test files, Makefile
+UNGRADED_SUBMITFILES=$(filter-out Makefile, $(PARTIAL_SUBMITFILES))
+$(UNGRADED_SUBMITFILE): $(UNGRADED_SUBMITFILES)
+	rm -f $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) $(UNGRADED_SUBMITFILE)
+	@touch __ungraded
+	COPYFILE_DISABLE=true tar -vczf $(UNGRADED_SUBMITFILE) \
+      $(UNGRADED_SUBMITFILES) __ungraded
+	@rm -f __ungraded
+	@echo !!! WARNING: This submission will not be graded. !!!
 
 # shortcut for make submit tarballs
-partialsubmit: identifier $(PARTIAL_SUBMITFILE)
 fullsubmit: identifier $(FULL_SUBMITFILE)
+partialsubmit: identifier $(PARTIAL_SUBMITFILE)
+ungraded: identifier $(UNGRADED_SUBMITFILE)
 
 # REMOTE_PATH has default definition above
 sync2caen:
@@ -279,6 +295,6 @@ help:
 
 # these targets do not create any files
 .PHONY: all release debug profile static clean alltests partialsubmit \
-        fullsubmit sync2caen help identifier
+        fullsubmit ungraded sync2caen help identifier
 # disable built-in rules
 .SUFFIXES:
-- 
GitLab