EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
+UNAME := $(shell uname -s)
+
+ifneq (,$(findstring MINGW,$(UNAME)))
+ LIBS := $(LIBS) -lws2_32
+endif
+
# force link order under cygwin to avoid getopts / libiberty clash
ifneq ($(strip $(shell gcc -v 2>&1 | grep "cygwin")),)
LIBS := -lcygwin $(LIBS)
#ifndef _ELF_H
#define _ELF_H 1
+#if defined(__MINGW32__)
+#include <stdint.h>
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+typedef uint64_t u_int64_t;
+#else
#include <features.h>
-
+#endif
/* Standard ELF types. */
#include <sys/types.h>
#if defined(TARGET_h8300)
#include <elf/h8.h> /* TARGET_* ELF support for the BFD library */
-#elif defined(__CYGWIN__)
+#elif defined(__CYGWIN__) || defined(__MINGW32__)
#include "cygwin-elf.h" /* Cygwin uses a local copy */
#elif defined(TARGET_microblaze)
#include <elf/microblaze.h> /* TARGET_* ELF support for the BFD library */
#include <elf.h> /* TARGET_* ELF support for the BFD library */
#endif
+#if defined(__MINGW32__)
+#include <getopt.h>
+#endif
+
/* from uClinux-x.x.x/include/linux */
#include "flat.h" /* Binary flat header description */
#include <string.h> /* strcat(), strcpy() */
/* macros for conversion between host and (internet) network byte order */
+#ifndef WIN32
#include <netinet/in.h> /* Consts and structs defined by the internet system */
+#else
+#include <winsock2.h>
+#endif
/* from uClinux-x.x.x/include/linux */
#include "flat.h" /* Binary flat header description */
+#if defined(__MINGW32__)
+#include <getopt.h>
+
+#define mkstemp(p) mktemp(p)
+
+#endif
+
/****************************************************************************/
char *program_name;