diff --git a/Makefile b/Makefile index 5a48980..370da1b 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,11 @@ ifeq ($(OS),Windows_NT) OS_CFLAGS = -D__Windows__ -DNO_SHELLCMD RM = del endif + ifneq (, $findstring(MINGW, $(UNAME_S))) + PORTS_CFLAGS := $(shell pkg-config --cflags libusb) + PORTS_LDFLAGS := $(shell pkg-config --libs libusb) + RM = rm -rf + endif else MSPDEBUG_CC = $(CC) BINARY = mspdebug @@ -105,10 +110,13 @@ all: $(BINARY) ifeq ($(OS),Windows_NT) clean: - ifeq ($(UNAME_O),Cygwin) +ifeq ($(UNAME_O),Cygwin) $(RM) */*.o $(RM) $(BINARY) - else +else ifneq (, $findstring(MINGW, $(UNAME_S))) + $(RM) */*.o + $(RM) $(BINARY) +else $(RM) drivers\*.o $(RM) formats\*.o $(RM) simio\*.o @@ -116,7 +124,7 @@ clean: $(RM) ui\*.o $(RM) util\*.o $(RM) $(BINARY) - endif +endif else clean: $(RM) */*.o diff --git a/transport/bslhid.c b/transport/bslhid.c index f8a9f73..b670e2d 100644 --- a/transport/bslhid.c +++ b/transport/bslhid.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __Windows__ +#if !defined(__Windows__) || defined(__MINGW32__) #include #else #include diff --git a/transport/cdc_acm.c b/transport/cdc_acm.c index d586816..c1117d3 100644 --- a/transport/cdc_acm.c +++ b/transport/cdc_acm.c @@ -20,7 +20,7 @@ #include #include -#ifndef __Windows__ +#if !defined(__Windows__) || defined(__MINGW32__) #include #else #include diff --git a/transport/cp210x.c b/transport/cp210x.c index 830c063..0fc5134 100644 --- a/transport/cp210x.c +++ b/transport/cp210x.c @@ -21,7 +21,7 @@ #include #include -#ifndef __Windows__ +#if !defined(__Windows__) || defined(__MINGW32__) #include #else #include diff --git a/transport/rf2500.c b/transport/rf2500.c index 468ebe4..f0544ae 100644 --- a/transport/rf2500.c +++ b/transport/rf2500.c @@ -19,7 +19,7 @@ #include #include #include -#ifndef __Windows__ +#if !defined(__Windows__) || defined(__MINGW32__) #include #else #include diff --git a/transport/ti3410.c b/transport/ti3410.c index 8092e01..b96fed8 100644 --- a/transport/ti3410.c +++ b/transport/ti3410.c @@ -20,7 +20,7 @@ #include #include #include -#ifndef __Windows__ +#if !defined(__Windows__) || defined(__MINGW32__) #include #else #include diff --git a/util/usbutil.h b/util/usbutil.h index c168652..d88f1a5 100644 --- a/util/usbutil.h +++ b/util/usbutil.h @@ -19,7 +19,7 @@ #ifndef USBUTIL_H_ #define USBUTIL_H_ -#ifndef __Windows__ +#if !defined(__Windows__) || defined(__MINGW32__) #include #else #include