]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - win/configure.cpp
OOPS! We try again, since I'm smoking craq. LF is 0x0a NOT CR.
[user/henk/code/inspircd.git] / win / configure.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #define _CRT_SECURE_NO_DEPRECATE
15
16 #include <windows.h>
17 #include <stdio.h>
18 #include <string>
19 #include <time.h>
20 #include "colours.h"
21
22 using namespace std;
23 void Run();
24 void Banner();
25 void WriteCompileModules();
26 void WriteCompileCommands();
27
28 /* detects if we are running windows xp or higher (5.1) */
29 bool iswinxp()
30 {
31         OSVERSIONINFO vi;
32         vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
33         GetVersionEx(&vi);
34         if(vi.dwMajorVersion >= 5)
35                 return true;
36         
37         return false;
38 }
39
40 int get_int_option(const char * text, int def)
41 {
42         static char buffer[500];
43         int ret;
44         printf_c("%s\n[\033[1;32m%u\033[0m] -> ", text, def);
45         fgets(buffer, 500, stdin);
46         if(sscanf(buffer, "%u", &ret) != 1)
47                 ret = def;
48
49         printf("\n");
50         return ret;
51 }
52
53 bool get_bool_option(const char * text, bool def)
54 {
55         static char buffer[500];
56         char ret[100];
57         printf_c("%s [\033[1;32m%c\033[0m] -> ", text, def ? 'y' : 'n');
58         fgets(buffer, 500, stdin);
59         if(sscanf(buffer, "%s", ret) != 1)
60                 strcpy(ret, def ? "y" : "n");
61
62         printf("\n");
63         return !strncmp(ret, "y", 1);
64 }
65
66 void get_string_option(const char * text, char * def, char * buf)
67 {
68         static char buffer[500];
69         printf_c("%s\n[\033[1;32m%s\033[0m] -> ", text, def);
70         fgets(buffer, 500, stdin);
71         if(sscanf(buffer, "%s", buf) != 1)
72                 strcpy(buf, def);
73
74         printf("\n");
75 }
76
77 // escapes a string for use in a c++ file
78 bool escape_string(char * str, size_t size)
79 {
80         size_t len = strlen(str);
81         char * d_str = (char*)malloc(len * 2);
82     
83         size_t i = 0;
84         size_t j = 0;
85
86         for(; i < len; ++i)
87         {
88                 if(str[i] == '\\')
89                 {
90                         d_str[j++] = '\\';
91                         d_str[j++] = '\\';
92                 }
93                 else
94                 {
95                         d_str[j++] = str[i];
96                 }
97         }
98
99         d_str[j++] = 0;
100
101     if(j > size)
102         {
103                 free(d_str);
104                 return false;
105         }
106
107         strcpy(str, d_str);
108         free(d_str);
109         return true;
110 }
111
112 /* gets the svn revision */
113 int get_svn_revision(char * buffer, size_t len)
114 {
115         /* again.. I am lazy :p cbf to pipe output of svn info to us, so i'll just read the file */
116         /*
117         8
118
119         dir
120         7033
121         */
122         char buf[1000];
123         FILE * f = fopen("..\\.svn\\entries", "r");
124         if(!f) goto bad_rev;
125     
126         if(!fgets(buf, 1000, f)) goto bad_rev;
127         if(!fgets(buf, 1000, f)) goto bad_rev;
128         if(!fgets(buf, 1000, f)) goto bad_rev;
129         if(!fgets(buf, 1000, f)) goto bad_rev;
130         int rev = atoi(buf);
131         if(rev == 0) goto bad_rev;
132         sprintf(buffer, "%u", rev);
133         fclose(f);
134         return rev;
135         
136 bad_rev:
137         strcpy(buffer, "non-svn");
138         if(f) fclose(f);
139         return 0;
140 }
141
142 int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
143 {
144         FILE * j = fopen("inspircd_config.h", "r");
145         if (j)
146         {
147                 if (MessageBox(0, "inspircd_config.h already exists. Remove it and build from clean?", "Configure program", MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2) != IDYES)
148                 {
149                         fclose(j);
150                         exit(0);
151                 }
152         }
153
154         AllocConsole();
155
156         // pipe standard handles to this console
157         freopen("CONIN$", "r", stdin);
158         freopen("CONOUT$", "w", stdout);
159         freopen("CONOUT$", "w", stderr);
160
161         Banner();
162         Run();
163         WriteCompileCommands();
164         WriteCompileModules();
165         FreeConsole();
166         return 0;
167 }
168
169 void Banner()
170 {
171         printf_c("\nWelcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)\n"
172                          "\033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m\n\n");
173         printf_c("*** If you are unsure of any of these values, leave it blank for    ***\n"
174                          "*** standard settings that will work, and your server will run      ***\n"
175                          "*** using them. Please consult your IRC network admin if in doubt.  ***\n\n"
176                          "Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter\n"
177                          "a new value. Please note: You will \033[1mHAVE\033[0m to read the docs\n"
178                          "dir, otherwise you won't have a config file!\n\n");
179
180 }
181
182 void Run()
183 {
184         int max_fd = 1024;
185         bool use_iocp = false;
186         bool support_ip6links = false;
187         char mod_path[MAX_PATH];
188         char config_file[MAX_PATH];
189         char library_dir[MAX_PATH];
190         char base_path[MAX_PATH];
191         char bin_dir[MAX_PATH];
192         char revision_text[MAX_PATH];
193
194         int max_clients = 1024;
195         int nicklen = 31;
196         int chanlen = 64;
197         int modechanges = 20;
198         int identlen = 12;
199         int quitlen = 255;
200         int topiclen = 500;
201         int kicklen = 255;
202         int rllen = 128;
203         int awaylen = 200;
204         int revision = get_svn_revision(revision_text, MAX_PATH);
205         char version[514];
206
207         // grab version
208         FILE * fI = fopen("..\\src\\version.sh", "r");
209         if(fI)
210         {
211                 fgets(version, 514, fI);
212                 fgets(version, 514, fI);
213                 char * p2 = version;
214                 while(*p2 != '\"')
215                         ++p2;
216                 ++p2;
217                 strcpy(version, p2);
218                 p2 = version;
219                 while(*p2 != '\"')
220                         ++p2;
221                 *p2 = 0;
222                 fclose(fI);
223         }
224         else
225                 strcpy(version, "InspIRCD-Unknown");
226 #ifdef WIN64
227         printf_c("Your operating system is: \033[1;32mwindows_x64 \033[0m\n");
228 #else
229         printf_c("Your operating system is: \033[1;32mwindows_x32 \033[0m\n");
230 #endif
231         printf_c("InspIRCd revision ID: \033[1;32m%s \033[0m\n\n", revision ? revision_text : "(Non-SVN build)");
232
233         max_fd = get_int_option("What is the maximum file descriptor count you would like to allow?", 1024);
234
235         // detect windows
236         if(iswinxp())
237         {
238                 printf_c("You are running Windows 2000 or above, and IOCP support is most likely available.\n"
239                              "This removes the socket number limitation of select and is much more efficent.\n"
240                                  "If you are unsure, answer yes.\n\n");
241
242                 use_iocp = get_bool_option("Do you want to use the IOCP implementation?", true);
243         }
244
245         support_ip6links = get_bool_option("\nYou have chosen to build an \033[1;32mIPV4-only\033[0m server.\nWould you like to enable support for linking to IPV6-enabled InspIRCd servers?\nIf you are using a recent operating system and are unsure, answer yes.\nIf you answer 'no' here, your InspIRCd server will be unable\nto parse IPV6 addresses (e.g. for CIDR bans)", 
246                 true);
247         
248         printf_c("\033[1mAll paths are relative to the binary directory.\033[0m\n");
249         get_string_option("In what directory do you wish to install the InspIRCd base?", "..", base_path);
250         get_string_option("In what directory are the configuration files?", "../conf", config_file);
251         get_string_option("In what directory are the modules to be compiled to?", "../modules", mod_path);
252         get_string_option("In what directory is the IRCd binary to be placed?", ".", bin_dir);
253         get_string_option("In what directory are the IRCd libraries to be placed?", "../lib", library_dir);
254
255         printf_c("The following questions will ask you for various figures relating\n"
256                 "To your IRCd install. Please note that these should usually be left\n"
257                 "as defaults unless you have a real reason to change them. If they\n"
258                 "changed, then the values must be identical on all servers on your\n"
259                 "network, or malfunctions and/or crashes may occur, with the exception\n"
260                 "of the 'maximum number of clients' setting which may be different on\n"
261                 "different servers on the network.\n\n");
262
263     
264         max_clients = get_int_option("Please enter the maximum number of clients at any one time?", 1024);
265         nicklen = get_int_option("Please enter the maximum length of nicknames?", 31);
266         chanlen = get_int_option("Please enter the maximum length of channel names?", 64);
267         modechanges = get_int_option("Please enter the maximum number of mode changes in one line?", 20);
268         identlen = get_int_option("Please enter the maximum length of an ident (username)?", 12);
269         quitlen = get_int_option("Please enter the maximum length of a quit message?", 255);
270         topiclen = get_int_option("Please enter the maximum length of a channel topic?", 307);
271         kicklen = get_int_option("Please enter the maximum length of a kick message?", 255);
272         rllen = get_int_option("Please enter the maximum length of a GECOS (real name)?", 128);
273         awaylen = get_int_option("Please enter the maximum length of an away message?", 200);
274
275         printf_c("\n\033[1;32mPre-build configuration is complete!\n\n");       sc(TNORMAL);
276
277         // dump all the options back out
278         printf_c("\033[0mBase install path:\033[1;32m        %s\n", base_path);
279         printf_c("\033[0mConfig path:\033[1;32m              %s\n", config_file);
280         printf_c("\033[0mModule path:\033[1;32m              %s\n", mod_path);
281         printf_c("\033[0mLibrary path:\033[1;32m             %s\n", library_dir);
282         printf_c("\033[0mSocket Engine:\033[1;32m            %s\n", use_iocp ? "iocp" : "select");
283         printf_c("\033[0mMax file descriptors:\033[1;32m     %u\n", max_fd);
284         printf_c("\033[0mMax connections:\033[1;32m          %u\n", max_clients);
285         printf_c("\033[0mMax nickname length:\033[1;32m      %u\n", nicklen);
286         printf_c("\033[0mMax channel length:\033[1;32m       %u\n", chanlen);
287         printf_c("\033[0mMax mode length:\033[1;32m          %u\n", modechanges);
288         printf_c("\033[0mMax ident length:\033[1;32m         %u\n", identlen);
289         printf_c("\033[0mMax quit length:\033[1;32m          %u\n", quitlen);
290         printf_c("\033[0mMax topic length:\033[1;32m         %u\n", topiclen);
291         printf_c("\033[0mMax kick length:\033[1;32m          %u\n", kicklen);
292         printf_c("\033[0mMax name length:\033[1;32m          %u\n", rllen);
293         printf_c("\033[0mMax away length:\033[1;32m          %u\n", awaylen);
294         printf("\n"); sc(TNORMAL);
295         if(get_bool_option("Are these settings correct?", true) == false)
296         {
297                 Run();
298                 return;
299         }
300         printf("\n");
301
302         // escape the pathes
303         escape_string(config_file, MAX_PATH);
304         escape_string(mod_path, MAX_PATH);
305         escape_string(library_dir, MAX_PATH);
306
307         printf("\nWriting inspircd_config.h...");
308         FILE * f = fopen("inspircd_config.h", "w");
309         fprintf(f, "/* Auto generated by configure, do not modify! */\n");
310         fprintf(f, "#ifndef __CONFIGURATION_AUTO__\n");
311         fprintf(f, "#define __CONFIGURATION_AUTO__\n\n");
312         if(use_iocp)
313                 fprintf(f, "#define CONFIG_USE_IOCP 1\n\n");
314
315         fprintf(f, "#define CONFIG_FILE \"%s/inspircd.conf\"\n", config_file);
316         fprintf(f, "#define MOD_PATH \"%s\"\n", mod_path);
317         fprintf(f, "#define MAX_DESCRIPTORS %u\n", max_fd);
318         fprintf(f, "#define MAXCLIENTS %u\n", max_clients);
319         fprintf(f, "#define MAXCLIENTS_S \"%u\"\n", max_clients);
320         fprintf(f, "#define SOMAXCONN_S \"128\"\n");
321         fprintf(f, "#define NICKMAX %u\n", nicklen+1);
322         fprintf(f, "#define CHANMAX %u\n", chanlen+1);
323         fprintf(f, "#define MAXMODES %u\n", modechanges);
324         fprintf(f, "#define IDENTMAX %u\n", identlen);
325         fprintf(f, "#define MAXQUIT %u\n", quitlen);
326         fprintf(f, "#define MAXTOPIC %u\n", topiclen);
327         fprintf(f, "#define MAXKICK %u\n", kicklen);
328         fprintf(f, "#define MAXGECOS %u\n", rllen);
329         fprintf(f, "#define MAXAWAY %u\n", awaylen);
330         fprintf(f, "#define LIBRARYDIR \"%s\"\n", library_dir);
331         fprintf(f, "#define VERSION \"%s\"\n", version);
332         fprintf(f, "#define REVISION \"%s\"\n", revision_text);
333         if(support_ip6links)
334                 fprintf(f, "#define SUPPORT_IP6LINKS 1\n");
335
336         OSVERSIONINFO vi;
337         vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
338         GetVersionEx(&vi);
339 #ifdef WIN64
340         fprintf(f, "#define SYSTEM \"Windows_x64 %u.%u.%u %s\"\n", vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber, vi.szCSDVersion);
341 #else
342         fprintf(f, "#define SYSTEM \"Windows_x32 %u.%u.%u %s\"\n", vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber, vi.szCSDVersion);
343 #endif
344         fprintf(f, "#define MAXBUF 514\n");
345
346         fprintf(f, "\n#include \"inspircd_win32wrapper.h\"\n\n");
347         fprintf(f, "#endif\n\n");
348         fclose(f);
349
350         sc(TGREEN); printf(" done\n"); sc(TNORMAL);
351         printf("Writing inspircd_se_config.h...");
352
353         f = fopen("inspircd_se_config.h", "w");
354         fprintf(f, "/* Auto generated by configure, do not modify or commit to svn! */\n");
355         fprintf(f, "#ifndef __CONFIGURATION_SOCKETENGINE__\n");
356         fprintf(f, "#define __CONFIGURATION_SOCKETENGINE__\n\n");
357         fprintf(f, "#include \"socketengine_%s.h\"\n\n", use_iocp ? "iocp" : "select");
358         fprintf(f, "#endif\n\n");
359         fclose(f);
360
361         sc(TGREEN); printf(" done\n"); sc(TNORMAL);
362         printf("Writing command and module compilation scripts...");
363         WriteCompileCommands();
364         WriteCompileModules();
365         sc(TGREEN); printf(" done\n"); sc(TNORMAL);
366
367         printf("\nconfigure is done.. exiting!\n");
368 }
369
370 void WriteCompileCommands()
371 {
372         char commands[300][100];
373         int command_count = 0;
374         printf("\n  Finding Command Sources...\n");
375         WIN32_FIND_DATA fd;
376         HANDLE fh = FindFirstFile("..\\src\\cmd_*.cpp", &fd);
377         if(fh == INVALID_HANDLE_VALUE)
378                 printf_c("\033[1;32m  No command sources could be found! This \033[1m*could*\033[1;32m be a bad thing.. :P\033[0m");
379         else
380         {
381                 sc(TGREEN);
382                 do 
383                 {
384                         strcpy(commands[command_count], fd.cFileName);
385                         commands[command_count][strlen(fd.cFileName) - 4] = 0;
386                         printf("    %s\n", commands[command_count]);
387                         ++command_count;
388                 } while(FindNextFile(fh, &fd));
389                 sc(TNORMAL);
390         }
391     
392         // Write our spiffy new makefile :D
393         // I am such a lazy fucker :P
394         FILE * f = fopen("..\\src\\commands.mak", "w");
395
396         time_t t = time(NULL);
397         fprintf(f, "# Generated at %s\n", ctime(&t));
398         fprintf(f, "all: makedir ");
399
400         // dump modules.. first time :)
401         for(int i = 0; i < command_count; ++i)
402                 fprintf(f, "%s.so ", commands[i]);
403
404         fprintf(f, "\n.cpp.obj:\n");
405 #ifdef WIN64
406         // /MACHINE:X64
407         #ifdef _DEBUG
408                 fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../include\" /I \"../include/modes\" /I \"../include/commands\" /I \"../win\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /Gm /RTC1 /MTd /Fo\"Debug/\" /Fd\"Debug/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\win\\inspircd_memory_functions.cpp /link ..\\bin\\debug_x64\\bin\\inspircd.lib /OUT:\"..\\bin\\debug_x64\\lib\\$*.so\" /PDB:\"..\\bin\\debug_x64\\lib\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\bin\\debug_x64\\lib\\$*.lib\"\n\n");
409                 CreateDirectory("..\\src\\debug", NULL);
410                 CreateDirectory("..\\bin\\debug\\bin", NULL);
411                 CreateDirectory("..\\bin\\debug\\lib", NULL);
412                 CreateDirectory("..\\bin\\debug\\modules", NULL);
413         #else
414                 fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../include\" /I \"../include/modes\" /I \"../include/commands\" /I \"../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MT /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\win\\inspircd_memory_functions.cpp /link ..\\bin\\release_x64\\bin\\inspircd.lib /OUT:\"..\\bin\\release_x64\\lib\\$*.so\" /PDB:\"..\\bin\\release_x64\\lib\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\bin\\release_x64\\lib\\$*.lib\"\n\n");
415                 CreateDirectory("..\\src\\release", NULL);
416                 CreateDirectory("..\\bin\\release\\bin", NULL);
417                 CreateDirectory("..\\bin\\release\\lib", NULL);
418                 CreateDirectory("..\\bin\\release\\modules", NULL);
419         #endif
420 #else
421         #ifdef _DEBUG
422                 fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../include\" /I \"../include/modes\" /I \"../include/commands\" /I \"../win\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /Gm /RTC1 /MTd /Fo\"Debug/\" /Fd\"Debug/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\win\\inspircd_memory_functions.cpp /link ..\\bin\\debug\\bin\\inspircd.lib /OUT:\"..\\bin\\debug\\lib\\$*.so\" /PDB:\"..\\bin\\debug\\lib\\$*.pdb\" /IMPLIB:\"..\\bin\\debug\\lib\\$*.lib\"\n\n");
423                 CreateDirectory("..\\src\\debug", NULL);
424                 CreateDirectory("..\\bin\\debug\\bin", NULL);
425                 CreateDirectory("..\\bin\\debug\\lib", NULL);
426                 CreateDirectory("..\\bin\\debug\\modules", NULL);
427         #else
428                 fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../include\" /I \"../include/modes\" /I \"../include/commands\" /I \"../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MT /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\win\\inspircd_memory_functions.cpp /link ..\\bin\\release\\bin\\inspircd.lib /OUT:\"..\\bin\\release\\lib\\$*.so\" /PDB:\"..\\bin\\release\\lib\\$*.pdb\" /IMPLIB:\"..\\bin\\release\\lib\\$*.lib\"\n\n");
429                 CreateDirectory("..\\src\\release", NULL);
430                 CreateDirectory("..\\bin\\release\\bin", NULL);
431                 CreateDirectory("..\\bin\\release\\lib", NULL);
432                 CreateDirectory("..\\bin\\release\\modules", NULL);
433         #endif
434 #endif
435
436         fprintf(f, "makedir:\n  if not exist debug mkdir debug\n\n");
437         
438         // dump modules.. again the second and last time :)
439         for(int i = 0; i < command_count; ++i)
440                 fprintf(f, "%s.so : %s.obj\n", commands[i], commands[i]);
441
442         fprintf(f, "\n");
443         fclose(f);
444 }
445
446 void WriteCompileModules()
447 {
448         char modules[300][100];
449         int module_count = 0;
450
451         printf("Finding Modules...\n");
452         WIN32_FIND_DATA fd;
453         HANDLE fh = FindFirstFile("..\\src\\modules\\m_*.cpp", &fd);
454         if(fh == INVALID_HANDLE_VALUE)
455                 printf_c("\033[1;32m  No module sources could be found! This \033[1m*could*\033[1;32m be a bad thing.. :P\033[0m");
456         else
457         {
458                 sc(TGREEN);
459                 do 
460                 {
461                         strcpy(modules[module_count], fd.cFileName);
462                         modules[module_count][strlen(fd.cFileName) - 4] = 0;
463                         printf("  %s\n", modules[module_count]);
464                         ++module_count;
465                 } while(FindNextFile(fh, &fd));
466                 sc(TNORMAL);
467         }
468
469         // Write our spiffy new makefile :D
470         // I am such a lazy fucker :P
471         FILE * f = fopen("..\\src\\modules\\modules.mak", "w");
472
473         time_t t = time(NULL);
474         fprintf(f, "# Generated at %s\n", ctime(&t));
475         fprintf(f, "all: makedir ");
476
477         // dump modules.. first time :)
478         for(int i = 0; i < module_count; ++i)
479                 fprintf(f, "%s.so ", modules[i]);
480
481         fprintf(f, "\n.cpp.obj:\n");
482 #ifdef WIN64
483         // /MACHINE:X64
484         #ifdef _DEBUG
485                 fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /Gm /RTC1 /MTd /Fo\"Debug/\" /Fd\"Debug/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\debug_x64\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\debug_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\debug_x64\\modules\\$*.lib\"\n\n");
486                 CreateDirectory("..\\src\\modules\\debug_x64", NULL);
487         #else
488                 fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MT /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release_x64\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\modules\\$*.lib\"\n\n");
489                 CreateDirectory("..\\src\\modules\\release_x64", NULL);
490         #endif
491 #else
492         #ifdef _DEBUG
493                 fprintf(f, "  cl /nologo -Dssize_t=long /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /Gm /RTC1 /MTd /Fo\"Debug/\" /Fd\"Debug/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\debug\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\debug\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\debug\\modules\\$*.lib\"\n\n");
494                 CreateDirectory("..\\src\\modules\\debug", NULL);
495         #else
496                 fprintf(f, "  cl /nologo -Dssize_t=long /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MT /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\modules\\$*.lib\"\n\n");
497                 CreateDirectory("..\\src\\modules\\release", NULL);
498         #endif
499 #endif
500         
501         fprintf(f, "makedir:\n  if not exist debug mkdir debug\n\n");
502
503         // dump modules.. again the second and last time :)
504         for(int i = 0; i < module_count; ++i)
505                 fprintf(f, "%s.so : %s.obj\n", modules[i], modules[i]);
506
507         fprintf(f, "\n");
508         fclose(f);
509 }