blob: 028f7aa920039d79533395672081b59476d5d95c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# Makefile initially writen for Little-Wire by Omer Kilic <omerkilic@gmail.com>
# Later on modified by ihsan Kehribar <ihsan@kehribar.me> for Micronucleus bootloader application.
CC=gcc
# FIXME: Need to add OSX stuff
ifeq ($(shell uname), Linux)
USBFLAGS=$(shell libusb-config --cflags)
USBLIBS=$(shell libusb-config --libs)
EXE_SUFFIX =
OSFLAG = -D LINUX
else ifeq ($(shell uname), Darwin)
USBFLAGS=$(shell libusb-config --cflags || libusb-legacy-config --cflags)
USBLIBS=$(shell libusb-config --libs || libusb-legacy-config --libs)
EXE_SUFFIX =
OSFLAG = -D MAC_OS
else
USBFLAGS = -I C:\MinGW\include
USBLIBS = -L C:\MinGW\lib -lusb
EXE_SUFFIX = .exe
OSFLAG = -D WIN
endif
LIBS = $(USBLIBS)
INCLUDE = library
CFLAGS = $(USBFLAGS) $(LIBS) -I$(INCLUDE) -O -g $(OSFLAG)
LWLIBS = micronucleus_lib littleWire_util
EXAMPLES = micronucleus
.PHONY: clean library
all: library $(EXAMPLES)
library: $(LWLIBS)
$(LWLIBS):
@echo Building library: $@...
$(CC) $(CFLAGS) -c library/$@.c
$(EXAMPLES): $(addsuffix .o, $(LWLIBS))
@echo Building command line tool: $@...
$(CC) $(CFLAGS) -o $@$(EXE_SUFFIX) $@.c $^ $(LIBS)
clean:
rm -f $(EXAMPLES)$(EXE_SUFFIX) *.o *.exe
install: all
cp micronucleus /usr/local/bin
|