summaryrefslogtreecommitdiff
path: root/usb/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'usb/Makefile')
-rw-r--r--usb/Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/usb/Makefile b/usb/Makefile
new file mode 100644
index 0000000..58230b3
--- /dev/null
+++ b/usb/Makefile
@@ -0,0 +1,29 @@
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+
+CFLAGS = -Wall -Os -Iusbdrv -mmcu=attiny85 -DF_CPU=16500000
+OBJFLAGS = -j .text -j .data -O ihex
+
+OBJECTS = usbdrv/usbdrv.o usbdrv/oddebug.o usbdrv/usbdrvasm.o usb.o
+
+all: usb.hex usbtest
+
+clean:
+ $(RM) *.o *.hex *.elf usbdrv/*.o usbtest
+
+%.hex: %.elf
+ $(OBJCOPY) $(OBJFLAGS) $< $@
+
+usb.elf: $(OBJECTS)
+ $(CC) $(CFLAGS) $(OBJECTS) -o $@
+
+$(OBJECTS): usbdrv/usbconfig.h
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+%.o: %.S
+ $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@
+
+usbtest:
+ gcc $(pkg-config --libs libusb) -O -Wall usbtest.c -o usbtest -lusb