Programming Utilities Guide

Incompatibilities with Previous Versions

This section briefly discusses the following:

The -d Option

The -d option now reports the reason why a target is considered out of date.

Dynamic Macros

Although the dynamic macros $< and $* were documented as being assigned only for implicit rules and the .DEFAULT target, in some cases they actually were assigned for explicit target entries. The assignment action is now documented properly.

The actual value assigned to each of these macros is derived by the same procedure used within implicit rules (this rule has not changed). You can receive unexpected results when you use them in explicit target entries.

Even if you supply explicit dependencies, make does not use them to derive values for these macros. Instead, it searches for an appropriate implicit rule and dependency file. For instance, if you have the explicit target entry:

test: test.f 
        	@echo $< 

and the files: test.c and test.f, you might expect that $< would be assigned the value test.f. This is not the case. It is assigned test.c, because .c is ahead of .f in the suffixes list:

$ make test 
test.c 

For explicit entries, it is best to use a strictly deterministic method for deriving a dependency name using macro references and suffix replacements. For example, you could use $@.f instead of $< to derive the dependency name. To derive the base name of a .o target file, you could use the suffix replacement macro reference: $(@:.o=) instead of $*.

When hidden dependency checking is in effect, the $? dynamic macro value includes the names of hidden dependencies, such as header files. This can lead to failed compilations when using a target entry such as:

x: x.c 
        	$(LINK.c) -o $@ $?

and the file x.c #include's header files. The workaround is to replace `$?' with `$@.<'.

Tilde Rules

Tilde rules are not supported. This version of make does not support tilde suffix rules for version retrieval under SCCS. This might create problems when older makefiles redefine tilde rules to perform special steps when version retrieval under SCCS is required.

Target Names

Target names beginning with ./ are treated as local filenames.

When make encounters a target name beginning with `./', it strips those leading characters. For instance, the target named:

./filename

is interpreted as if it were written:

filename

This can result in endless loop conditions when used in a recursive target. To avoid this, rewrite the target relative to `..', the parent directory:

../dir/filename