summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-06-04 10:59:52 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-06-04 11:04:09 +0200
commit7821efba175445d586149fef1f3d5fd12473ce8f (patch)
treeb58dccf092b1bc65affe019614f548bec9b5ac67
parentaeb987e17f089c3a10db96f4cf86000af99fcfde (diff)
Add syncconfig.py, used for incremental builds
This script calls through to Kconfiglib.sync_deps() and can be used to implement incremental builds. Having additional dependency mechanisms for changes to Kconfig files and environment variables is redundant, because those changes indirectly influence symbol values and will be caught as well.
-rwxr-xr-xsyncconfig.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/syncconfig.py b/syncconfig.py
new file mode 100755
index 0000000..7a97d01
--- /dev/null
+++ b/syncconfig.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+# This script can be used to implement incremental builds, where changing a
+# symbol will recompile just the source files that reference it.
+#
+# See the docstring for the Kconfig.sync_deps() function for more usage
+# information.
+#
+# Usage:
+#
+# (Automatically) run the following command before each build:
+#
+# $ syncconfig [<top Kconfig file>] <symbol file directory, passed to sync_deps()>
+#
+# This will indirectly catch any (relevant) changes to Kconfig files and
+# environment variables as well, so it's redundant to have separate
+# dependencies for those (except as a slight optimization).
+
+import sys
+
+import kconfiglib
+
+def main():
+ if not 2 <= len(sys.argv) <= 3:
+ sys.exit("usage: {} [Kconfig] <Symbol directory>".format(sys.argv[0]))
+
+ if len(sys.argv) == 2:
+ kconfig_filename = "Kconfig"
+ sym_dir = sys.argv[1]
+ else:
+ kconfig_filename = sys.argv[1]
+ sym_dir = sys.argv[2]
+
+ kconfiglib.Kconfig(kconfig_filename).sync_deps(sym_dir)
+
+if __name__ == "__main__":
+ main()