Subject: bug#79049: ChangeLog is added to distribution even when inside a false conditional

From: Tomas Volf <[email-masked]>
Date: Sat, 26 Jul 2025 15:45:55 +0200

Karl Berry <[email-masked]> writes:

>     if DISTRIBUTE_CHANGELOG
>     ChangeLog:
>             echo nop
>     endif
>
> I haven't had a chance to test this, but how about making the conditional
> merely define a variable, and a fallback ChangeLog rule, as in:
>
> if DISTRIBUTE_CHANGELOG
> ChangeLog_target = ChangeLog
> else
> ChangeLog_target = no_ChangeLog
> ChangeLog:
> endif
> $(ChangeLog_target):
> 	make changelog
>
> I admit I still haven't got my mind wrapped very firmly around this
> scenario :), so I might be way off. Just a thought. --best, karl.

That is brilliant!  I needed to add the ChangeLog into EXTRA_DIST
manually, but on the other hand, there does not seem to be any need for
the targets to differ.  The following seems -- as verified by some
casual testing -- to do what I want:

--8<---------------cut here---------------start------------->8---
if DISTRIBUTE_CHANGELOG
EXTRA_DIST += ChangeLog
endif
ChangeLog = ChangeLog
$(ChangeLog):
	[... bunch of git log mangling ...]
--8<---------------cut here---------------end--------------->8---

Thanks a lot, this is quite clever way to side-step the issue. ^_^

Should I attempt to write a patch documenting this workaround or is this
too niche of a problem?

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.