#define LKC_DIRECT_LINK
#include "lkc.h"
+#ifdef WIN32
+#define mkdir(x,y) mkdir(x)
+#define UNLINK_IF_NECESSARY(x) unlink(x)
+#else
+#define UNLINK_IF_NECESSARY(X)
+#endif
+
static void conf_warning(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
"# libpayload version: %s\n"
"%s%s"
"#\n"),
- getenv("KERNELVERSION"),
+ getenv("KERNELVERSION")?getenv("KERNELVERSION"):"",
use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : "");
if (*tmpname) {
strcat(dirname, basename);
strcat(dirname, ".old");
+ UNLINK_IF_NECESSARY(dirname);
rename(newname, dirname);
if (rename(tmpname, newname))
return 1;
"# libpayload version: %s\n"
"# %s"
"#\n",
- getenv("KERNELVERSION"), ctime(&now));
+ getenv("KERNELVERSION")?getenv("KERNELVERSION"):"", ctime(&now));
fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n"
" * libpayload version: %s\n"
" * %s"
" */\n"
"#define AUTOCONF_INCLUDED\n",
- getenv("KERNELVERSION"), ctime(&now));
+ getenv("KERNELVERSION")?getenv("KERNELVERSION"):"", ctime(&now));
for_all_symbols(i, sym) {
sym_calc_value(sym);
name = getenv("KCONFIG_AUTOHEADER");
if (!name)
name = "include/linux/autoconf.h";
+ UNLINK_IF_NECESSARY(name);
if (rename(".tmpconfig.h", name))
return 1;
name = getenv("KCONFIG_AUTOCONFIG");
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
+ UNLINK_IF_NECESSARY(name);
if (rename(".tmpconfig", name))
return 1;