From 8082501b9c280f82a34930c765869d87d7c7a8a2 Mon Sep 17 00:00:00 2001
From: Sebastian Godelet <sebastian.godelet+github@gmail.com>
Date: Sat, 10 Jan 2015 16:41:58 +0800
Subject: [PATCH] Enable building of example/Makefile on Win32

Adding example/.gitignore to ignore *.exe
Appending -lws2_32 at the end of CFLAGS_EXTRA if running make on
Windows to enable easy compiling under that platform.
Obsoletes pull request #454
---
 examples/.gitignore | 1 +
 examples/Makefile   | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 examples/.gitignore

diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644
index 000000000..b883f1fdc
--- /dev/null
+++ b/examples/.gitignore
@@ -0,0 +1 @@
+*.exe
diff --git a/examples/Makefile b/examples/Makefile
index 2964d37e9..43483c3f8 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -3,13 +3,18 @@
 
 SUBDIRS = $(sort $(filter-out csharp/, $(dir $(wildcard */))))
 X = $(SUBDIRS)
+ifdef WINDIR
+    # appending the Winsock2 library at the end of the compiler
+	# invocation
+    CFLAGS_EXTRA += -lws2_32
+endif
 
 .PHONY: $(SUBDIRS)
 
 all: $(SUBDIRS)
 
 $(SUBDIRS):
-	@$(MAKE) -C $@
+	@$(MAKE) CFLAGS_EXTRA="$(CFLAGS_EXTRA)" -C $@
 
 clean:
-	for d in $(SUBDIRS) ; do $(MAKE) -C $$d clean ; done
\ No newline at end of file
+	for d in $(SUBDIRS) ; do $(MAKE) -C $$d clean ; done
-- 
GitLab