For this assignment, you’ll explore the Makefile of scdoc. scdoc is an open-source project used to generate man pages—which have a notoriously ugly formatting language—from a more friendly, Markdown-like language. The scdoc source repository is located here1. You can click “tree” to see a web listing of the repository’s files, or you can clone it and browse around using the CLI. You’ll eventually need to clone it to answer some questions.
Navigate to the tree at commit 5ea8873e, open up the Makefile for the “scdoc” project, and answer the following questions. Please provide both the answer and how you arrived at that answer (show your work or cite your sources, as appropriate):
make
build if you run it with no
arguments? Assume GNU Make.scdoc
binary, includes a number of Make variable expansions (the words starting
with $
).
LDFLAGS
. What three places can these values come from?make scdoc
from a clean directory (i.e. after initial checkout
or running “make clean”), you will see 10 commands that get run. Please do
this and tell us the commands. Annotate each command with the line number of
the Makefile that generated the command. Many of these will share a line
number—that’s okay.make scdoc
beyond the ones you
annotated in the previous question? If so, what are they and why were they
not included in the output?make
.build/main.o
? Be specific and do not assume anything about the state of
the .build/
directory.install
rule copies the resulting binary and documentation to various
special system directories so that you can use the program from anywhere on
your system. To do this, it runs the install
command. What does the
install
program do? Why might you use it instead of cp
?.PHONY
and
lists a number of targets. What is the purpose of this line? What could
happen if it were not present?Write your answers in a text file, answers.txt
. Submit this file on
Gradescope.
You may notice that, unlike many of the other projects you’ve encountered, scdoc is hosted on SourceHut and not GitHub. SourceHut and GitHub are just two examples of Git hosting platforms; GitLab is another. Regardless of what hosting platform a project’s main repository uses, the repository itself is still plain Git. That means you can clone it, make local commits, and even push your own copy (or fork) to a different hosting provider! This illustrates the distributed nature of Git—your local clone contains the entire repository and all metadata needed to reconstruct it elsewhere. ↩