linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Le Cuirot <chewi@gentoo.org>
To: linux-media@vger.kernel.org
Cc: James Le Cuirot <chewi@gentoo.org>
Subject: [PATCH] [dtv-scan-tables] Improve Makefile to avoid "Argument list too long" error
Date: Sat, 13 Jul 2019 16:40:49 +0100	[thread overview]
Message-ID: <20190713154048.21291-1-chewi@gentoo.org> (raw)

I wouldn't expect a foreach loop to be prone to this issue but it's
not the right way to write a Makefile anyway.

Note that conversion failures are now fatal and the dvb-t/ke-Nairobi
file is failing to convert at the moment.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 Makefile | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 901dc9d..7cdb5bc 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,8 @@ DVBV3DIRS = atsc dvb-c dvb-s dvb-t
 DVBV5DIRS = $(DVBV3DIRS) isdb-t
 
 DVBV3CHANNELFILES = $(foreach dir,$(DVBV3DIRS),$(wildcard $(dir)/*))
+DVBV3OUTPUTFILES = $(patsubst %,$(DVBV3OUTPUTDIR)/%,$(DVBV3CHANNELFILES))
+DVBV5OUTPUTFILES = $(patsubst %,$(DVBV5OUTPUTDIR)/%,$(DVBV3CHANNELFILES))
 
 DVBFORMATCONVERT_CHANNEL_DVBV5 = -ICHANNEL -ODVBV5
 DVBFORMATCONVERT_CHANNEL_DVBV3 = -IDVBV5 -OCHANNEL
@@ -42,14 +44,16 @@ ifeq ($(DVBV3DIR),)
 DVBV3DIR = dvbv3
 endif
 
-dvbv3:
-	@$(foreach var,$(DVBV3DIRS), $(MKDIR) $(DVBV3OUTPUTDIR)/$(var);)
-	@$(foreach var,$(DVBV3CHANNELFILES), $(DVBFORMATCONVERT) $(DVBFORMATCONVERT_CHANNEL_DVBV3) $(var) $(DVBV3OUTPUTDIR)/$(var);)
+$(DVBV3OUTPUTFILES): $(DVBV3OUTPUTDIR)/%: %
+	@$(MKDIR) "$(dir $@)"
+	@$(DVBFORMATCONVERT) $(DVBFORMATCONVERT_CHANNEL_DVBV3) "$<" "$@"
 
+$(DVBV5OUTPUTFILES): $(DVBV5OUTPUTDIR)/%: $(DVBV3OUTPUTDIR)/%
+	@$(MKDIR) "$(dir $@)"
+	@$(DVBFORMATCONVERT) $(DVBFORMATCONVERT_CHANNEL_DVBV5) "$<" "$@"
 
-dvbv5: $(DVBV3OUTPUTDIR)
-	@$(foreach var,$(DVBV3DIRS), $(MKDIR) $(DVBV5OUTPUTDIR)/$(var);)
-	@$(foreach var,$(DVBV3CHANNELFILES), $(DVBFORMATCONVERT) $(DVBFORMATCONVERT_CHANNEL_DVBV5) $(DVBV3OUTPUTDIR)/$(var) $(DVBV5OUTPUTDIR)/$(var);)
+dvbv3: $(DVBV3OUTPUTFILES)
+dvbv5: $(DVBV5OUTPUTFILES)
 
 install:
 	@mkdir -p $(DATADIR)/$(DVBV5DIR)
-- 
2.21.0


                 reply	other threads:[~2019-07-13 15:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190713154048.21291-1-chewi@gentoo.org \
    --to=chewi@gentoo.org \
    --cc=linux-media@vger.kernel.org \
    /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).