Using Sun WorkShop

Dependency Lists

When building targets concurrently, it is important that dependency lists be accurate. For example, if two executables use the same object file but only one specifies the dependency, then the build may cause errors when done concurrently. For example, consider the following makefile fragment:


all: prog1 prog2 
prog1: prog1.o aux.o 
	$(LINK.c) prog1.o aux.o -o prog1 
prog2: prog2.o 
	$(LINK.c) prog2.o aux.o -o prog2 

When built serially, the target aux.o is built as a dependent of prog1 and is up-to-date for the build of prog2. If built in parallel, the link of prog2 may begin before aux.o is built, and is therefore incorrect. The .KEEP_STATE feature of make detects some dependencies, but not the one shown above.