Question: 2. Consider the following makefile. The files block2.c, block2.h, block1.c. block1.h and main.c all reside in the same directory as the makefile. There are no

2. Consider the following makefile. The files block2.c, block2.h, block1.c. block1.h and main.c all reside in the same directory as the makefile. There are no other files in this directory. CC=gcc CFLAGS=-C - Wall all: final final: main.o block1.o block2.o $(CC) main.o block1.o block2.o -o final main.o: main.c $(CC) $(CFLAGS) main.c block1.o: blockl.c block1.h $(CC) $(CFLAGS) block1.c block2.o: block2.c block2.h $(CC) $(CFLAGS) block2.c clean; rm -f final *.0 a) Suppose I run make in the above directory. List the files that are created? Assume that all the C files compile correctly without errors. b) Suppose I modify blockl.c after running step a). Assume that after the modifications, blockl.c still compiles correctly. If I now run make, which file(s) get re-generated? Why is it that all files from the previous step are not re- generated? c) Suppose I run touch main.c and execute make main.o, which new file/files will be generated? 2. Consider the following makefile. The files block2.c, block2.h, block1.c. block1.h and main.c all reside in the same directory as the makefile. There are no other files in this directory. CC=gcc CFLAGS=-C - Wall all: final final: main.o block1.o block2.o $(CC) main.o block1.o block2.o -o final main.o: main.c $(CC) $(CFLAGS) main.c block1.o: blockl.c block1.h $(CC) $(CFLAGS) block1.c block2.o: block2.c block2.h $(CC) $(CFLAGS) block2.c clean; rm -f final *.0 a) Suppose I run make in the above directory. List the files that are created? Assume that all the C files compile correctly without errors. b) Suppose I modify blockl.c after running step a). Assume that after the modifications, blockl.c still compiles correctly. If I now run make, which file(s) get re-generated? Why is it that all files from the previous step are not re- generated? c) Suppose I run touch main.c and execute make main.o, which new file/files will be generated
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
