6 /* This file creates the getbuildinfo.o object, by first
7 invoking subwcrev.exe (if found), and then invoking cl.exe.
8 As a side effect, it might generate PCBuild\getbuildinfo2.c
9 also. If this isn't a subversion checkout, or subwcrev isn't
10 found, it compiles ..\\Modules\\getbuildinfo.c instead.
12 Currently, subwcrev.exe is found from the registry entries
15 No attempt is made to place getbuildinfo.o into the proper
16 binary directory. This isn't necessary, as this tool is
17 invoked as a pre-link step for pythoncore, so that overwrites
18 any previous getbuildinfo.o.
28 if (_stat(".svn", &st
) < 0)
30 if (RegOpenKey(HKEY_LOCAL_MACHINE
, "Software\\TortoiseSVN", &hTortoise
) != ERROR_SUCCESS
&&
31 RegOpenKey(HKEY_CURRENT_USER
, "Software\\TortoiseSVN", &hTortoise
) != ERROR_SUCCESS
)
32 /* Tortoise not installed */
34 command
[0] = '"'; /* quote the path to the executable */
35 size
= sizeof(command
) - 1;
36 if (RegQueryValueEx(hTortoise
, "Directory", 0, &type
, command
+1, &size
) != ERROR_SUCCESS
||
38 /* Registry corrupted */
40 strcat(command
, "bin\\subwcrev.exe");
41 if (_stat(command
+1, &st
) < 0)
42 /* subwcrev.exe not part of the release */
44 strcat(command
, "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo2.c");
45 puts(command
); fflush(stdout
);
46 if (system(command
) < 0)
51 int main(int argc
, char*argv
[])
53 char command
[500] = "cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL ";
54 int do_unlink
, result
;
56 fprintf(stderr
, "make_buildinfo $(ConfigurationName)\n");
59 if (strcmp(argv
[1], "Release") == 0) {
60 strcat(command
, "-MD ");
61 //strcpy(targetdir, "x86-temp-debug");
63 else if (strcmp(argv
[1], "Debug") == 0) {
64 strcat(command
, "-D_DEBUG -MDd ");
65 //strcpy(targetdir, "x86-temp-release");
67 else if (strcmp(argv
[1], "ReleaseItanium")) {
68 strcat(command
, "-MD ");
69 //strcpy(targetdir, "ia64-temp-release");
72 fprintf(stderr
, "unsupported configuration %s\n", argv
[1]);
76 if ((do_unlink
= make_buildinfo2()))
77 strcat(command
, "getbuildinfo2.c -DSUBWCREV ");
79 strcat(command
, "..\\Modules\\getbuildinfo.c");
80 strcat(command
, " -Fogetbuildinfo.o -I..\\Include -I..\\PC");
81 puts(command
); fflush(stdout
);
82 result
= system(command
);
84 unlink("getbuildinfo2.c");