Commit a423bbc2 authored by Marcus M. Darden's avatar Marcus M. Darden
Browse files

Add Project Identifier variable and target

* A variable (IDENTIFIER) was added to allow the 'identifier' target to
  search source code and header files for a matching hash parametrically.
* The phony 'identifier' target greps for the IDENTIFIER pattern in each file
  and fails if any source/header doesn't contain the pattern.
* The identifier target is added as a dependency to fullsubmit and
  partialsubmit.
* Editing IDENTIFIER is now part of the first student TODO in the Makefile.
parent 42283dac
...@@ -20,12 +20,16 @@ ...@@ -20,12 +20,16 @@
####################### #######################
# TODO (begin) # # TODO (begin) #
####################### #######################
# Change IDENTIFIER to match the project identifier given in the project spec.
IDENTIFIER = EEC50281EEC50281EEC50281EEC50281EEC50281
# Change EXECUTABLE to match the command name given in the project spec. # Change EXECUTABLE to match the command name given in the project spec.
EXECUTABLE = executable EXECUTABLE = executable
DEBUG = $(EXECUTABLE)_debug DEBUG = $(EXECUTABLE)_debug
# If main() is in a file named project*.cpp, use the following line # The following line looks for a project's main() in a file named project*.cpp,
PROJECTFILE = $(or $(wildcard project*.cpp), $(EXECUTABLE).cpp) # executable.cpp (substituted from EXECUTABLE above), or main.cpp
PROJECTFILE = $(or $(wildcard project*.cpp), $(wildcard $(EXECUTABLE).cpp), main.cpp)
# If main() is in another file delete line above, edit and uncomment below # If main() is in another file delete line above, edit and uncomment below
#PROJECTFILE = mymainfile.cpp #PROJECTFILE = mymainfile.cpp
####################### #######################
...@@ -88,6 +92,11 @@ static: ...@@ -88,6 +92,11 @@ static:
cppcheck --enable=all --suppress=missingIncludeSystem \ cppcheck --enable=all --suppress=missingIncludeSystem \
$(SOURCES) *.h *.hpp $(SOURCES) *.h *.hpp
# make identifier - will ensure that all source code and header files include
# the project identifier
identifier:
@if [ $$(grep --include=*.{h,hpp,c,cpp} -L $(IDENTIFIER) * | wc -l) -ne 0 ]; then echo "Missing project identifier"; exit 1; fi
# Build both release and debug executables # Build both release and debug executables
all: clean all: clean
$(MAKE) -Rr release $(MAKE) -Rr release
...@@ -151,8 +160,8 @@ $(FULL_SUBMITFILE): $(FULL_SUBMITFILES) ...@@ -151,8 +160,8 @@ $(FULL_SUBMITFILE): $(FULL_SUBMITFILES)
@echo !!! Final submission prepared, test cases included... READY FOR GRADING !!! @echo !!! Final submission prepared, test cases included... READY FOR GRADING !!!
# shortcut for make submit tarballs # shortcut for make submit tarballs
partialsubmit: $(PARTIAL_SUBMITFILE) partialsubmit: identifier $(PARTIAL_SUBMITFILE)
fullsubmit: $(FULL_SUBMITFILE) fullsubmit: identifier $(FULL_SUBMITFILE)
sync2caen: REMOTE_PATH := ${REMOTE_BASEDIR}/$(notdir $(shell pwd)) sync2caen: REMOTE_PATH := ${REMOTE_BASEDIR}/$(notdir $(shell pwd))
sync2caen: sync2caen:
...@@ -257,6 +266,6 @@ help: ...@@ -257,6 +266,6 @@ help:
# these targets do not create any files # these targets do not create any files
.PHONY: all release debug profile static clean alltests partialsubmit \ .PHONY: all release debug profile static clean alltests partialsubmit \
fullsubmit sync2caen help fullsubmit sync2caen help identifier
# disable built-in rules # disable built-in rules
.SUFFIXES: .SUFFIXES:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment