# Makefile initially writen for Little-Wire by Omer Kilic # Later on modified by ihsan Kehribar 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 example: $@... $(CC) $(CFLAGS) -o $@$(EXE_SUFFIX) examples/$@.c $^ $(LIBS) clean: rm -f $(EXAMPLES)$(EXE_SUFFIX) *.o *.exe install: all cp micronucleus /usr/local/bin