From 814190670c7db7f7e3d3cef266f2685dbb956653 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 23 Aug 2011 20:43:18 +0000 Subject: added first (not working) version of include.mk git-svn-id: https://svn.spreadspace.org/avr/trunk@2 aa12f405-d877-488e-9caf-2d797e2a1cc7 --- include.mk | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 include.mk (limited to 'include.mk') 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 +## +## 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 . +## + +#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 $@ + -- cgit v1.2.3