Basic - Make Fall 2026
- Submission Instructions
- Preface
- A fresh start
- Phonies
- Dependencies
- Not repeating yourself
- Conclusion
Submission Instructions
This homework will be submitted as a repository on the EECS GitLab
server. The repository you submit will be a private Project with
the name/path eecs201-basic-make with akamil added as a Reporter. The branch make
will be the one that is checked.
To finish the submission process and get your submission score, you will need to run the autograder. You will need to SSH into the course server (see Basic - Intro):
local$ ssh uniqname@peritia.eecs.umich.edu
(the local$
referring to a shell prompt on your system)
and then run eecs201-test:
peritia$ eecs201-test basic-make
(the peritia$
referring to a shell prompt on the server)
Preface
In this assignment you’ll be provided yet another zipped archive containing some starter files.
https://www.eecs.umich.edu/courses/eecs201/fa2026/files/assignments/basic-make.tar.gz
/
|-- report.txt
|-- 1
|-- Makefile
|-- 2
|-- Makefile
|-- 3
|-- Makefile
|-- 4
|-- Makefile
Note that this assignment is to be submitted on a remote branch called
make. Initialize a
Git repository inside of the extracted
basic-make
directory; as noted above
git init -b <branch name>
or
git init --initial-branch <branch name>
can initialize the repo with a different branch name (e.g.
make as per the
submission instructions). If your version of Git is too old for these
options, you could create the
make branch
afterwards after your first commit, or you can set the local branch’s
tracking information manually. Create a file called
report.txt in this
directory. Add all of the present files and commit them.
Create a private project named
eecs201-basic-make on
the EECS GitLab
(gitlab.eecs.umich.edu)
and add the instructor
akamil as a
Reporter. Set this EECS GitLab project as your remote: you’ll be
pushing to it in order to submit.
In this assignment you will be incrementally building up more complex Makefiles. First, we’ll start at the beginning.
A fresh start
-
cdinto the1directory. -
Create a file named
Makefile. -
Create a rule with a target called
allthat has this for a recipe:
gcc -o nocat nocat.c -
Create a rule with target called
cleanthat has this for a recipe:
rm -f nocat -
Move the
allrule to the top so that it’ll run by default whenmakeis run without a target specified. (There’s actually another way to do this without moving the position: I’ll leave this as a personal exercise ;) -
Make sure that your Makefile works correctly.
-
Add and commit
Makefile.
Phonies
-
cdinto the2directory. -
Take a look at the Makefile and note the existing rules.
-
Try running
make all,make clean, andmake test. -
Note that their recipes do not run.
-
Fix the Makefile so that each of the rules can run their recipes.
Dependencies
-
cdinto the3directory. -
Take a look at the Makefile. Note what each target in the Makefile requires which file.
-
Edit the Makefile so that each target has the proper prerequisites. One way to test this is to run
$ make cleanto delete any (one or all) intermediate build files, and then run$ make <some target>(e.g.$ make nocat) to build one of the targets. The build should succeed as Make will proceed to build any missing intermediate files, and the only files that should be built are the ones that are missing. -
Another test you can do is to
touchone of the source code files and or its intermediate outputs, then run Make. Updating a file’s timestamp viatouchwill cause Make to see it as a file that was updated more recently and thus require a rebuild of files that depend on it: this can point out issues in the dependency chain you represent in the prerequisites of rules. -
The code does compile. Ignore any warnings that the compiler prints out: these are just warnings and are not errors.
Not repeating yourself
-
cdinto the4directory. -
Create a file named
Makefile. -
Edit the
Makefileso that:-
It has a
CCvariable that is set togcc
This variable represents which C compiler to use. -
It has a
BINvariable that is set tosum30
This variable represents what the output executable binary is named. -
It has a
SRCSvariable that contains all the.cfiles under thesrcdirectory. This list should not be hardcoded (for this assignment): if a new.cfile is added, the Makefile should not have to be edited to include it. -
It has a rule to build the output executable binary. Don’t worry about object code. Note that the
-oflag forgccsets the output name. This rule should haveSRCSas a prerequisite. In addition, the recipe should make use of existing variables and automatic variables that refer to the target and prerequisites to avoid repeating yourself (e.g. you shouldn’t be referring toSRCSorBINin the compilation command). -
There is a phony
alltarget that builds the output executable binary. -
There is a phony
cleantarget that removes the output executable binary. -
The
alltarget should run when$ makeis run (without a target specified).
-
Conclusion
-
Add and commit any changes you intend to submit.
-
Fill out the
report.txtfile in the following steps: -
On the first line provide an integer time in minutes of how long it took for you to complete this assignment. It should just be an integer: no letters or words.
-
On the second line and beyond, write down what you learned while doing this assignment. If you already knew how to do all of this, put down “N/A”.
-
Commit your
report.txtfile and push your commits to a branch calledmakeon your remote. Ignore GitLab’s talk about merge requests if you happen to have amainremote branch. -
Remember that as a GitLab assignment, the autograder is available!