linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: simplify the build rule of mach-types.h
@ 2021-05-28  3:49 Masahiro Yamada
  2021-05-31  8:59 ` David Laight
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2021-05-28  3:49 UTC (permalink / raw)
  To: patches
  Cc: linux-kernel, Masahiro Yamada, Linus Walleij, Russell King,
	linux-arm-kernel

The directory of mach-types.h is created a couple of lines above:

  _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \

The 'mkdir -p' command is redundant.

scripts/Kbuild.include defines real-prereqs as a shorthand for
$(filter-out $(PHONY),$^). Let's use it to simplify the code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/arm/tools/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index 87de1f63f649..057639019059 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -33,8 +33,7 @@ _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \
           $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
 
 quiet_cmd_gen_mach = GEN     $@
-      cmd_gen_mach = mkdir -p $(dir $@) && \
-		     $(AWK) -f $(filter-out $(PHONY),$^) > $@
+      cmd_gen_mach = $(AWK) -f $(real-prereqs) > $@
 
 $(kapi)/mach-types.h: $(src)/gen-mach-types $(src)/mach-types FORCE
 	$(call if_changed,gen_mach)
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] ARM: simplify the build rule of mach-types.h
  2021-05-28  3:49 [PATCH] ARM: simplify the build rule of mach-types.h Masahiro Yamada
@ 2021-05-31  8:59 ` David Laight
  0 siblings, 0 replies; 5+ messages in thread
From: David Laight @ 2021-05-31  8:59 UTC (permalink / raw)
  To: 'Masahiro Yamada', patches
  Cc: linux-kernel, Linus Walleij, Russell King, linux-arm-kernel

From: Masahiro Yamada
> Sent: 28 May 2021 04:49
> 
> The directory of mach-types.h is created a couple of lines above:
> 
>   _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \
> 
> The 'mkdir -p' command is redundant.
(In the rule itself)
...
>  quiet_cmd_gen_mach = GEN     $@
> -      cmd_gen_mach = mkdir -p $(dir $@) && \
> -		     $(AWK) -f $(filter-out $(PHONY),$^) > $@
> +      cmd_gen_mach = $(AWK) -f $(real-prereqs) > $@

There is a much easier way to get directories created.
gmake lets you define dependencies that only need to exist
(ie there file timestamps are't checked)
These are ideal for creating directories.

So if can define:

%/.:
	mkdir -p $@

You can just use

$(OBJ)/$(FILE): | ${OBJ)/.

to get any directories created.

Annoyingly gmake doesn't seem to support the 'dynamic dependencies'
of SYSV make (it's only useful feature).
So you can't use:
xxxxx: | $$@D/.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: simplify the build rule of mach-types.h
  2021-05-28  8:23 ` Linus Walleij
@ 2021-05-28  9:15   ` Masahiro Yamada
  0 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2021-05-28  9:15 UTC (permalink / raw)
  To: Linus Walleij; +Cc: patches, linux-kernel, Russell King, Linux ARM

On Fri, May 28, 2021 at 5:24 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Fri, May 28, 2021 at 5:52 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> > The directory of mach-types.h is created a couple of lines above:
> >
> >   _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \
> >
> > The 'mkdir -p' command is redundant.
> >
> > scripts/Kbuild.include defines real-prereqs as a shorthand for
> > $(filter-out $(PHONY),$^). Let's use it to simplify the code.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Can you put this into Russell's patch tracker or shall I sign
> it off and put it there?


I sent this to patches@arm.linux.org.uk

It is already there.
https://www.arm.linux.org.uk/developer/patches/section.php?section=0



-- 
Best Regards
Masahiro Yamada

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: simplify the build rule of mach-types.h
  2021-05-28  3:52 Masahiro Yamada
@ 2021-05-28  8:23 ` Linus Walleij
  2021-05-28  9:15   ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2021-05-28  8:23 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: patches, linux-kernel, Russell King, Linux ARM

On Fri, May 28, 2021 at 5:52 AM Masahiro Yamada <masahiroy@kernel.org> wrote:

> The directory of mach-types.h is created a couple of lines above:
>
>   _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \
>
> The 'mkdir -p' command is redundant.
>
> scripts/Kbuild.include defines real-prereqs as a shorthand for
> $(filter-out $(PHONY),$^). Let's use it to simplify the code.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Can you put this into Russell's patch tracker or shall I sign
it off and put it there?

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: simplify the build rule of mach-types.h
@ 2021-05-28  3:52 Masahiro Yamada
  2021-05-28  8:23 ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2021-05-28  3:52 UTC (permalink / raw)
  To: patches
  Cc: linux-kernel, Masahiro Yamada, Linus Walleij, Russell King,
	linux-arm-kernel

The directory of mach-types.h is created a couple of lines above:

  _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \

The 'mkdir -p' command is redundant.

scripts/Kbuild.include defines real-prereqs as a shorthand for
$(filter-out $(PHONY),$^). Let's use it to simplify the code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

KernelVersion: v5.13-rc1

 arch/arm/tools/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index 87de1f63f649..057639019059 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -33,8 +33,7 @@ _dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') \
           $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
 
 quiet_cmd_gen_mach = GEN     $@
-      cmd_gen_mach = mkdir -p $(dir $@) && \
-		     $(AWK) -f $(filter-out $(PHONY),$^) > $@
+      cmd_gen_mach = $(AWK) -f $(real-prereqs) > $@
 
 $(kapi)/mach-types.h: $(src)/gen-mach-types $(src)/mach-types FORCE
 	$(call if_changed,gen_mach)
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-31  9:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28  3:49 [PATCH] ARM: simplify the build rule of mach-types.h Masahiro Yamada
2021-05-31  8:59 ` David Laight
2021-05-28  3:52 Masahiro Yamada
2021-05-28  8:23 ` Linus Walleij
2021-05-28  9:15   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).