Improve compiling experience on MinGW platform (use pkg-config, *nix rm).

This commit is contained in:
William D. Jones 2018-11-18 14:49:08 -05:00
parent b975fd00a0
commit 66dc9057e2
7 changed files with 17 additions and 9 deletions

View File

@ -49,6 +49,11 @@ ifeq ($(OS),Windows_NT)
OS_CFLAGS = -D__Windows__ -DNO_SHELLCMD OS_CFLAGS = -D__Windows__ -DNO_SHELLCMD
RM = del RM = del
endif 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 else
MSPDEBUG_CC = $(CC) MSPDEBUG_CC = $(CC)
BINARY = mspdebug BINARY = mspdebug
@ -108,6 +113,9 @@ clean:
ifeq ($(UNAME_O),Cygwin) ifeq ($(UNAME_O),Cygwin)
$(RM) */*.o $(RM) */*.o
$(RM) $(BINARY) $(RM) $(BINARY)
else ifneq (, $findstring(MINGW, $(UNAME_S)))
$(RM) */*.o
$(RM) $(BINARY)
else else
$(RM) drivers\*.o $(RM) drivers\*.o
$(RM) formats\*.o $(RM) formats\*.o

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __Windows__ #if !defined(__Windows__) || defined(__MINGW32__)
#include <usb.h> #include <usb.h>
#else #else
#include <lusb0_usb.h> #include <lusb0_usb.h>

View File

@ -20,7 +20,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef __Windows__ #if !defined(__Windows__) || defined(__MINGW32__)
#include <usb.h> #include <usb.h>
#else #else
#include <lusb0_usb.h> #include <lusb0_usb.h>

View File

@ -21,7 +21,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef __Windows__ #if !defined(__Windows__) || defined(__MINGW32__)
#include <usb.h> #include <usb.h>
#else #else
#include <lusb0_usb.h> #include <lusb0_usb.h>

View File

@ -19,7 +19,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef __Windows__ #if !defined(__Windows__) || defined(__MINGW32__)
#include <usb.h> #include <usb.h>
#else #else
#include <lusb0_usb.h> #include <lusb0_usb.h>

View File

@ -20,7 +20,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifndef __Windows__ #if !defined(__Windows__) || defined(__MINGW32__)
#include <usb.h> #include <usb.h>
#else #else
#include <lusb0_usb.h> #include <lusb0_usb.h>

View File

@ -19,7 +19,7 @@
#ifndef USBUTIL_H_ #ifndef USBUTIL_H_
#define USBUTIL_H_ #define USBUTIL_H_
#ifndef __Windows__ #if !defined(__Windows__) || defined(__MINGW32__)
#include <usb.h> #include <usb.h>
#else #else
#include <lusb0_usb.h> #include <lusb0_usb.h>