".MAKE" appears in gnu Makefile for a number of packages which use AutoMake, but appears to be undocumented as a "special" target in the online manual. Anyone know what it does?
2 Answers
This target doesn't do anything by itself. It has no special meaning to a make
I know.
However, it is automatically generated when a project uses GNU Automake.
Automake creates the Makefile.in
files, which ./configure
will use to generate Makefile
s.
It isn't listed among the targets in the documentation: only developers will need it, as its definition in a generated Makefile.in
shows:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check-am \
ctags-recursive install-am install-strip tags-recursive
The two variables are defined elsewhere in Makefile.in
, and it appears that this target will attempt to do a full runthrough of everything that can be done at all: cleaning up the source tree, compiling the software, running automatic tests, installing it, uninstalling it, and a few steps that are only useful for developers. So this is basically a one-shot test run that might for instance be used during continuous build tests.
This is a clear example of why automake
was created: a much-desired feature is missing from make
(namely the ability to tell it to "do everything"), so automake
provides it.

- 1
- 1

- 8,425
- 1
- 38
- 70
-
Thanks - perhaps I should be more explicit - in packages which use AutoMake tools (./configure, Makefile.in, etc.), it seems to show up regularly, next to .PHONY target (which is documented). To pick a specific example, see wireshark-1.10.6 Makefile. I have seen it in more than one open source project which relies on automatic configuration and AutoMake. – Kevin May 20 '14 at 18:17
-
Aha! I just confirmed this by grepping for .MAKE in the GNU make 4.0 source code. It only ever occurs in files generated by the `automake` command (`Makefile.in`) and files subsequently generated from those (`Makefile`). Fixing my answer ... – reinierpost May 21 '14 at 08:16
The chosen answer is inaccurate. The .MAKE target is not meant to be executed by anyone. It doesn't mean anything special to GNU make, however the make in, for example, FreeBSD, understands the prerequisites of .MAKE to be recursive make invocations. In particular, the recipes associated with them will be executed even when doing make -n (dry-run invocation) so that you can see what commands would be executed by the recursive makes. GNU make detects recursive make recipes by the presence of a reference to $(MAKE), or by the '+' token. So it's inserted by automake for compatibility purposes.

- 21
- 1