put back support for generating .config.cmd
authorEric Andersen <andersen@codepoet.org>
Wed, 3 Aug 2005 03:09:02 +0000 (03:09 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 3 Aug 2005 03:09:02 +0000 (03:09 -0000)
package/config/confdata.c
package/config/lkc.h
package/config/util.c

index 91a1cf4e2dee9b22b574d2a8bec4d23e89163280..55cb94fdf3842806edc9d7d3369969d8c0d0231a 100644 (file)
@@ -380,6 +380,7 @@ int conf_write(const char *name)
                }
        }
        fclose(out);
+       file_write_dep(NULL);
        if (!name || basename != conf_def_filename) {
                if (!name)
                        name = conf_def_filename;
index df2f6b46effe541461f22e89f107826a5d58f85e..b8a67fc9d6476d4b4b812f4226f7376f4c08584d 100644 (file)
@@ -59,6 +59,7 @@ void menu_set_type(int type);
 
 /* util.c */
 struct file *file_lookup(const char *name);
+int file_write_dep(const char *name);
 
 struct gstr {
        size_t len;
index 21e09a23da4bd4485458d9dac93696924d374e89..8f65ccac5158fb113858011019d588faec3eaae9 100644 (file)
@@ -26,6 +26,29 @@ struct file *file_lookup(const char *name)
        return file;
 }
 
+/* write a dependency file as used by kbuild to track dependencies */
+int file_write_dep(const char *name)
+{
+       struct file *file;
+       FILE *out;
+
+       if (!name)
+               name = ".config.cmd";
+       out = fopen(".config.tmp", "w");
+       if (!out)
+               return 1;
+       fprintf(out, "deps_config := \\\n");
+       for (file = file_list; file; file = file->next) {
+               if (file->next)
+                       fprintf(out, "\t%s \\\n", file->name);
+               else
+                       fprintf(out, "\t%s\n", file->name);
+       }
+       fprintf(out, "\n.config include/config.h: $(deps_config)\n\n$(deps_config):\n");
+       fclose(out);
+       rename(".config.tmp", name);
+       return 0;
+}
 
 /* Allocate initial growable sting */
 struct gstr str_new(void)