Q:  How can I get make to recompile my program when I've only edited one of the .h files? I've changed the class by editing the interface file, but it thinks the program is up to date.  

Q: Is there an easy way to recursively trace all the header files that my source file depends on?

A:  You can, of course, fool make by typing

	touch foo.m

in a shell, before compiling, but that's not a very elegant solution.  What you need is a Makefile.dependencies file.  

In NEXTSTEP Release 2, this can be easily generated by typing

	make depend
 
in a shell, assuming your Makefile was generated by InterfaceBuilder. 

In NEXTSTEP Release 3.0, ProjectBuilder provides an "Args" textfield in the Builder inspector.  Just type

	depend

in a shell, to generate a Makefile.dependencies file. 

In NEXTSTEP Release 3.1, the user interface of ProjectBuilder has been further simplified.  You just select "depend" as your Target for the Build operation. 
 
Makefile.dependencies contains all the dependencies, listing the files included by your .m files.  A typical line of this file looks something like:

	MyClass.o : MyClass.m MyClass.h 

From then on, when you do a make in this directory, whether from InterfaceBuilder in NEXTSTEP Release 2,  or from ProjectBuilder in NEXTSTEP Release 3, or a shell, it checks this file before deciding the program is up to date.  Makefile.dependencies can also be edited by hand, if for any reason make depend doesn't do what you need.  If you add new files to your project, you should delete Makefile.dependencies and regenerate it before recompiling.  Note that ProjectBuilder in NEXTSTEP Release 3 is smart enough to not recompile your files in case only your interfaces file (.nib) has been modified.  It just copied the nib.

In answer to the second question, cc has a -M flag that can be useful if you want to see a listing of all the header files your source file depends on, including the AppKit and operating system files.  See also the man page.

QA638

Valid for 2.0, 3.0, 3.1