Sun WorkShop TeamWare 2.1 User's Guide

Concurrent File Modification

You must make sure that targets built concurrently do not attempt to modify the same files at the same time. This can happen in a variety of ways. If a new suffix rule is defined that must use a temporary file, the temporary file name must be different for each target. You can accomplish this by using the dynamic macros $@ or $*. For example, a .c.o rule that performs some modification of the .c file before compiling it might be defined as:


.c.o:
	awk -f modify.awk $*.c > $*.mod.c 
	$(COMPILE.c) $*.mod.c -o $*.o 
	$(RM) $*.mod.c