linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Masahiro Yamada' <masahiroy@kernel.org>,
	"patches@arm.linux.org.uk" <patches@arm.linux.org.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	Russell King <linux@armlinux.org.uk>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH] ARM: simplify the build rule of mach-types.h
Date: Mon, 31 May 2021 08:59:52 +0000	[thread overview]
Message-ID: <60fb7c6374e74b6d9e7597b19772209a@AcuMS.aculab.com> (raw)
In-Reply-To: <20210528034913.2157657-1-masahiroy@kernel.org>

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

  reply	other threads:[~2021-05-31  9:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  3:49 [PATCH] ARM: simplify the build rule of mach-types.h Masahiro Yamada
2021-05-31  8:59 ` David Laight [this message]
2021-05-28  3:52 Masahiro Yamada
2021-05-28  8:23 ` Linus Walleij
2021-05-28  9:15   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60fb7c6374e74b6d9e7597b19772209a@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=masahiroy@kernel.org \
    --cc=patches@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).