blob: 72ea521d5f2c16237a887333c6c75d60a111fb23 [file] [log] [blame]
Cástor Muñoz346423c2016-02-04 23:05:17 +01001# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
Cástor Muñozfbbba922017-05-04 10:52:03 +02007CC := gcc
Cástor Muñoz346423c2016-02-04 23:05:17 +01008CFLAGS += -Wall -Wextra
9
10OUTPUT = mks5lboot
11
12# inputs for lib
13LIBSOURCES := dualboot.c mkdfu.c ipoddfu.c
14# inputs for binary only
15SOURCES := $(LIBSOURCES) main.c
16# dependencies for binary
17EXTRADEPS :=
18
Cástor Muñozfbbba922017-05-04 10:52:03 +020019CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -)
20
21ifeq ($(findstring WIN32,$(CPPDEFINES)),WIN32)
Cástor Muñoz346423c2016-02-04 23:05:17 +010022LDOPTS += -lsetupapi
Cástor Muñozfbbba922017-05-04 10:52:03 +020023# optional libusb support (needed for WinUSB and libusbK drivers)
24ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW)
25ifeq ($(USE_LIBUSBAPI),1)
26CFLAGS += -DUSE_LIBUSBAPI
Cástor Muñoz346423c2016-02-04 23:05:17 +010027LDOPTS += -Wl,-Bstatic -lusb-1.0
28endif
Cástor Muñozfbbba922017-05-04 10:52:03 +020029endif
Cástor Muñoz346423c2016-02-04 23:05:17 +010030else
Cástor Muñozfbbba922017-05-04 10:52:03 +020031ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE)
32LDOPTS += -L/usr/local/lib -framework IOKit -framework CoreFoundation
33else # Linux
34CFLAGS += -DUSE_LIBUSBAPI
Cástor Muñoz346423c2016-02-04 23:05:17 +010035LDOPTS += -lusb-1.0
36endif
Cástor Muñozfbbba922017-05-04 10:52:03 +020037endif
Cástor Muñoz346423c2016-02-04 23:05:17 +010038
39include ../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