summaryrefslogtreecommitdiff
path: root/include.mk
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2011-08-23 20:43:18 +0000
committerChristian Pointner <equinox@spreadspace.org>2011-08-23 20:43:18 +0000
commit814190670c7db7f7e3d3cef266f2685dbb956653 (patch)
tree7cac96b38add8caa902e9237a4d8b4d716a97f01 /include.mk
parentadded inital svn dirs (diff)
added first (not working) version of include.mk
git-svn-id: https://svn.spreadspace.org/avr/trunk@2 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'include.mk')
-rw-r--r--include.mk94
1 files changed, 94 insertions, 0 deletions
diff --git a/include.mk b/include.mk
new file mode 100644
index 0000000..2efc96e
--- /dev/null
+++ b/include.mk
@@ -0,0 +1,94 @@
+##
+## spreadspace teensy utils
+##
+##
+## Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org>
+##
+## This file is part of spreadspace teensy utils.
+##
+## spreadspace teensy utils is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## any later version.
+##
+## spreadspace teensy utils is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with spreadspace teensy utils. If not, see <http://www.gnu.org/licenses/>.
+##
+
+#NAME :=
+#OBJ :=
+#BOARD_TYPE :=
+
+ifeq ($(BOARD_TYPE),teensy1)
+MCU := at90usb162
+endif
+ifeq ($(BOARD_TYPE),teensy2)
+MCU := atmega32u4
+endif
+ifeq ($(BOARD_TYPE),teensypp1)
+MCU := at90usb646
+endif
+ifeq ($(BOARD_TYPE),teensypp2)
+MCU := at90usb1286
+endif
+FORMAT := ihex
+
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+AR = avr-ar rcs
+NM = avr-nm
+COPY = cp
+
+
+SRC := $(OBJ:%.o=%.c)
+
+.PHONY: clean cleanall distclean program
+
+ELFFILE := $(NAME).elf
+
+all: $(ELFFILE)
+
+%.d: %.c
+ @set -e; rm -f $@; \
+ $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$; echo '(re)building $@'
+
+ifneq ($(MAKECMDGOALS),distclean)
+-include $(SRC:%.c=%.d)
+endif
+
+$(ELFFILE): $(OBJ)
+ $(CC) $(OBJ) -o $@ $(LDFLAGS)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $<
+
+
+strip: $(ELFFILE)
+ $(STRIP) -s $(ELFFILE)
+
+distclean: cleanall
+ find . -name *.o -exec rm -f {} \;
+ find . -name "*.\~*" -exec rm -rf {} \;
+ rm -f include.mk
+ rm -f version.h
+ rm -f tun.c
+
+clean:
+ rm -f *.o
+ rm -f *.d
+ rm -f *.d.*
+ rm -f $(ELFFILE)
+
+program: $(ELFFILE)
+ $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $(ELFFILE:%.elf=%.hex)
+ teensy_loader_cli -mmcu=$(MCU) -w -v $@
+