Re: [RFC 1/3] kbuild: add support for ensuring headers are self-contained

From: Sam Ravnborg
Date: Mon Jun 03 2019 - 13:37:30 EST

Hi Masahiro/Jani.

> Following the obj-y pattern,
> I want to make header-test-y relative to $(obj).

I also considered this and agree this is better.

Otherwise we end up with a spaghetti of dependencies across the tree.

What I made just fit the purpose I had that day,
which is no excuse for bad design.

> I prefer this:
> quiet_cmd_header_test = HDRTEST $@
> cmd_header_test = echo "\#include \"$*.h\"" > $@
> $(obj)/%.header_test.c:
> $(call cmd,header_test)

Even better - good.

We call it HDRTEST - so why not just go for that name:

hdrtest-y += headerfile.h


The current proposal with "header-test-y" hurts the eye a little with
two '-', and all other variables uses only one '-' as is today.
(generic-y, obj-y etc).

This is bikeshedding but is was itcing me a little.