diff mbox series

[v1,1/2] makefile: add support for *_defconfig targets

Message ID 20190514184552.25100-1-volodymyr_babchuk@epam.com (mailing list archive)
State Superseded
Headers show
Series [v1,1/2] makefile: add support for *_defconfig targets | expand

Commit Message

Volodymyr Babchuk May 14, 2019, 6:45 p.m. UTC
Ease up XEN configuration for non-standard builds, like
armv8 tiny config.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 Makefile     | 4 ++++
 xen/Makefile | 3 +++
 2 files changed, 7 insertions(+)

Comments

Jan Beulich May 15, 2019, 7:24 a.m. UTC | #1
>>> On 14.05.19 at 20:45, <Volodymyr_Babchuk@epam.com> wrote:
> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -269,6 +269,9 @@ kconfig := silentoldconfig oldconfig config menuconfig defconfig \
>  $(kconfig):
>  	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@

So the rule you add matches this one. Is there a reason ...

> +%_defconfig:

... why you can't simply add this to the kconfig variable set a few
lines up? Oh - newer make doesn't like mixing pattern and
non-pattern rules. Perhaps worth a brief comment, to justify the
redundancy? Or alternatively, how about using $(wildcard )
instead of a pattern rule, thus rejecting invalid targets right away,
rather than deferring to the recursive make to notice the error?

Jan
Volodymyr Babchuk May 15, 2019, 7:07 p.m. UTC | #2
Hello Jan,

Jan Beulich writes:

>>>> On 14.05.19 at 20:45, <Volodymyr_Babchuk@epam.com> wrote:
>> --- a/xen/Makefile
>> +++ b/xen/Makefile
>> @@ -269,6 +269,9 @@ kconfig := silentoldconfig oldconfig config menuconfig defconfig \
>>  $(kconfig):
>>  	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@
>
> So the rule you add matches this one. Is there a reason ...
>
>> +%_defconfig:
>
> ... why you can't simply add this to the kconfig variable set a few
> lines up? Oh - newer make doesn't like mixing pattern and
> non-pattern rules.
Yes, my first intention was to add this rule to the kconfig variable.
Sadly make does not allows this

> Perhaps worth a brief comment, to justify the
> redundancy?
Sure, will add in the next version.

> Or alternatively, how about using $(wildcard )
> instead of a pattern rule, thus rejecting invalid targets right away,
> rather than deferring to the recursive make to notice the error?
I considered this, but I can't see how $(wildcard ) can be used.
AFAIK, $(wildcard ) expects to find a file, matching the wildcard.
But %_defconfig is the phony rule, so I can't imagine how to use
$(wildcard ) in this case.

On other hand, following rule checks the presence of required _defconfig file:

%_defconfig: arch/$(SRCARCH)/configs/%_defconfig

So, I can do in this way if you wish.

BTW, I'll add .PHONY: %_defconfig in the next version.

--
Best regards, Volodymyr Babchuk
Jan Beulich May 16, 2019, 7:21 a.m. UTC | #3
>>> On 15.05.19 at 21:07, <Volodymyr_Babchuk@epam.com> wrote:

> Hello Jan,
> 
> Jan Beulich writes:
> 
>>>>> On 14.05.19 at 20:45, <Volodymyr_Babchuk@epam.com> wrote:
>>> --- a/xen/Makefile
>>> +++ b/xen/Makefile
>>> @@ -269,6 +269,9 @@ kconfig := silentoldconfig oldconfig config menuconfig 
> defconfig \
>>>  $(kconfig):
>>>  	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) 
> SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@
>>
>> So the rule you add matches this one. Is there a reason ...
>>
>>> +%_defconfig:
>>
>> ... why you can't simply add this to the kconfig variable set a few
>> lines up? Oh - newer make doesn't like mixing pattern and
>> non-pattern rules.
> Yes, my first intention was to add this rule to the kconfig variable.
> Sadly make does not allows this
> 
>> Perhaps worth a brief comment, to justify the
>> redundancy?
> Sure, will add in the next version.
> 
>> Or alternatively, how about using $(wildcard )
>> instead of a pattern rule, thus rejecting invalid targets right away,
>> rather than deferring to the recursive make to notice the error?
> I considered this, but I can't see how $(wildcard ) can be used.
> AFAIK, $(wildcard ) expects to find a file, matching the wildcard.
> But %_defconfig is the phony rule, so I can't imagine how to use
> $(wildcard ) in this case.
> 
> On other hand, following rule checks the presence of required _defconfig 
> file:
> 
> %_defconfig: arch/$(SRCARCH)/configs/%_defconfig

And similarly I'd expect $(wildcard arch/$(SRCARCH)/configs/*_defconfig)
to work as suggested (wrapped in $(notdir ...) to strip the path).

Jan
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 829ac63741..ef1ea44ef1 100644
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,10 @@  build: $(TARGS_BUILD)
 build-xen:
 	$(MAKE) -C xen build
 
+.PHONY: %_defconfig
+%_defconfig:
+	$(MAKE) -C xen $@
+
 .PHONY: build-tools
 build-tools: build-tools-public-headers
 	$(MAKE) -C tools build
diff --git a/xen/Makefile b/xen/Makefile
index 1fd8ad5116..3c7e423132 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -269,6 +269,9 @@  kconfig := silentoldconfig oldconfig config menuconfig defconfig \
 $(kconfig):
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@
 
+%_defconfig:
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@
+
 include/config/%.conf: include/config/auto.conf.cmd $(KCONFIG_CONFIG)
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" silentoldconfig