summaryrefslogtreecommitdiff
path: root/makefile.patch
blob: 5b55c79c5844d0af4b92812f44ed1211f0d3e2aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 10fe390db4051fea50e017f0fd5d284bc3c03182 Mon Sep 17 00:00:00 2001
From: Ulf Magnusson <ulfalizer@gmail.com>
Date: Tue, 18 Jun 2013 19:49:35 +0200
Subject: [PATCH] Kconfiglib scripts/kconfig/Makefile patch.

---
 scripts/kconfig/Makefile | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 3091794..cd2d18f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -11,6 +11,41 @@ else
 Kconfig := Kconfig
 endif
 
+PHONY += scriptconfig iscriptconfig kconfiglibtestconfig
+
+ifneq ($(filter scriptconfig iscriptconfig,$(MAKECMDGOALS)),)
+PYTHONCMD ?= python
+endif
+
+ifneq ($(filter scriptconfig,$(MAKECMDGOALS)),)
+ifndef SCRIPT
+$(error Use "make scriptconfig SCRIPT=<path to script> [SCRIPT_ARG=<argument>]")
+endif
+endif
+
+scriptconfig:
+ifdef SCRIPT_ARG
+	$(Q)PYTHONPATH="$(srctree)/Kconfiglib:$$PYTHONPATH" \
+	  "$(PYTHONCMD)" "$(SCRIPT)" "$(srctree)/$(Kconfig)" "$(SCRIPT_ARG)"
+else
+	$(Q)PYTHONPATH="$(srctree)/Kconfiglib:$$PYTHONPATH" \
+	  "$(PYTHONCMD)" "$(SCRIPT)" "$(srctree)/$(Kconfig)"
+endif
+
+iscriptconfig:
+	$(Q)PYTHONPATH="$(srctree)/Kconfiglib:$$PYTHONPATH" "$(PYTHONCMD)" -i -c \
+	  "import kconfiglib; \
+	   import sys; \
+	   c = kconfiglib.Config(sys.argv[4 if \"$(PYTHONCMD)\".startswith(\"ipython\") else 1]); \
+	   print \"A Config instance 'c' for the architecture ({0}) has been created.\".format(c.get_arch())" \
+	  $(srctree)/$(Kconfig)
+
+# Used by testsuite.py to be able to compare output for nonsensical
+# arch/defconfig combinations, which has proven effective for finding obscure
+# bugs
+kconfiglibtestconfig: $(obj)/conf
+	$(Q)$< --defconfig=.config $(srctree)/$(Kconfig)
+
 xconfig: $(obj)/qconf
 	$< $(Kconfig)
 
-- 
1.8.1.2