Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

13. Assume that the following makefile has been created: progl: progl.o util.o g

ID: 3750010 • Letter: 1

Question

13. Assume that the following makefile has been created: progl: progl.o util.o gcc -o progl progl.o util.o gcc-c progl.c gcc -c util.c prog1.o: progl.c util.h util.o: util.c uti1.h and that the source files prog1.c, util.c, and util.h have all been created and compile. The command make progl is then given, which causes the executable prog1 (along with the relevant.o files) to be built. A. (4 points) Now, assume that the file util.c is modified, and then the command make progl is again given. Which gcc commands are executed? B. (4 points) Now assume that the file util.h is modified, and then the command make progl is again given. Which gcc commands are executed?

Explanation / Answer

Q(A)

gcc -c util.c
gcc -o prog1 prog1.o util.o

Explanation: As the code in util.c was modified, the target that have object file dependencies on util.o need to re-compiled.

Q(B)

gcc -c prog1.c
gcc -c util.c
gcc -o prog1 prog1.o util.o

Explanation: As util.h is included as dependency for prog1.o and util.o, these files - prog1.c and util.c need to be recompiled.

Finally, as the object files have been modified, the gcc -o prog1 target is also invoked.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote