aboutsummaryrefslogtreecommitdiff
path: root/avr-ioe.mk
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-10-08 20:59:26 +0200
committerKarel Kočí <cynerd@email.cz>2015-10-08 20:59:26 +0200
commitacdd758e56e28f22846e7d34d87f5533c8682574 (patch)
treed8fda0b554e99d6ace98a9300ecb5835b5bf50e0 /avr-ioe.mk
parent0b534d81ac39eb5bbf2b9a0691519f6f7f0eaa13 (diff)
downloadavr-ioe-acdd758e56e28f22846e7d34d87f5533c8682574.tar.gz
avr-ioe-acdd758e56e28f22846e7d34d87f5533c8682574.tar.bz2
avr-ioe-acdd758e56e28f22846e7d34d87f5533c8682574.zip
Add implementation of USART and more ground changes
Diffstat (limited to 'avr-ioe.mk')
-rw-r--r--avr-ioe.mk47
1 files changed, 47 insertions, 0 deletions
diff --git a/avr-ioe.mk b/avr-ioe.mk
new file mode 100644
index 0000000..1248f11
--- /dev/null
+++ b/avr-ioe.mk
@@ -0,0 +1,47 @@
+ifndef IOE_PREFIX
+ IOE_PREFIX = .
+endif
+
+IOE_SRC_SPI = $(IOE_PREFIX)/src/spi.c
+IOE_SRC_USART = $(IOE_PREFIX)/src/usart.c
+IOE_SRC = $(IOE_SRC_SPI) $(IOE_SRC_USART)
+
+IOE_OBJ_SPI = $(patsubst %.c,%.o,$(IOE_SRC_SPI))
+IOE_OBJ_USART = $(patsubst %.c,%.o,$(IOE_SRC_USART))
+IOE_OBJ = $(patsubst %.c,%.o,$(IOE_SRC))
+
+IOE_DEP_SPI = $(patsubst %.c,%.d,$(IOE_SRC_SPI))
+IOE_DEP_USART = $(patsubst %.c,%.d,$(IOE_SRC_USART))
+IOE_DEP = $(patsubst %.c,%.d,$(IOE_SRC))
+
+
+ifndef IOE_ONLYPATHS # Following section can be suppressed by defining this variable
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),help)
+-include $(IOE_DEP)
+endif
+endif
+
+ifndef F_CPU
+ $(error Please define F_CPU variable in makefile before including avr-ioe.mk)
+endif
+ifndef MMCU
+ $(error Pleade define MMCU variable in makefile before including avr-ioe.mk)
+endif
+IOE_CFLAGS ?= -Os -ffunction-sections -fdata-sections -fshort-enums -Wall
+IOE_CFLAGS += -DF_CPU=$(F_CPU) -mmcu=$(MMCU)
+IOE_GCC ?= avr-gcc
+
+$(IOE_OBJ): %.o: %.c
+ $(IOE_GCC) $(IOE_CFLAGS) -c -o $@ $<
+
+$(IOE_DEP): %.d: %.c
+ $(IOE_GCC) -MM -MG -MT '$*.o $@' $(IOE_CFLAGS) -c -o $@ $<
+
+.PHONY: ioeclean
+ioeclean:
+ $(RM) $(IOE_OBJ)
+ $(RM) $(IOE_DEP)
+
+endif