summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 41 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..db58fbf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+CSRCS= lib_ws2812.c clock.c util.c stdio.c usb_serial.c
+SSRCS=
+CC=avr-gcc -mmcu=atmega32u4
+PROJECT=clock
+HEX=${PROJECT}.hex
+
+AVRDUDE=avrdude
+
+CPPFLAGS=
+CPP=${CC} -E
+
+CFLAGS=-O2 -MP -MD -Wall -Werror -Wno-unused
+
+OBJS=${CSRCS:%.c=%.o} ${SSRCS:%.S=%.o}
+
+default: ${HEX}
+
+clean:
+
+${PROJECT}:${OBJS}
+ ${CC} -o $@ ${OBJS}
+
+${HEX}: ${PROJECT}
+ avr-objcopy -O ihex -R .eeprom $< $@
+
+program: ${HEX}
+ ${AVRDUDE} -F -V -c usbasp -p ATMEGA32U4 -P usb -U flash:w:$<
+ #${AVRDUDE} -F -V -c avrispmkII -p ATMEGA32U4 -P usb -U flash:w:$<
+
+
+protos:
+ echo -n > prototypes.h
+ cproto -E "${CPP}" ${CPPFLAGS} -DPROTOTYPING ${CSRCS} > prototypes.h.tmp
+ mv prototypes.h.tmp prototypes.h
+
+clean:
+ /bin/rm -f ${PROJECT} ${HEX} ${OBJS} *~ *.d
+
+
+-include ${CSRCS:%.c=%.d}
+