Lintian now has a warning for
build-indep targets. As a
dh user, I was surprised that some of my
dh-using packages had this problem. And when looking at the source, I remembered how I came to this: GNU make is stupid.
Considering the following excerpt of the GNU make manual:
.PHONY The prerequisites of the special target .PHONY are considered to be phony targets. When it is time to consider such a target, make will run its recipe unconditionally, regardless of whether a file with that name exists or what its last-modification time is.
And considering the following
.PHONY: build %: dh $@
What do you think happens when you run
debian/rules build in a directory containing a
build file or directory?
make: Nothing to be done for `build’.
However, an explicit rule, like the following, works:
.PHONY: build build: dh $@
It happens that many of the packages I maintain contain a
build subdirectory in their source. As such, to work around the aforementioned issue, I just declared the
dh rules explicitely, as in:
.PHONY: build binary binary-arch binary-indep (...) build binary binary-arch binary-indep (...): dh $@
And this obviously doesn’t scale for new rules such as
To be future-proof, I’ll use the following instead:
.PHONY: build build %: dh $@
I don’t know why I didn’t do that the first time…