Changelog:
- 26 Jan 2023: make link to
make-lab.tarmatchwgetcommand
This lab is designed to help you feel comfortable using GNU Make, one of the oldest and still most-common build tools; as well as with many-file C projects.
Your task:
We would recommend working with a partner, but it is also fine if you do this alone.
Download
make-lab.tar(you can do this using the link on this page, or from a command line viawget https://www.cs.virginia.edu/~cr4bd/3130/S2023/files/make-lab.tar)Expand it using
tar xvf make-lab.tarRead enough of the files to get an idea what they do. Then build them with
clang *.cand run./a.outto verify your understanding. Ask a TA for help if you are not sure you fully understand.Add a
Makefilein the resultingmake-labdirectory, which- has targets for the following
- build each
.cfile into a.ofile - combine
cheer.oandgrunt.ointo a library (eitherlibsay.aorlibsay.so) - combine the library and
guesser.ointo programguesser
- build each
- has
CC,CFLAGS, andLDFLAGSwe can edit make allcreatesguesserand its dependenciesmake cleandeletes all files thatmakecan recreate- editing
say.hcauses all files to be rebuilt - editing any .c file causes its .o file to be rebuilt, along with the
library and/or program if they depend on the .c file
- Note: if you chose library format
libsay.a, thenguessershould be rebuilt iflibsay.achanges; but if you chose library formatlibsay.so, thenguessershould not be rebuilt iflibsay.sochanges, only ifsay.horguesser.cchange.
- Note: if you chose library format
- has targets for the following
Either:
- Place a comment (line starting with
#) at the top of your Makefile indicating who you worked with and submit your Makefile to the submission site. (If working with a partner, both must submit.) and/or - Show a TA your
Makefile. They may ask you to show it working, or to look at its contents, or both.
- Place a comment (line starting with
Refer to the makefiles and C compilation reading and/or the corresponding C material for information on how to achieve these goals. We recommend you read it in full, discussing it with a partner and asking clarifying questions of TAs as you go, then return to the tasks above.