From f0529dacedf7da83f8d5107a8ca7d73f35560894 Mon Sep 17 00:00:00 2001
From: Eli Zaretskii <eliz@gnu.org>
Date: Mon, 6 May 2013 20:18:58 +0300
Subject: [PATCH] Rearrange dllimport/dllexport declarations for MS-Windows.

 gnumake.h (GMK_EXPORT) [_WIN32]: Move the dllexport declaration
 here from makeint.h.
 makeint.h (GMK_BUILDING_MAKE) [WINDOWS32]: Define before
 including gnumake.h.
---
 ChangeLog | 6 ++++++
 gnumake.h | 4 +++-
 makeint.h | 6 +++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0427aa9a..21e22aef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2013-05-06  Eli Zaretskii  <eliz@gnu.org>
 
+	* gnumake.h (GMK_EXPORT) [_WIN32]: Move the dllexport declaration
+	here from makeint.h.
+
+	* makeint.h (GMK_BUILDING_MAKE) [WINDOWS32]: Define before
+	including gnumake.h.
+
 	* doc/make.texi (Loaded Object Example): Add a note about building
 	shared objects on MS-Windows.
 
diff --git a/gnumake.h b/gnumake.h
index 168f3708..8c622b7f 100644
--- a/gnumake.h
+++ b/gnumake.h
@@ -28,7 +28,9 @@ typedef struct
 
 
 #ifdef _WIN32
-# ifndef GMK_EXPORT
+# ifdef GMK_BUILDING_MAKE
+#  define GMK_EXPORT  __declspec(dllexport)
+# else
 #  define GMK_EXPORT  __declspec(dllimport)
 # endif
 #else
diff --git a/makeint.h b/makeint.h
index 14a6c261..6bff07af 100644
--- a/makeint.h
+++ b/makeint.h
@@ -49,10 +49,10 @@ char *alloca ();
 
 /* Include the externally-visible content.
    Be sure to use the local one, and not one installed on the system.
-   Define GMK_EXPORT for proper selection of dllexport/dllimport declarations
-   for MS-Windows.  */
+   Define GMK_BUILDING_MAKE for proper selection of dllexport/dllimport
+   declarations for MS-Windows.  */
 #ifdef WINDOWS32
-# define GMK_EXPORT  __declspec(dllexport)
+# define GMK_BUILDING_MAKE
 #endif
 #include "gnumake.h"