2008-07-16 07:44:45 +02:00
|
|
|
# $Id: Makefile,v 1.1 2008/07/16 05:44:45 rschaten Exp $
|
|
|
|
|
|
|
|
# microcontroller settings
|
|
|
|
F_CPU = 1000000UL
|
|
|
|
MCU = atmega8
|
|
|
|
|
|
|
|
# usb programmer:
|
|
|
|
AVRDUDE = avrdude -p $(MCU) -c avrispv2 -P usb -B 10
|
|
|
|
|
|
|
|
COMPILE = avr-gcc -Wall -Os -std=c99 -I../common -I. -mmcu=$(MCU) -DF_CPU=$(F_CPU) -Wa,-ahlms=$(<:.c=.lst) #-DDEBUG_LEVEL=2
|
|
|
|
|
|
|
|
OBJECTS = main.o twislave.o
|
|
|
|
|
|
|
|
TODAY=`date "+%y%m%d"`
|
|
|
|
DIR=`basename \`pwd\``
|
|
|
|
PACKETNAME=$(DIR)_$(TODAY)
|
|
|
|
|
|
|
|
all: usage
|
|
|
|
|
|
|
|
usage:
|
|
|
|
@echo "Usage of this makefile:"
|
|
|
|
@echo "make firmware create firmware"
|
|
|
|
@echo "make program send firmware to the device"
|
|
|
|
@echo "make fuses set fuses of the device"
|
|
|
|
@echo "make docs create documentation"
|
|
|
|
@echo "make tarball packs a tarball for shipping"
|
|
|
|
@echo "make clean tidy the directory"
|
|
|
|
@echo
|
|
|
|
@echo "For further information, consult the documentation in Readme.txt."
|
|
|
|
|
|
|
|
# symbolic targets:
|
|
|
|
firmware: main.hex
|
|
|
|
cp main.hex main_$(TODAY).hex
|
|
|
|
|
|
|
|
.c.o:
|
|
|
|
$(COMPILE) -c $< -o $@
|
|
|
|
|
|
|
|
.c.s:
|
|
|
|
$(COMPILE) -S $< -o $@
|
|
|
|
|
|
|
|
program: firmware
|
|
|
|
$(AVRDUDE) -U flash:w:main.hex
|
|
|
|
|
|
|
|
fuses:
|
|
|
|
$(AVRDUDE) -u -U hfuse:w:0x99:m -U lfuse:w:0xc1:m
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o main.s *.lst main.hex
|
|
|
|
rm -rf htmldoc latexdoc Readme.txt refman.pdf
|
|
|
|
rm -f $(PACKETNAME).tar.gz
|
|
|
|
|
|
|
|
# file targets:
|
|
|
|
main.bin: $(OBJECTS)
|
|
|
|
$(COMPILE) -o main.bin $(OBJECTS)
|
|
|
|
|
|
|
|
main.hex: main.bin
|
|
|
|
rm -f main.hex main.eep.hex
|
|
|
|
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
|
|
|
|
avr-size main.hex
|
|
|
|
|
|
|
|
# doc generation
|
|
|
|
docs: readme pdf
|
|
|
|
@echo "documentation created"
|
|
|
|
|
|
|
|
readme: doxygen
|
|
|
|
echo "This file is auto-generated from the content of <main.c>." > Readme.txt
|
|
|
|
echo "You'll have more fun if you read the HTML-content in htmldoc or the PDF." >> Readme.txt
|
|
|
|
echo >> Readme.txt
|
|
|
|
lynx -dump htmldoc/main.html >> Readme.txt
|
|
|
|
|
|
|
|
pdf: doxygen
|
|
|
|
make -C latexdoc
|
|
|
|
mv latexdoc/refman.pdf .
|
|
|
|
rm -rf latexdoc
|
|
|
|
|
|
|
|
doxygen:
|
|
|
|
doxygen project.doxygen
|
|
|
|
|
|
|
|
circuitpdf:
|
|
|
|
@echo "converting circuits to pdf"
|
|
|
|
for i in circuit/*.ps; do ps2pdf -sPAPERSIZE=a4 $$i $$(echo $$i | sed -e "s/\.ps$$/.pdf/"); done
|
|
|
|
|
|
|
|
tarball: firmware circuitpdf clean docs
|
|
|
|
@echo
|
|
|
|
@echo
|
|
|
|
@echo "I assume you updated the Changelog...? Press Enter to continue..."
|
|
|
|
@read
|
|
|
|
[ -e "main_$(TODAY).hex" ] || exit
|
|
|
|
rm --force $(PACKETNAME).tar.gz; \
|
|
|
|
tar --directory=.. \
|
2009-05-06 21:57:22 +02:00
|
|
|
--exclude=.svn \
|
2008-07-16 07:44:45 +02:00
|
|
|
--exclude=*.ps \
|
|
|
|
--exclude=main.hex \
|
|
|
|
--create \
|
|
|
|
--gzip \
|
|
|
|
--verbose \
|
|
|
|
--file ../$(PACKETNAME).tar.gz $(DIR)
|
|
|
|
rm -f main_$(TODAY).hex
|
|
|
|
|