[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
different behavior on 3.82, 3.81, 3.80-and-older
From: |
Brandon Casey |
Subject: |
different behavior on 3.82, 3.81, 3.80-and-older |
Date: |
Tue, 06 Sep 2011 16:31:16 -0500 |
Hi,
The git project has a structure similar to the following in their
Makefile:
all::
SHELL_PATH = /bin/sh
SHELL = $(SHELL_PATH)
some_file: shell_compatibility_test FORCE
@echo making some_file
@$(SHELL) true
-include some_file
all:: shell_compatibility_test
@echo building all
please_set_SHELL_PATH_to_a_more_modern_shell:
@echo testing shell $(SHELL)
@$$(:)
shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
.PHONY: all
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
.PHONY: FORCE
The shell_compatibility_test and please_set_SHELL_PATH_to_a_more_modern_shell
targets are provided so that some basic capabilities of the shell can
be tested, and an informative message can be printed by make on
failure. In the above example, the only test case is for the $()
functionality. When a shell fails to execute $(:), then it is expected
that make will exit with a message similar to this:
make: *** [please_set_SHELL_PATH_to_a_more_modern_shell] Error 1
On modern linux systems, with modern shells, the test will always pass,
but for testing purposes, SHELL_PATH can be set to /bin/false like
make SHELL_PATH=/bin/false
This works as expected on make 3.80 (and seemingly older, though only
3.77 was tested).
With make 3.81, make prints:
make: Nothing to be done for `all'.
Since "all" is a PHONY target, its commands should always be executed
right? Perhaps make is remembering the previous failure of
shell_compatibility_test and ignoring the second all:: target?
On make 3.82, it prints:
make: *** No rule to make target
`please_set_SHELL_PATH_to_a_more_modern_shell', needed by
`shell_compatibility_test'. Stop.
?? The rule exists, but somehow marked as missing because of a prevous
failure via the some_file target?
If I remove the dependency on shell_compatibility_test from the
some_file target then 3.80 produces:
make: *** [some_file] Error 1
This is likely a bug that was fixed in the later versions. The
include statement for some_file is preceded by a '-', which makes make
ignore failure, which should be propagated to the some_file target,
but isn't.
3.81 correctly produces:
make: *** [please_set_SHELL_PATH_to_a_more_modern_shell] Error 1
and 3.82 too produces:
make: *** [please_set_SHELL_PATH_to_a_more_modern_shell] Error 1
Any idea what is going on here?
Thanks,
-Brandon
- different behavior on 3.82, 3.81, 3.80-and-older,
Brandon Casey <=