Re: .SILENT: clobbered by .SILENT: with_target
On Wed, 2022-01-12 at 14:22 -0900, Britton Kerin wrote: > > You can see that this example mimics your .silent example. > > Your makefile provided a prerequisite to .SILENT. Make then knows > > that .SILENT has a prerequisite. > > I agree that it's consistent syntax, but semantically it's bad. The > expectation and the manual both imply that .SILENT: will have a > global effect, and a real union-of-effects would have .SILENT: > meaning everything and .SILENT: some_target redundant. The root of > the problem is that the rule syntax has been recycled for an > unrelated purpose, especially so for directives without > prerequisites. Another option you can consider is to add: MAKEFLAGS += --silent to enforce silent mode. This doesn't address the issue you raise but maybe it will help with the problem you're trying to solve.
Re: .SILENT: clobbered by .SILENT: with_target
On Wed, Jan 12, 2022 at 6:17 AM Dmitry Goncharov wrote: > > On Tue, Jan 11, 2022 at 3:50 PM Britton Kerin wrote: > > It looks like the .SILENT: with a recipe clobbers the .SILENT: > > without > > Consider the following > > hello.tsk: > hello.tsk: hello.h > hello.tsk: hello.o; $(CC) -o $@ $< > > > Here, hello.tsk is the default goal and it depends on hello.o and hello.h. > Multiple rules can provide different prerequisites to the same target. > The above is equivalent to > hello.tsk: hello.o hello.h > You can see that this example mimics your .silent example. > Your makefile provided a prerequisite to .SILENT. Make then knows that > .SILENT has a prerequisite. I agree that it's consistent syntax, but semantically it's bad. The expectation and the manual both imply that .SILENT: will have a global effect, and a real union-of-effects would have .SILENT: meaning everything and .SILENT: some_target redundant. The root of the problem is that the rule syntax has been recycled for an unrelated purpose, especially so for directives without prerequisites. Britton
Re: .SILENT: clobbered by .SILENT: with_target
On Tue, Jan 11, 2022 at 3:50 PM Britton Kerin wrote: > It looks like the .SILENT: with a recipe clobbers the .SILENT: > without Consider the following hello.tsk: hello.tsk: hello.h hello.tsk: hello.o; $(CC) -o $@ $< Here, hello.tsk is the default goal and it depends on hello.o and hello.h. Multiple rules can provide different prerequisites to the same target. The above is equivalent to hello.tsk: hello.o hello.h You can see that this example mimics your .silent example. Your makefile provided a prerequisite to .SILENT. Make then knows that .SILENT has a prerequisite. regards, Dmitry
.SILENT: clobbered by .SILENT: with_target
.SILENT: (without prerequisites) doesn't work as expected when .SILENT: some_target (with prerequisites) is present: $ cat Makefile .SILENT: .SILENT: target_a target_a: echo target_a_recipe target_b: echo target_b_recipe $ make target_b echo target_b_recipe target_b_recipe $ It looks like the .SILENT: with a recipe clobbers the .SILENT: without, which is at best undocumented spooky action-at-a-distance wrt target_b behavior. Reversing the order of the two .SILENT: declarations gives the same behavior. I think what should happen is the global .SILENT: (with no prerequisites) wins. Whether other .SILENT: with_targets in the same run should then result in an error or warning is debatable. I guess this could be a breaking change but the present behavior seems clearly buggy. Is there a strategy for incrementally changing this sort of thing? Britton