7.
|
Modify the badtabs.c program (page 851) so that it exits cleanly (with a specific return value). Compile the program and run it using gdb or another debugger. What values does the debugger report when the program finishes executing?
|
8.
|
For the makefile
$ cat Makefile
leads: menu.o users.o resellers.o prospects.o
gcc o leads menu.o users.o resellers.o prospects.o
menu.o: menu.h dialog.h inquiry.h
users.o: menu.h dialog.h
prospects.o: dialog.h
identify:
-
Targets.
-
Construction commands.
-
Prerequisites.
|
9.
|
Refer to Makefile in exercise 8 to answer the following questions:
-
If the target leads is up-to-date and you then change users.c, what happens when you run make again? Be specific.
-
Rewrite the makefile to include the following macros:
OBJECTS = menu.o users.o resellers.o prospects.o
HFILES = menu.h dialog.h
|
10.
|
Review the make info page to answer the following questions:
-
What does the t option do?
-
If you have files named makefile and Makefile in the working directory, how can you instruct make to use Makefile?
-
Give two ways to define a variable so that you can use it inside a makefile.
|
11.
|
Refer to the makefile for compute on page 846.
-
Suppose that a file in the working directory is named clean. What is the effect of giving the following command? Explain.
$ make clean
-
The discussion on page 844 states that the following command is not normally seen in makefiles:
cat num.h table.h > form.h
What is the effect of removing this construction command from the makefile while retaining the dependency line?
-
The preceding construction command works only because the file form.h is made up of num.h and table.h. More often #include directives in the target define the dependencies. Suggest a more general technique that updates form.h whenever num.h or table.h has a more recent modification date. |