From 3590c2208456665b5fa57bf7b4ccee3df9e01020 Mon Sep 17 00:00:00 2001 From: "Marcus M. Darden" <mmdarden@umich.edu> Date: Mon, 5 Feb 2018 10:34:09 -0500 Subject: [PATCH] Update formatting. --- Makefile | 86 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 1c3b22a..2b8dd5d 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,10 @@ ################### # IMPORTANT NOTES: -# 1. Set EXECUTABLE to the command name given in the project specification. +# 1. Set EXECUTABLE to the command name from the project specification. # 2. To enable automatic creation of unit test rules, your program logic -# (where main() is) should be in a file named project*.cpp or specified -# in the PROJECTFILE variable. +# (where main() is) should be in a file named project*.cpp or +# specified in the PROJECTFILE variable. # 3. Files you want to include in your final submission cannot match the # test*.cpp pattern. @@ -30,11 +30,11 @@ REMOTE_BASEDIR := eecs281 # TODO # Change EXECUTABLE to match the command name given in the project spec. -EXECUTABLE = executable +EXECUTABLE = executable DEBUG = $(EXECUTABLE)_debug # designate which compiler to use -CXX = g++ +CXX = g++ # list of test drivers (with main()) for development TESTSOURCES = $(wildcard test*.cpp) @@ -42,16 +42,16 @@ TESTSOURCES = $(wildcard test*.cpp) TESTS = $(TESTSOURCES:%.cpp=%) # list of sources used in project -SOURCES = $(wildcard *.cpp) +SOURCES = $(wildcard *.cpp) SOURCES := $(filter-out $(TESTSOURCES), $(SOURCES)) # list of objects used in project -OBJECTS = $(SOURCES:%.cpp=%.o) +OBJECTS = $(SOURCES:%.cpp=%.o) # TODO # If main() is in a file named project*.cpp, use the following line PROJECTFILE = $(or $(wildcard project*.cpp), nomain.cpp) # TODO -# If main() is in another file delete the line above, edit and uncomment below +# If main() is in another file delete line above, edit and uncomment below #PROJECTFILE = mymainfile.cpp # name of the tarball created for submission @@ -61,16 +61,16 @@ FULL_SUBMITFILE = fullsubmit.tar.gz # name of the perf data file, only used by the clean target PERF_FILE = perf.data* -#Default Flags (would prefer -std=c++17 but Mac/Xcode/Clang doesn't support) +#Default Flags (we prefer -std=c++17 but Mac/Xcode/Clang doesn't support) CXXFLAGS = -std=c++1z -Wconversion -Wall -Werror -Wextra -pedantic # make release - will compile "all" with $(CXXFLAGS) and the -O3 flag -# also defines NDEBUG so that asserts will not check +# also defines NDEBUG so that asserts will not check release: CXXFLAGS += -O3 -DNDEBUG release: $(EXECUTABLE) # make debug - will compile "all" with $(CXXFLAGS) and the -g flag -# also defines DEBUG so that "#ifdef DEBUG /*...*/ #endif" works +# also defines DEBUG, so "#ifdef DEBUG /*...*/ #endif" works debug: EXECUTABLE := $(DEBUG) debug: CXXFLAGS += -g3 -DDEBUG debug: clean $(EXECUTABLE) @@ -82,7 +82,8 @@ profile: clean all # make static - will perform static analysis in the matter currently used # on the autograder static: - cppcheck --enable=all --suppress=missingIncludeSystem $(SOURCES) *.h *.hpp + cppcheck --enable=all --suppress=missingIncludeSystem \ + $(SOURCES) *.h *.hpp # Build both release and debug executables all: clean @@ -121,19 +122,25 @@ alltests: clean $(TESTS) # make clean - remove .o files, executables, tarball clean: - rm -f $(OBJECTS) $(EXECUTABLE) $(DEBUG) $(TESTS) $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) $(PERF_FILE) + rm -f $(OBJECTS) $(EXECUTABLE) $(DEBUG) $(TESTS) \ + $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) $(PERF_FILE) rm -Rf *.dSYM -# make partialsubmit.tar.gz - cleans, runs dos2unix, creates tarball omitting test cases -PARTIAL_SUBMITFILES=$(filter-out $(TESTSOURCES), $(wildcard Makefile *.h *.hpp *.cpp)) +# make partialsubmit.tar.gz - cleans, runs dos2unix, creates tarball +# omitting test cases +PARTIAL_SUBMITFILES=$(filter-out $(TESTSOURCES), \ + $(wildcard Makefile *.h *.hpp *.cpp)) $(PARTIAL_SUBMITFILE): $(PARTIAL_SUBMITFILES) rm -f $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) -dos2unix $(PARTIAL_SUBMITFILES) - COPYFILE_DISABLE=true tar -vczf $(PARTIAL_SUBMITFILE) $(PARTIAL_SUBMITFILES) + COPYFILE_DISABLE=true tar -vczf $(PARTIAL_SUBMITFILE) \ + $(PARTIAL_SUBMITFILES) @echo !!! WARNING: No test cases included. Use 'make fullsubmit' to include test cases. !!! -# make fullsubmit.tar.gz - cleans, runs dos2unix, creates tarball including test cases -FULL_SUBMITFILES=$(filter-out $(TESTSOURCES), $(wildcard Makefile *.h *.hpp *.cpp test*.txt)) +# make fullsubmit.tar.gz - cleans, runs dos2unix, creates tarball +# including test cases +FULL_SUBMITFILES=$(filter-out $(TESTSOURCES), \ + $(wildcard Makefile *.h *.hpp *.cpp test*.txt)) $(FULL_SUBMITFILE): $(FULL_SUBMITFILES) rm -f $(PARTIAL_SUBMITFILE) $(FULL_SUBMITFILE) -dos2unix $(FULL_SUBMITFILES) @@ -151,8 +158,7 @@ mac2caen: # Make target directory on CAEN server @echo "Making remote target directory ... ${REMOTE_PATH}" \ >> rsync.log - @ssh login.engin.umich.edu \ - "mkdir -p ${REMOTE_PATH}" \ + @ssh login.engin.umich.edu "mkdir -p ${REMOTE_PATH}" \ >> rsync.log # Synchronize local files into target directory on CAEN @echo "Synchronizing local files to CAEN ..." \ @@ -180,20 +186,28 @@ EECS281 Advanced Makefile Help * General usage 1. Follow directions at each "TODO" in this file. - a. Set EXECUTABLE equal to the name given in the project specification. + a. Set EXECUTABLE equal to the name given in the project + specification. b. Set PROJECTFILE equal to the name of the source file with main() c. Add any dependency rules specific to your files. 2. Build, test, submit... repeat as necessary. * Preparing submissions - A) To build 'partialsubmit.tar.gz', a tarball without tests used to find - buggy solutions in the autograder. This is useful for faster autograder - runs during development and free submissions if the project does not - build. - $$ make partialsubmit - B) Build 'fullsubmit.tar.gz' a tarball complete with autograder test cases. - ALWAYS USE THIS FOR FINAL GRADING! It is also useful when trying to + A) To build 'partialsubmit.tar.gz', a tarball without tests used to find buggy solutions in the autograder. + + *** USE THIS ONLY FOR TESTING YOUR SOLUTION! *** + + This is useful for faster autograder runs during development and + free submissions if the project does not build. + $$ make partialsubmit + B) Build 'fullsubmit.tar.gz' a tarball complete with autograder test + cases. + + *** ALWAYS USE THIS FOR FINAL GRADING! *** + + It is also useful when trying to find buggy solutions in the + autograder. $$ make fullsubmit * Unit testing support @@ -203,7 +217,8 @@ EECS281 Advanced Makefile Help $$ make test_input $$ make test3 $$ make alltests (this builds all test drivers) - C) If test drivers need special dependencies, they must be added manually. + C) If test drivers need special dependencies, they must be added + manually. D) IMPORTANT: NO SOURCE FILES WITH NAMES THAT BEGIN WITH test WILL BE ADDED TO ANY SUBMISSION TARBALLS. @@ -237,24 +252,19 @@ help: # myclass.o: myclass.cpp myclass.h $(HEADERS) # project5.o: project5.cpp myclass.o $(HEADERS) # -# SOME EXAMPLES -# +# ADD YOUR OWN DEPENDENCIES HERE + #test_thing: test_thing.cpp class.o functions.o #class.o: class.cpp class.h #functions.o: functions.cpp functions.h #project0.o: project0.cpp class.h functions.h -# -# THE COMPILER CAN GENERATE DEPENDENCIES FROM SOURCE CODE -# -# % g++ -MM *.cpp -# -# ADD YOUR OWN DEPENDENCIES HERE ###################### # TODO (end) # ###################### # these targets do not create any files -.PHONY: all release debug profile static clean alltests partialsubmit fullsubmit mac2caen help +.PHONY: all release debug profile static clean alltests partialsubmit \ + fullsubmit mac2caen help # disable built-in rules .SUFFIXES: -- GitLab