Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 1 | # __________ __ ___. |
| 2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 6 | # \/ \/ \/ \/ \/ |
Cástor Muñoz | fbbba92 | 2017-05-04 10:52:03 +0200 | [diff] [blame] | 7 | CC := gcc |
Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 8 | CFLAGS += -Wall -Wextra |
| 9 | |
| 10 | OUTPUT = mks5lboot |
| 11 | |
| 12 | # inputs for lib |
| 13 | LIBSOURCES := dualboot.c mkdfu.c ipoddfu.c |
| 14 | # inputs for binary only |
| 15 | SOURCES := $(LIBSOURCES) main.c |
| 16 | # dependencies for binary |
| 17 | EXTRADEPS := |
| 18 | |
Cástor Muñoz | fbbba92 | 2017-05-04 10:52:03 +0200 | [diff] [blame] | 19 | CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) |
| 20 | |
| 21 | ifeq ($(findstring WIN32,$(CPPDEFINES)),WIN32) |
Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 22 | LDOPTS += -lsetupapi |
Cástor Muñoz | fbbba92 | 2017-05-04 10:52:03 +0200 | [diff] [blame] | 23 | # optional libusb support (needed for WinUSB and libusbK drivers) |
| 24 | ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW) |
| 25 | ifeq ($(USE_LIBUSBAPI),1) |
| 26 | CFLAGS += -DUSE_LIBUSBAPI |
Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 27 | LDOPTS += -Wl,-Bstatic -lusb-1.0 |
| 28 | endif |
Cástor Muñoz | fbbba92 | 2017-05-04 10:52:03 +0200 | [diff] [blame] | 29 | endif |
Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 30 | else |
Cástor Muñoz | fbbba92 | 2017-05-04 10:52:03 +0200 | [diff] [blame] | 31 | ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE) |
| 32 | LDOPTS += -L/usr/local/lib -framework IOKit -framework CoreFoundation |
| 33 | else # Linux |
| 34 | CFLAGS += -DUSE_LIBUSBAPI |
Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 35 | LDOPTS += -lusb-1.0 |
| 36 | endif |
Cástor Muñoz | fbbba92 | 2017-05-04 10:52:03 +0200 | [diff] [blame] | 37 | endif |
Cástor Muñoz | 346423c | 2016-02-04 23:05:17 +0100 | [diff] [blame] | 38 | |
| 39 | include ../libtools.make |
| 40 | |
| 41 | # explicit dependencies on dualboot.{c,h} and mks5lboot.h |
| 42 | $(OBJDIR)mks5lboot.o: dualboot.h dualboot.c mks5lboot.h |
| 43 | $(OBJDIR)main.o: dualboot.h dualboot.c main.c mks5lboot.h |