Hi all, The GNU make is a must have but there are a lot of different Win32 versions around. Some of them seems not to be working properly (ie. minGW, Cygwin 3.80 (in Mozilla FireFox)). This is not good since it will render GNU make a bad reputation. So I decided to try to compile my own, which I did and it's working great! The tool I used was the Windows 2003 DDK - it's free, comes with complete runtime and a full optimizing compiler. Binaries will also link to the official runtime included in Windows.
However, before I was able to compile there were some work needed to be done. The nmake script is not working. I found that there are several bugs in the configuration for the Microsoft compiler and the Microsoft runtime library in particular. Include files are missing and the conditional compilation directives (#if...#endif) are sometimes misleading. Example: #if defined __STDC__ && __STDC__ ...correct expression #else ...bad expression #endif I assume the purpose of this is to determine the runtime library used. The Microsoft compiler normally sets __STDC__ to false to indicate it is using Microsoft extensions to ANSI C. One could of course disable the extensions and __STDC__ would be defined: BAD idea. I went over the code and changed all __STDC__ directives to something like this: #if (defined(__STDC__) && __STDC__) || defined(_MSC_EXTENSIONS) Note: Sometimes the constant "WINDOWS32" is used in the code in same context. That is by my opinion not good because it could be confused with "WIN32" meaning "compile for windows" regardless of which runtime used. The expression #ifdef HAVE_UNISTD_H seems also sometimes being used to determine runtime library. How I did the compile: 1) Find the bugs * set warning level 4 /W4 /WX * include a forced header /FI"vc_defs.h" Include all needed runtime headers in vc_defs.h (stdlib.h, stdio.h etc) * use __stdcall calling convention /Gz * add #include <direct.h> to make.h (ie line 365) * examine options in config.h and read readme.w32 * compile - a lot of errors 2) Correct * Disable all incorrect runtime prototypes * specify __cdecl for local funtions called by the runtime (ie qsort) special case: typedef int (__cdecl *qsort_cmp_t) __P((void const *, void const *)); int (__cdecl *gl_stat) __PMT((__const char *, struct stat *)); * optional: remove dependencies to user32.dll by change w32err.c: wsprintf(szMessageBuffer, "Error %ld", ercode); to sprintf(szMessageBuffer, "Error %ld", ercode); or _stprintf(szMessageBuffer, _T("Error %ld"), ercode); 3) Disable warnings and build * link oldnames.lib Here is my list of warnings. Some of these may not be trivial and may indicate bugs vc_defs.h #ifndef _DEBUG #pragma warning(disable : 4007) // 'main' : must be '__cdecl' #pragma warning(disable : 4018) // signed/unsigned mismatch #pragma warning(disable : 4028) // formal parameter different from declaration #pragma warning(disable : 4057) // differs in indirection to slightly different base types #pragma warning(disable : 4100) // unreferenced formal parameter #pragma warning(disable : 4101) // unreferenced local variable #pragma warning(disable : 4102) // unreferenced label #pragma warning(disable : 4113) // function differs in parameter lists from type #pragma warning(disable : 4115) // named type definition in parentheses #pragma warning(disable : 4127) // conditional expression is constant #pragma warning(disable : 4130) // logical operation on address of string constant #pragma warning(disable : 4131) // uses old-style declarator #pragma warning(disable : 4189) // local variable is initialized but not referenced #pragma warning(disable : 4210) // nonstandard extension used : function given file scope #pragma warning(disable : 4213) // nonstandard extension used : cast on l-value #pragma warning(disable : 4242) // conversion to smaller type, possible loss of data #pragma warning(disable : 4244) // conversion to smaller type, possible loss of data #pragma warning(disable : 4245) // conversion, signed/unsigned mismatch #pragma warning(disable : 4296) // expression is always false #pragma warning(disable : 4307) // integral constant overflow #pragma warning(disable : 4389) // signed/unsigned mismatch #pragma warning(disable : 4700) // local variable used without having been initialized #pragma warning(disable : 4701) // local variable may have been used without having been initialized #pragma warning(disable : 4702) // unreachable code #pragma warning(disable : 4706) // assignment within conditional expression #endif If you are interested in my build, please send me an e-mail: GNUmake_build_DDK.zip 12kB GNUmake_exe.zip 60kB (106 kB uncompressed) For the devopers of GNU make: If there are interests I will be happy to send you my source files. A test for the intel compiler would also be interesting? Kind regards Jerker Bäck, Sweden jerker.back at home.se _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make