From: Jonathan Toppins on
gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2158#note_1180...
It won't work without the second colon either as make doesn't like rules that
rewrite previously defined rules. The issue is the upstream kernel Makefile is
included and the help target is being defined. The solution is to not define
the `help:` target when Makefile is included.
Another possible solution is to use submake for all targets, maybe something
like:
```
# if only upstream goals or empty in $(MAKECMDGOALS)
%:
$(MAKE) -f Makefile $(MAKECMDGOALS)
# else
help:
# do help goal
_OUTPUT := "."
# this section is needed in order to make O= to work
ifeq ("$(origin O)", "command line")
_OUTPUT := "$(abspath $(O))"
_EXTRA_ARGS := O=$(_OUTPUT)
endif
dist-%::
$(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
distg-%::
$(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
# endif
```
This obviously prevents someone from doing something like `make dist-brew
mrproper`, I don't know how many are doing that.
A longer term solution is to convince upstream to reserve the `dist%:` target
namespace and use an optional file `scripts/Makefile.dist` which would
implement the `dist%` targets. Then the standard upstream help and other
infrastructure could be directly extended to present more information if this
optional Makefile.dist file exists.