A dynamic dependency parameter has meaning only on the dependency line in a makefile. The $$@ refers to the current ``thing'' to the left of the : symbol (which is $@). Also the form $$(@F) exists, which allows access to the file part of $@. Thus, in the following:
cat: $$@.cthe dependency is translated at execution time to the string cat.c. This is useful for building a large number of executable files, each of which has only one source file. For instance, the UNIX system software command directory could have a makefile like:
CMDS = cat dd echo date cmp comm chownObviously, this is a subset of all the single file programs. For multiple file programs, a directory is usually allocated and a separate makefile is made. For any particular file that has a peculiar compilation procedure, a specific entry must be made in the makefile.
$(CMDS): $$@.c $(CC) $(CFLAGS) $? -o $@
The second useful form of the dependency parameter is $$(@F).
It represents the file name part of $$@.
Again, it is evaluated at execution time.
becomes evident when trying to maintain the /usr/include
makefile in the /usr/src/head directory. Thus, the /usr/src/head/makefile would look like
INCDIR = /usr/includeThis would completely maintain the /usr/include directory whenever one of the above files in /usr/src/head was updated.
INCLUDES = \ $(INCDIR)/stdio.h \ $(INCDIR)/pwd.h \ $(INCDIR)/dir.h \ $(INCDIR)/a.out.h
$(INCLUDES): $$(@F) cp $? $@ chmod 0444 $@