Hello there,
I successfully tested the latest revision of GNU make on WIN32 today and
just wanted to share the changes required to successfully build for MinGW
and MSVC.
To summarize, I needed to make the following changes:
- Moved __declspec(dllexport) before function return type in GMK_EXPORT.
- Added previously missing files load.c and posixfcn.c to project file.
- Placed unistd.h inclusion in guard (not available in MSVC).
- Fixed OUTPUT_SYNC -> NO_OUTPUT_SYNC guard inversion.
Please find the patch attached and commit if possible.
Best regards,
Gerte Hoogewerf
diff -Nur a/gnumake.h b/gnumake.h
--- a/gnumake.h 2013-09-23 17:24:52.000000000 +0200
+++ b/gnumake.h 2013-09-25 15:32:18.274071400 +0200
@@ -29,26 +29,26 @@
#ifdef _WIN32
# ifdef GMK_BUILDING_MAKE
-# define GMK_EXPORT __declspec(dllexport)
+# define GMK_EXPORT(TYPE) __declspec(dllexport) TYPE
# else
-# define GMK_EXPORT __declspec(dllimport)
+# define GMK_EXPORT(TYPE) __declspec(dllimport) TYPE
# endif
#else
-# define GMK_EXPORT
+# define GMK_EXPORT(TYPE) TYPE
#endif
/* Free memory returned by the gmk_expand() function. */
-void GMK_EXPORT gmk_free (char *str);
+GMK_EXPORT(void) gmk_free (char *str);
/* Allocate memory in GNU make's context. */
-char * GMK_EXPORT gmk_alloc (unsigned int len);
+GMK_EXPORT(char *) gmk_alloc (unsigned int len);
/* Run $(eval ...) on the provided string BUFFER. */
-void GMK_EXPORT gmk_eval (const char *buffer, const gmk_floc *floc);
+GMK_EXPORT(void) gmk_eval (const char *buffer, const gmk_floc *floc);
/* Run GNU make expansion on the provided string STR.
Returns an allocated buffer that the caller must free with gmk_free(). */
-char * GMK_EXPORT gmk_expand (const char *str);
+GMK_EXPORT(char *) gmk_expand (const char *str);
/* Register a new GNU make function NAME (maximum of 255 chars long).
When the function is expanded in the makefile, FUNC will be invoked with
@@ -65,7 +65,7 @@
If EXPAND_ARGS is 0, the arguments to the function will not be expanded
before FUNC is called. If EXPAND_ARGS is non-0, they will be expanded.
*/
-void GMK_EXPORT gmk_add_function (const char *name,
+GMK_EXPORT(void) gmk_add_function (const char *name,
char *(*func)(const char *nm,
int argc, char **argv),
int min_args, int max_args, int expand_args);
diff -Nur a/make_msvc_net2003.vcproj b/make_msvc_net2003.vcproj
--- a/make_msvc_net2003.vcproj 2013-09-23 17:24:52.000000000 +0200
+++ b/make_msvc_net2003.vcproj 2013-09-25 15:22:05.592213600 +0200
@@ -172,6 +172,9 @@
RelativePath=".\job.c">
</File>
<File
+ RelativePath=".\load.c">
+ </File>
+ <File
RelativePath=".\output.c">
</File>
<File
@@ -211,6 +214,9 @@
RelativePath=".\w32\compat\dirent.c">
</File>
<File
+ RelativePath=".\w32\compat\posixfcn.c">
+ </File>
+ <File
RelativePath=".\w32\subproc\misc.c">
<FileConfiguration
Name="Debug|Win32">
diff -Nur a/output.c b/output.c
--- a/output.c 2013-09-23 17:24:52.000000000 +0200
+++ b/output.c 2013-09-25 15:37:38.434519700 +0200
@@ -22,7 +22,14 @@
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
-#include <unistd.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef _MSC_VER
+# include <io.h>
+#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
diff -Nur a/w32/compat/posixfcn.c b/w32/compat/posixfcn.c
--- a/w32/compat/posixfcn.c 2013-09-23 17:24:52.000000000 +0200
+++ b/w32/compat/posixfcn.c 2013-09-25 15:19:16.351976700 +0200
@@ -26,7 +26,7 @@
#include "makeint.h"
#include "job.h"
-#ifdef NO_OUTPUT_SYNC
+#ifndef NO_OUTPUT_SYNC
/* Support for OUTPUT_SYNC and related functionality. */
/* Emulation of fcntl that supports only F_GETFD and F_SETLKW. */
_______________________________________________
Bug-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-make