[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#638411: debian-rules-missing-*-target fooled by variables



On 2011-08-19 18:29, Russ Allbery wrote:
> Damyan Ivanov <dmn@debian.org> writes:
> 
>> I get "certain" error/warnings about missing required/optional targets
>> in the following debian/rules:
> 
>>  -------------------------------------------------
>>  DEBIAN_TARGETS := clean binary binary-arch binary-indep build build-arch build-indep
> 
>>  .PHONY: $(DEBIAN_TARGETS)
> 
>>  $(DEBIAN_TARGETS):
>>  	dh $@ --parallel
>>  -------------------------------------------------
> 
>> I find it handy to use a variable here, so that I can heep the phony
>> target list the same as the universal rule at the bottom. And these
>> targets need to be phony in order to not interfere with existing
>> files/directories.
> 
> We probably are going to have to treat targets that are make variables as
> equivalent to % and assume the maintainer knows what they're doing.
> 

Hi,

I disagree that we should blindly assume that a "variable"-target as a
wildcard.  Consider Lintian's d/rules that has:

$(profiles): $(allchecks) private/generate-profiles.pl
        LINTIAN_ROOT='.' private/generate-profiles.pl

This is completely unrelated to build-arch and build-indep, but its
presence would (as I understand you) make Lintian assume that
build-(arch|indep) is now present.

The alternative is to track variables and understand make.  In theory
this very quickly becomes hard (to do right).  However, if we assume
that people, who would use variables this way, are a bit sane, we can
get away with a far simpler approach.
  Attached is a patch that does very simple (and in some cases even
incorrect[1]) tracking of variables and their values (ignoring tons of
rules).  I still suspect it will not cause a not of false-negatives and
should reduce the number of false-positives.



~Niels

[1] It ignores the significance of "+=" (vs ":=").  It expands
target-variables as it sees them (":=" vs. "=" vars).  It does not
expand variables in variables (i.e. "VAR := $(VAR1) $(VAR2)") etc.

Attachment: 0001-Added-simple-variable-tracker-in-checks-rules.patch
Description: application/wine-extension-patch


Reply to: