Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Make target for MACOSX and USE_LIBUSB combination. #20

Merged
merged 1 commit into from
Jan 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ OS ?= LINUX
#OS ?= WINDOWS
#OS ?= MACOSX
#OS ?= BSD
USE_LIBUSB ?= YES

ifeq ($(OS), LINUX) # also works on FreeBSD
CC ?= gcc
Expand All @@ -18,13 +19,21 @@ teensy_loader_cli.exe: teensy_loader_cli.c


else ifeq ($(OS), MACOSX)
ifeq ($(USE_LIBUSB), YES)
CC ?= gcc
CFLAGS ?= -O2 -Wall
teensy_loader_cli: teensy_loader_cli.c
$(CC) $(CFLAGS) -s -DUSE_LIBUSB -DMACOSX -o teensy_loader_cli teensy_loader_cli.c -lusb -I /usr/local/include -L/usr/local/lib

else
CC ?= gcc
SDK ?= $(shell xcrun --show-sdk-path)
#SDK ?= /Developer/SDKs/MacOSX10.5.sdk # the old way...
CFLAGS ?= -O2 -Wall
teensy_loader_cli: teensy_loader_cli.c
$(CC) $(CFLAGS) -DUSE_APPLE_IOKIT -isysroot $(SDK) -o teensy_loader_cli teensy_loader_cli.c -Wl,-syslibroot,$(SDK) -framework IOKit -framework CoreFoundation

endif

else ifeq ($(OS), BSD) # works on NetBSD and OpenBSD
CC ?= gcc
Expand Down
3 changes: 3 additions & 0 deletions teensy_loader_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,15 @@ usb_dev_handle * open_usb_device(int vid, int pid)
// Mac OS-X - removing this call to usb_claim_interface() might allow
// this to work, even though it is a clear misuse of the libusb API.
// normally Apple's IOKit should be used on Mac OS-X
#if !defined(MACOSX)
r = usb_claim_interface(h, 0);
if (r < 0) {
usb_close(h);
printf_verbose("Unable to claim interface, check USB permissions\n");
continue;
}
#endif

return h;
}
}
Expand Down