From 160d9ae40280747e4296e48421bc5019d05a1ce5 Mon Sep 17 00:00:00 2001 From: "Marcus M. Darden" <mmdarden@umich.edu> Date: Sat, 3 Feb 2018 23:37:34 -0500 Subject: [PATCH] Clarify the common targets and their actions. Slightly edited these targets (release, debug, all) for consistency. Also picked some nits in comments and 'make help'. --- Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 677f69f..40e27dd 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ PROJECTFILE = $(or $(wildcard project*.cpp), nomain.cpp) # If main() is in another file delete the line above, edit and uncomment below #PROJECTFILE = mymainfile.cpp -# name of the tar ball created for submission +# name of the tarball created for submission PARTIAL_SUBMITFILE = partialsubmit.tar.gz FULL_SUBMITFILE = fullsubmit.tar.gz @@ -61,13 +61,13 @@ 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 release: CXXFLAGS += -O3 -DNDEBUG -release: all +release: $(EXECUTABLE) # make debug - will compile "all" with $(CXXFLAGS) and the -g flag # also defines DEBUG so that "#ifdef DEBUG /*...*/ #endif" works debug: EXECUTABLE := $(DEBUG) debug: CXXFLAGS += -g3 -DDEBUG -debug: clean all +debug: clean $(EXECUTABLE) # make profile - will compile "all" with $(CXXFLAGS) and the -pg flag profile: CXXFLAGS += -pg @@ -78,8 +78,10 @@ profile: clean all static: cppcheck --enable=all --suppress=missingIncludeSystem $(SOURCES) *.h *.hpp -# highest target; sews together all objects into executable -all: $(EXECUTABLE) +# Build both release and debug executables +all: clean + make -Rr release + make debug $(EXECUTABLE): $(OBJECTS) ifeq ($(EXECUTABLE), executable) @@ -167,8 +169,8 @@ EECS281 Advanced Makefile Help $$ make test3 $$ make alltests (this builds all test drivers) C) If test drivers need special dependencies, they must be added manually. - D) IMPORTANT: NO SOURCE FILES THAT BEGIN WITH test WILL BE ADDED TO ANY - SUBMISSION TARBALLS. + D) IMPORTANT: NO SOURCE FILES WITH NAMES THAT BEGIN WITH test WILL BE + ADDED TO ANY SUBMISSION TARBALLS. * Static Analysis support A) Matches current autograder style grading tests -- GitLab