mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/4] build: fix that passwd.h is always built
Date: Tue, 26 Dec 2017 19:36:00 +0100	[thread overview]
Message-ID: <20171226183600.GB28706@ravnborg.org> (raw)
In-Reply-To: <20171226183236.GA26708@ravnborg.org>

From 48fe20e2bf2249b2f89d96c9787e0b489c015054 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 26 Dec 2017 18:02:17 +0100
Subject: [PATCH 2/4] build: fix that passwd.h is always built

Use the kbuild provided support for generated
files to avoid that passwd.h is always generated
thus triggering further re-builds

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 common/Makefile | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index 8cd0ab300..5351ef0f7 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -63,27 +63,29 @@ obj-$(CONFIG_BAREBOX_UPDATE_IMX_NAND_FCB) += imx-bbu-nand-fcb.o
 obj-$(CONFIG_CONSOLE_RATP)	+= ratp.o
 obj-$(CONFIG_BOOT)		+= boot.o
 
-quiet_cmd_pwd_h = PWDH    $@
 ifdef CONFIG_PASSWORD
-ifneq ($(CONFIG_PASSWORD_DEFAULT),"")
-PASSWD_FILE := $(shell cd $(srctree); find $(CONFIG_PASSWORD_DEFAULT) -type f)
-cmd_pwd_h = echo -n "static const char default_passwd[] = \"" > $@; \
-	cat $< | tr -d '\n' >> $@; \
-	echo "\";" >> $@
 
-include/generated/passwd.h: $(PASSWD_FILE)
-	$(call if_changed,pwd_h)
+ifeq ($(CONFIG_PASSWORD_DEFAULT),"")
+define filechk_passwd
+	echo "static const char default_passwd[] = \"\";"
+endef
 else
-cmd_pwd_h = echo "static const char default_passwd[] = \"\";" > $@
-
-include/generated/passwd.h: FORCE
-	$(call if_changed,pwd_h)
+define filechk_passwd
+(							\
+echo -n "static const char default_passwd[] = \"";	\
+cat $(shell find $(srctree) -name $(CONFIG_PASSWORD_DEFAULT) -type f) | tr -d '\n';\
+echo "\";"						\
+)
+endef
 endif
 
+include/generated/passwd.h: $(srctree)/$(src)/Makefile FORCE
+	$(call filechk,passwd)
+
 targets += include/generated/passwd.h
 
 $(obj)/password.o: include/generated/passwd.h
-endif
+endif # CONFIG_PASSWORD
 
 # dependencies on generated files need to be listed explicitly
 $(obj)/version.o: include/generated/compile.h
-- 
2.12.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-12-26 18:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-26 18:32 [PATCH 0/4] build: minimize rebuilds Sam Ravnborg
2017-12-26 18:35 ` [PATCH 1/4] build: fix that defaultenv is always rebuilt Sam Ravnborg
2017-12-26 18:36 ` Sam Ravnborg [this message]
2017-12-26 18:36 ` [PATCH 3/4] build: fix that the bbenv file " Sam Ravnborg
2017-12-26 18:36 ` [PATCH 4/4] build: fix that LZO " Sam Ravnborg
2018-01-05 10:49   ` Sascha Hauer
2018-01-05 14:57     ` Sascha Hauer
2018-01-06  7:34       ` Sam Ravnborg

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=20171226183600.GB28706@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=barebox@lists.infradead.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