Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -20,12 +20,16 @@
#######################
# 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.
EXECUTABLE = executable
DEBUG = $(EXECUTABLE)_debug
# If main() is in a file named project*.cpp, use the following line
PROJECTFILE = $(or $(wildcard project*.cpp), $(EXECUTABLE).cpp)
# The following line looks for a project's main() in a file named project*.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
#PROJECTFILE = mymainfile.cpp
#######################
......@@ -88,6 +92,11 @@ static:
cppcheck --enable=all --suppress=missingIncludeSystem \
$(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
all: clean
$(MAKE) -Rr release
......@@ -151,8 +160,8 @@ $(FULL_SUBMITFILE): $(FULL_SUBMITFILES)
@echo !!! Final submission prepared, test cases included... READY FOR GRADING !!!
# shortcut for make submit tarballs
partialsubmit: $(PARTIAL_SUBMITFILE)
fullsubmit: $(FULL_SUBMITFILE)
partialsubmit: identifier $(PARTIAL_SUBMITFILE)
fullsubmit: identifier $(FULL_SUBMITFILE)
sync2caen: REMOTE_PATH := ${REMOTE_BASEDIR}/$(notdir $(shell pwd))
sync2caen:
......@@ -257,6 +266,6 @@ help:
# these targets do not create any files
.PHONY: all release debug profile static clean alltests partialsubmit \
fullsubmit sync2caen help
fullsubmit sync2caen help identifier
# disable built-in rules
.SUFFIXES:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment