Dynamic prerequisites

The special macros discussed in the previous section become useful only when used in the recipe part of a rule. Similar constructs exist that you can use in the prerequisite part of a rule, written as $$@, and $$*. You can use these constructs to create dynamic prerequisites.

When $$@ appears in the prerequisite list, it stands for the target name. If you are building a library, it stands for the name of the archive library. For example, the two following rules are equivalent:
file1 : $$@.c
file1 : file1.c
Similarly, the following rule uses the dynamic prerequisite symbol as well as one of the special runtime macros discussed in the previous section:
file1 file2 file3 : $$@.c
    $(CC) -c $(CFLAGS) $@.c

When $$* appears in the prerequisite list, it stands for the name of the target, but without the suffix.

See Modified expansions for examples that make use of the $$@ dynamic prerequisite. There are other dynamic prerequisite macros. For more information, see Dynamic prerequisites and make in z/OS UNIX System Services Command Reference.