public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Lacombe <lacombar@gmail.com>
To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michal Marek <mmarek@suse.cz>
Cc: Arnaud Lacombe <lacombar@gmail.com>
Subject: [RFC 3/7] kconfig/check.sh: prepare for generic check
Date: Fri,  1 Jul 2011 21:47:35 -0400	[thread overview]
Message-ID: <1309571259-15241-4-git-send-email-lacombar@gmail.com> (raw)
In-Reply-To: <1309571259-15241-1-git-send-email-lacombar@gmail.com>

`scripts/kconfig/check.sh' currently checks for libintl availability, make this
explicit. Result gets stored in a ${obj}/.tmp_check Makefile sourced by
the main Makefile dynamically.
---
 scripts/kconfig/Makefile |   22 ++++++++++++++++++----
 scripts/kconfig/check.sh |   44 ++++++++++++++++++++++++++++++++++----------
 2 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 8abde17..a9344d2 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -173,8 +173,12 @@ qconf-cxxobjs	:= qconf.o
 qconf-objs	:= zconf.tab.o
 gconf-objs	:= gconf.o zconf.tab.o
 
+frontends-objs := $(conf-objs) $(mconf-objs) $(nconf-objs)
+
 hostprogs-y :=
 
+KC_CHECK := gettext
+
 ifeq ($(MAKECMDGOALS),nconfig)
 	hostprogs-y += nconf
 endif
@@ -205,7 +209,7 @@ endif
 
 hostprogs-y += conf
 
-clean-files	:= qconf.moc .tmp_qtcheck .tmp_gtkcheck
+clean-files	:= qconf.moc .tmp_qtcheck .tmp_gtkcheck .tmp_check
 clean-files	+= zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
 clean-files     += mconf qconf gconf nconf
 clean-files     += config.pot linux.pot
@@ -218,9 +222,6 @@ $(obj)/dochecklxdialog:
 
 always := dochecklxdialog
 
-# Add environment specific flags
-HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
-
 # generated files seem to need this to find local include files
 HOSTCFLAGS_lex.zconf.o	:= -I$(src)
 HOSTCFLAGS_zconf.tab.o	:= -I$(src)
@@ -316,8 +317,21 @@ $(obj)/.tmp_gtkcheck:
 		echo "*"; 								\
 		false;									\
 	fi
+
+need-check := $(addprefix $(obj)/,$(frontends-objs))
+
+$(need-check): $(obj)/.tmp_check
+
+-include $(obj)/.tmp_check
+
+KC_CHECKED := $(foreach check,$(KC_CHECK),$(if $(KCONFIG_CHECKED_$(check)),$(check),))
+ifneq ($(KC_CHECK),$(KC_CHECKED))
+$(obj)/.tmp_check: FORCE
 endif
 
+$(obj)/.tmp_check: $(src)/Makefile
+	$(Q)$(srctree)/$(src)/check.sh $(KC_CHECK)
+
 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
 
 $(obj)/qconf.o: $(obj)/qconf.moc
diff --git a/scripts/kconfig/check.sh b/scripts/kconfig/check.sh
index fa59cbf..fcb999e 100755
--- a/scripts/kconfig/check.sh
+++ b/scripts/kconfig/check.sh
@@ -1,14 +1,38 @@
 #!/bin/sh
-# Needed for systems without gettext
-$* -xc -o /dev/null - > /dev/null 2>&1 << EOF
-#include <libintl.h>
-int main()
+#
+
+set -e
+
+check_gettext()
 {
-	gettext("");
-	return 0;
+
+	echo '
+	#include <libintl.h>
+	int main()
+	{
+		gettext("");
+		return 0;
+	}' | \
+	{
+		$* -xc -o /dev/null - > /dev/null 2>&1 || \
+			echo HOST_EXTRACFLAGS	+= -DKBUILD_NO_NLS >> ${obj}/.tmp_check
+	}
 }
-EOF
-if [ ! "$?" -eq "0"  ]; then
-	echo -DKBUILD_NO_NLS;
-fi
 
+rm -f ${obj}/.tmp_check
+
+for arg in $*; do
+	case $arg in
+	gettext)	;;
+	*)
+		echo "  *"
+		echo "  * Do not know how to check for \`$arg'"
+		echo "  *"
+		false
+		;;
+	esac
+	echo "  CHECK   $arg"
+
+	check_$arg
+	echo "KCONFIG_CHECKED_$arg := 1"	>> ${obj}/.tmp_check
+done
-- 
1.7.3.4.574.g608b.dirty


  parent reply	other threads:[~2011-07-02  1:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 19:16 [RFC] Kconfig library check merge Arnaud Lacombe
2011-07-01 14:11 ` Michal Marek
2011-07-02  0:33   ` Arnaud Lacombe
2011-07-02  1:47 ` [RFC 0/7] " Arnaud Lacombe
2011-07-02  1:47   ` [RFC 1/7] kconfig/Makefile: add pretty printer for moc(1) Arnaud Lacombe
2011-07-02  1:47   ` [RFC 2/7] kconfig/Makefile: ensure `conf' appears last in `hostprogs-y' Arnaud Lacombe
2011-07-02  1:47   ` Arnaud Lacombe [this message]
2011-07-05 22:37     ` [RFC 3/7] kconfig/check.sh: prepare for generic check Valdis.Kletnieks
2011-07-05 22:48       ` Arnaud Lacombe
2011-07-02  1:47   ` [RFC 4/7] kconfig: move QT checks to `scripts/kconfig/check.sh' Arnaud Lacombe
2011-07-02  1:47   ` [RFC 5/7] kconfig: move GTK " Arnaud Lacombe
2011-07-02  1:47   ` [RFC 6/7] kconfig: move ncurses " Arnaud Lacombe
2011-07-02  1:47   ` [RFC 7/7] kconfig: add stub for nconf checks Arnaud Lacombe
2011-07-18 19:03   ` [RFC 0/7] Kconfig library check merge Arnaud Lacombe
2011-07-19 13:06     ` Michal Marek
2011-08-16  5:29       ` Arnaud Lacombe
2011-08-19 14:02         ` Michal Marek

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=1309571259-15241-4-git-send-email-lacombar@gmail.com \
    --to=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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