Skip to content

Commit

Permalink
Support compilation using MinGW on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Mar 5, 2013
1 parent d9a3b23 commit 1cc307a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
13 changes: 11 additions & 2 deletions example/DllLoader/Makefile
Original file line number Diff line number Diff line change
@@ -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 =

Expand All @@ -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 $<
17 changes: 14 additions & 3 deletions example/SampleDLL/Makefile
Original file line number Diff line number Diff line change
@@ -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 $<

0 comments on commit 1cc307a

Please sign in to comment.