mks5lboot: updates

- fix Makefile to allow cross compilation
- Windows: use Sleep() instead of nanosleep()
- Windows: libusb now is optional
- OS X: use IOKit instead of libusb
- small rework on the DFU API

Change-Id: Ia4b07012c098ad608594e15f6effe9c9d2164b9b
This commit is contained in:
Cástor Muñoz 2017-05-04 10:52:03 +02:00
parent cf168d4636
commit fbbba9292b
6 changed files with 492 additions and 267 deletions

View file

@ -4,6 +4,7 @@
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
CC := gcc
CFLAGS += -Wall -Wextra
OUTPUT = mks5lboot
@ -15,18 +16,25 @@ SOURCES := $(LIBSOURCES) main.c
# dependencies for binary
EXTRADEPS :=
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -)
ifeq ($(findstring WIN32,$(CPPDEFINES)),WIN32)
LDOPTS += -lsetupapi
# optional libusb support on Windows
ifdef DISABLE_LIBUSBAPI
CFLAGS += -DNO_LIBUSBAPI
else
# optional libusb support (needed for WinUSB and libusbK drivers)
ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW)
ifeq ($(USE_LIBUSBAPI),1)
CFLAGS += -DUSE_LIBUSBAPI
LDOPTS += -Wl,-Bstatic -lusb-1.0
endif
endif
else
# Linux, OS X
ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE)
LDOPTS += -L/usr/local/lib -framework IOKit -framework CoreFoundation
else # Linux
CFLAGS += -DUSE_LIBUSBAPI
LDOPTS += -lusb-1.0
endif
endif
include ../libtools.make