aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-07-20 03:46:26 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-07-25 10:25:28 -0400
commita2ff4040151ace5be20e4de34220468b9e842e4d (patch)
tree16b254a3361baa567921950e51810018a91b0ac5 /scripts/kconfig
parent08b220b37ffe9ae8f2f0fe4618d03f7c25805fb3 (diff)
kconfig: rename file_write_dep and move it to confdata.c
file_write_dep() is called only from conf_write_autoconf(). Move it from util.c to confdata.c to make it static. Also, rename it to conf_write_dep() since it should belong to the group of conf_write* functions. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/confdata.c31
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/util.c30
3 files changed, 30 insertions, 32 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 629ad32d4708..c553f1f30c36 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -818,6 +818,35 @@ next:
818 return 0; 818 return 0;
819} 819}
820 820
821/* write a dependency file as used by kbuild to track dependencies */
822static int conf_write_dep(const char *name)
823{
824 struct file *file;
825 FILE *out;
826
827 if (!name)
828 name = ".kconfig.d";
829 out = fopen("..config.tmp", "w");
830 if (!out)
831 return 1;
832 fprintf(out, "deps_config := \\\n");
833 for (file = file_list; file; file = file->next) {
834 if (file->next)
835 fprintf(out, "\t%s \\\n", file->name);
836 else
837 fprintf(out, "\t%s\n", file->name);
838 }
839 fprintf(out, "\n%s: \\\n"
840 "\t$(deps_config)\n\n", conf_get_autoconfig_name());
841
842 env_write_dep(out, conf_get_autoconfig_name());
843
844 fprintf(out, "\n$(deps_config): ;\n");
845 fclose(out);
846 rename("..config.tmp", name);
847 return 0;
848}
849
821static int conf_split_config(void) 850static int conf_split_config(void)
822{ 851{
823 const char *name; 852 const char *name;
@@ -940,7 +969,7 @@ int conf_write_autoconf(void)
940 969
941 sym_clear_all_valid(); 970 sym_clear_all_valid();
942 971
943 file_write_dep("include/config/auto.conf.cmd"); 972 conf_write_dep("include/config/auto.conf.cmd");
944 973
945 if (conf_split_config()) 974 if (conf_split_config())
946 return 1; 975 return 1;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index ed3ff88e60ba..6b7bbc6238e3 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -97,7 +97,6 @@ void menu_set_type(int type);
97 97
98/* util.c */ 98/* util.c */
99struct file *file_lookup(const char *name); 99struct file *file_lookup(const char *name);
100int file_write_dep(const char *name);
101void *xmalloc(size_t size); 100void *xmalloc(size_t size);
102void *xcalloc(size_t nmemb, size_t size); 101void *xcalloc(size_t nmemb, size_t size);
103void *xrealloc(void *p, size_t size); 102void *xrealloc(void *p, size_t size);
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index a365594770d9..d999683bb2a7 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -29,36 +29,6 @@ struct file *file_lookup(const char *name)
29 return file; 29 return file;
30} 30}
31 31
32/* write a dependency file as used by kbuild to track dependencies */
33int file_write_dep(const char *name)
34{
35 struct file *file;
36 FILE *out;
37
38 if (!name)
39 name = ".kconfig.d";
40 out = fopen("..config.tmp", "w");
41 if (!out)
42 return 1;
43 fprintf(out, "deps_config := \\\n");
44 for (file = file_list; file; file = file->next) {
45 if (file->next)
46 fprintf(out, "\t%s \\\n", file->name);
47 else
48 fprintf(out, "\t%s\n", file->name);
49 }
50 fprintf(out, "\n%s: \\\n"
51 "\t$(deps_config)\n\n", conf_get_autoconfig_name());
52
53 env_write_dep(out, conf_get_autoconfig_name());
54
55 fprintf(out, "\n$(deps_config): ;\n");
56 fclose(out);
57 rename("..config.tmp", name);
58 return 0;
59}
60
61
62/* Allocate initial growable string */ 32/* Allocate initial growable string */
63struct gstr str_new(void) 33struct gstr str_new(void)
64{ 34{