Consider the following makefile and answer the questions that follow.

CC = gcc
OPTIONS = -ansi
CLIENT = pclient.o myinet.o
SERVER = pserver.o myinet.o
all: client server
client: $(CLIENT)
$(CC) $(OPTIONS) –o pclient $(CLIENT) –lsocket –lnsl –lposix4
server: $(SERVER)
$(CC) $(OPTIONS) –o pserver $(SERVER) –lsocket –lnsl –lposix4
pclient.o: pclient.c myinet.h ipc.h
$(CC) $(OPTIONS) –c pclient.c
pserver.o: pserver.c myinet.h ipc.h
$(CC) $(OPTIONS) –c pserver.c
myinet.o: myinet.c myinet.h
$(CC) $(OPTIONS) –c myinet.c
.PHONY: clean
clean:
rm –f $(CLIENT) $(SERVER)
a) List all the macros, dummy targets, and special targets in the makefile.
b) If the make command is executed without a command line argument, what executable(s) will it build? Why?
c) If the make all command is run, what executable(s) will it build? Why?
d) Draw the dependency tree for the makefile.
e) What command will you use to display the sequence of commands that would be executed if make were to run, without executing the commands? Show a sample run of your command.
f) What command will you run to display lines in the makefile that don’t start with a tab? Show a sample run of your command.

a) Macros: CC = gcc, OPTIONS = -ansi, CLIENT = pclient.o
myinet.o, SERVER = pserver.o myinet.o
Dummy targets: all, clean
Special targets: .PHONY
b) It will build both the client and the server because the dummy target all is the first target in the makefile.
c) It will build both the client and the server because it has both of them as its prerequisites.
d) No solution provided.
e) make -n all
f) grep -v '^' makefile

Computer Science & Information Technology

You might also like to view...

What is the difference between PATA and SATA?

A) SATA is slower. B) PATA transfers one bit at a time. C) One SATA connection allows for only one device to be attached. D) PATA is the newer technology.

Computer Science & Information Technology

Some legal documents are keyed on legal size paper.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology