Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
makefile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EECS 281
makefile
Commits
3590c220
Commit
3590c220
authored
7 years ago
by
Marcus M. Darden
Browse files
Options
Downloads
Patches
Plain Diff
Update formatting.
parent
fc9d5dcf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Makefile
+48
-38
48 additions, 38 deletions
Makefile
with
48 additions
and
38 deletions
Makefile
+
48
−
38
View file @
3590c220
...
@@ -10,10 +10,10 @@
...
@@ -10,10 +10,10 @@
###################
###################
# IMPORTANT NOTES:
# 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
# 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
# (where main() is) should be in a file named project*.cpp or
# in the PROJECTFILE variable.
#
specified
in the PROJECTFILE variable.
# 3. Files you want to include in your final submission cannot match the
# 3. Files you want to include in your final submission cannot match the
# test*.cpp pattern.
# test*.cpp pattern.
...
@@ -30,11 +30,11 @@ REMOTE_BASEDIR := eecs281
...
@@ -30,11 +30,11 @@ REMOTE_BASEDIR := eecs281
# TODO
# TODO
# 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
# designate which compiler to use
# designate which compiler to use
CXX
=
g++
CXX
=
g++
# list of test drivers (with main()) for development
# list of test drivers (with main()) for development
TESTSOURCES
=
$(
wildcard
test
*
.cpp
)
TESTSOURCES
=
$(
wildcard
test
*
.cpp
)
...
@@ -42,16 +42,16 @@ TESTSOURCES = $(wildcard test*.cpp)
...
@@ -42,16 +42,16 @@ TESTSOURCES = $(wildcard test*.cpp)
TESTS
=
$(
TESTSOURCES:%.cpp
=
%
)
TESTS
=
$(
TESTSOURCES:%.cpp
=
%
)
# list of sources used in project
# list of sources used in project
SOURCES
=
$(
wildcard
*
.cpp
)
SOURCES
=
$(
wildcard
*
.cpp
)
SOURCES
:=
$(
filter-out
$(
TESTSOURCES
)
,
$(
SOURCES
))
SOURCES
:=
$(
filter-out
$(
TESTSOURCES
)
,
$(
SOURCES
))
# list of objects used in project
# list of objects used in project
OBJECTS
=
$(
SOURCES:%.cpp
=
%.o
)
OBJECTS
=
$(
SOURCES:%.cpp
=
%.o
)
# TODO
# TODO
# If main() is in a file named project*.cpp, use the following line
# If main() is in a file named project*.cpp, use the following line
PROJECTFILE
=
$(
or
$(
wildcard project
*
.cpp
)
, nomain.cpp
)
PROJECTFILE
=
$(
or
$(
wildcard project
*
.cpp
)
, nomain.cpp
)
# TODO
# 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
#PROJECTFILE = mymainfile.cpp
# name of the tarball created for submission
# name of the tarball created for submission
...
@@ -61,16 +61,16 @@ FULL_SUBMITFILE = fullsubmit.tar.gz
...
@@ -61,16 +61,16 @@ FULL_SUBMITFILE = fullsubmit.tar.gz
# name of the perf data file, only used by the clean target
# name of the perf data file, only used by the clean target
PERF_FILE
=
perf.data
*
PERF_FILE
=
perf.data
*
#Default Flags (w
ould
prefer -std=c++17 but Mac/Xcode/Clang doesn't support)
#Default Flags (w
e
prefer -std=c++17 but Mac/Xcode/Clang doesn't support)
CXXFLAGS
=
-std
=
c++1z
-Wconversion
-Wall
-Werror
-Wextra
-pedantic
CXXFLAGS
=
-std
=
c++1z
-Wconversion
-Wall
-Werror
-Wextra
-pedantic
# make release - will compile "all" with $(CXXFLAGS) and the -O3 flag
# 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
:
CXXFLAGS += -O3 -DNDEBUG
release
:
$(EXECUTABLE)
release
:
$(EXECUTABLE)
# make debug - will compile "all" with $(CXXFLAGS) and the -g flag
# 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
:
EXECUTABLE := $(DEBUG)
debug
:
CXXFLAGS += -g3 -DDEBUG
debug
:
CXXFLAGS += -g3 -DDEBUG
debug
:
clean $(EXECUTABLE)
debug
:
clean $(EXECUTABLE)
...
@@ -82,7 +82,8 @@ profile: clean all
...
@@ -82,7 +82,8 @@ profile: clean all
# make static - will perform static analysis in the matter currently used
# make static - will perform static analysis in the matter currently used
# on the autograder
# on the autograder
static
:
static
:
cppcheck
--enable
=
all
--suppress
=
missingIncludeSystem
$(
SOURCES
)
*
.h
*
.hpp
cppcheck
--enable
=
all
--suppress
=
missingIncludeSystem
\
$(
SOURCES
)
*
.h
*
.hpp
# Build both release and debug executables
# Build both release and debug executables
all
:
clean
all
:
clean
...
@@ -121,19 +122,25 @@ alltests: clean $(TESTS)
...
@@ -121,19 +122,25 @@ alltests: clean $(TESTS)
# make clean - remove .o files, executables, tarball
# make clean - remove .o files, executables, tarball
clean
:
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
rm
-Rf
*
.dSYM
# make partialsubmit.tar.gz - cleans, runs dos2unix, creates tarball omitting test cases
# make partialsubmit.tar.gz - cleans, runs dos2unix, creates tarball
PARTIAL_SUBMITFILES
=
$(
filter-out
$(
TESTSOURCES
)
,
$(
wildcard Makefile
*
.h
*
.hpp
*
.cpp
))
# omitting test cases
PARTIAL_SUBMITFILES
=
$(
filter-out
$(
TESTSOURCES
)
,
\
$(
wildcard Makefile
*
.h
*
.hpp
*
.cpp
))
$(PARTIAL_SUBMITFILE)
:
$(PARTIAL_SUBMITFILES)
$(PARTIAL_SUBMITFILE)
:
$(PARTIAL_SUBMITFILES)
rm
-f
$(
PARTIAL_SUBMITFILE
)
$(
FULL_SUBMITFILE
)
rm
-f
$(
PARTIAL_SUBMITFILE
)
$(
FULL_SUBMITFILE
)
-
dos2unix
$(
PARTIAL_SUBMITFILES
)
-
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.
!!!
@
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
# make fullsubmit.tar.gz - cleans, runs dos2unix, creates tarball
FULL_SUBMITFILES
=
$(
filter-out
$(
TESTSOURCES
)
,
$(
wildcard Makefile
*
.h
*
.hpp
*
.cpp
test
*
.txt
))
# including test cases
FULL_SUBMITFILES
=
$(
filter-out
$(
TESTSOURCES
)
,
\
$(
wildcard Makefile
*
.h
*
.hpp
*
.cpp
test
*
.txt
))
$(FULL_SUBMITFILE)
:
$(FULL_SUBMITFILES)
$(FULL_SUBMITFILE)
:
$(FULL_SUBMITFILES)
rm
-f
$(
PARTIAL_SUBMITFILE
)
$(
FULL_SUBMITFILE
)
rm
-f
$(
PARTIAL_SUBMITFILE
)
$(
FULL_SUBMITFILE
)
-
dos2unix
$(
FULL_SUBMITFILES
)
-
dos2unix
$(
FULL_SUBMITFILES
)
...
@@ -151,8 +158,7 @@ mac2caen:
...
@@ -151,8 +158,7 @@ mac2caen:
# Make target directory on CAEN server
# Make target directory on CAEN server
@echo
"Making remote target directory ... ${REMOTE_PATH}"
\
@echo
"Making remote target directory ... ${REMOTE_PATH}"
\
>>
rsync.log
>>
rsync.log
@ssh
login.engin.umich.edu
\
@ssh
login.engin.umich.edu
"mkdir -p ${REMOTE_PATH}"
\
"mkdir -p ${REMOTE_PATH}"
\
>>
rsync.log
>>
rsync.log
# Synchronize local files into target directory on CAEN
# Synchronize local files into target directory on CAEN
@echo
"Synchronizing local files to CAEN ..."
\
@echo
"Synchronizing local files to CAEN ..."
\
...
@@ -180,20 +186,28 @@ EECS281 Advanced Makefile Help
...
@@ -180,20 +186,28 @@ EECS281 Advanced Makefile Help
*
General
usage
*
General
usage
1.
Follow
directions
at
each
"TODO"
in
this
file.
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()
b.
Set
PROJECTFILE
equal
to
the
name
of
the
source
file
with
main()
c.
Add
any
dependency
rules
specific
to
your
files.
c.
Add
any
dependency
rules
specific
to
your
files.
2.
Build,
test,
submit...
repeat
as
necessary.
2.
Build,
test,
submit...
repeat
as
necessary.
*
Preparing
submissions
*
Preparing
submissions
A)
To
build
'partialsubmit.tar.gz'
,
a
tarball
without
tests
used
to
find
A)
To
build
'partialsubmit.tar.gz'
,
a
tarball
without
tests
used
to
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
find
buggy
solutions
in
the
autograder.
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
$$
make
fullsubmit
*
Unit
testing
support
*
Unit
testing
support
...
@@ -203,7 +217,8 @@ EECS281 Advanced Makefile Help
...
@@ -203,7 +217,8 @@ EECS281 Advanced Makefile Help
$$
make
test_input
$$
make
test_input
$$
make
test3
$$
make
test3
$$
make
alltests
(this
builds
all
test
drivers)
$$
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
D) IMPORTANT
:
NO SOURCE FILES WITH NAMES THAT BEGIN WITH test WILL BE
ADDED
TO
ANY
SUBMISSION
TARBALLS.
ADDED
TO
ANY
SUBMISSION
TARBALLS.
...
@@ -237,24 +252,19 @@ help:
...
@@ -237,24 +252,19 @@ help:
# myclass.o: myclass.cpp myclass.h $(HEADERS)
# myclass.o: myclass.cpp myclass.h $(HEADERS)
# project5.o: project5.cpp myclass.o $(HEADERS)
# project5.o: project5.cpp myclass.o $(HEADERS)
#
#
#
SOME EXAMPLES
#
ADD YOUR OWN DEPENDENCIES HERE
#
#test_thing: test_thing.cpp class.o functions.o
#test_thing: test_thing.cpp class.o functions.o
#class.o: class.cpp class.h
#class.o: class.cpp class.h
#functions.o: functions.cpp functions.h
#functions.o: functions.cpp functions.h
#project0.o: project0.cpp class.h 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) #
# TODO (end) #
######################
######################
# these targets do not create any files
# 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
# disable built-in rules
.SUFFIXES
:
.SUFFIXES
:
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment