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
You might also like to view...
Which of the following statements best describes metadata?
A. Information about websites visited B. Files that the operating system by design does not display C. Details about a file that describe or identify it D. Temporary storage area for web documents
What part of the body does CVS impact?
A. eyes B. ears C. arms D. wrists
To remove an embedded chart, you should _____ it and press the DELETE key.
A. move B. drag C. hide D. click
To add a fill to an open path, Illustrator first must close the path by connecting the open points with a path.
Answer the following statement true (T) or false (F)