From 1cc307a883c5f93a5586d208f92587af17eb8bad Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Mar 2013 01:02:09 +0100 Subject: [PATCH] Support compilation using MinGW on Linux. --- example/DllLoader/Makefile | 13 +++++++++++-- example/SampleDLL/Makefile | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/example/DllLoader/Makefile b/example/DllLoader/Makefile index 182118d..55ff822 100644 --- a/example/DllLoader/Makefile +++ b/example/DllLoader/Makefile @@ -1,6 +1,15 @@ +UNAME := $(shell uname) + +ifeq ($(UNAME), Linux) +CC = i686-w64-mingw32-gcc +CXX = i686-w64-mingw32-g++ +LINK = i686-w64-mingw32-ld +else CC = gcc -CPP = g++ +CXX = g++ LINK = ld +endif + CFLAGS = -Wall -g LDFLAGS = @@ -10,7 +19,7 @@ DllLoader.exe: $(OBJ) $(CC) $(LDFLAGS) -o DllLoader.exe $(OBJ) %.o: %.cpp - $(CPP) $(CFLAGS) -c $< + $(CXX) $(CFLAGS) -c $< %.o: %.cc $(CC) $(CFLAGS) -c $< diff --git a/example/SampleDLL/Makefile b/example/SampleDLL/Makefile index 86c82d1..cd58a20 100644 --- a/example/SampleDLL/Makefile +++ b/example/SampleDLL/Makefile @@ -1,11 +1,22 @@ -CC = g++ +UNAME := $(shell uname) + +ifeq ($(UNAME), Linux) +CC = i686-w64-mingw32-gcc +CXX = i686-w64-mingw32-g++ +LINK = i686-w64-mingw32-ld +else +CC = gcc +CXX = g++ +LINK = ld +endif + CFLAGS = -Wall -g -DSAMPLEDLL_EXPORTS LDFLAGS = -shared OBJ = SampleDLL.o SampleDLL.dll: $(OBJ) - $(CC) $(LDFLAGS) -o SampleDLL.dll $(OBJ) + $(LINK) $(LDFLAGS) -o SampleDLL.dll $(OBJ) %.o: %.cpp - $(CC) $(CFLAGS) -c $< + $(CXX) $(CFLAGS) -c $<