# Name: Makefile # Project: HIDKeys # Author: Christian Starkjohann # Creation Date: 2006-02-02 # Tabsize: 4 # Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH # License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) # This Revision: $Id: Makefile,v 1.1 2008/07/09 20:47:12 rschaten Exp $ AVRDUDE = avrdude -p atmega32 -c usbasp # Options: DEFINES = -DMODELIBMMODELM HWOBJECTS = modelibmmodelm.o #DEFINES = -DMODELSUNTYPE5 #HWOBJECTS = modelsuntype5.o COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega32 -DF_CPU=12000000L $(DEFINES) OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o $(HWOBJECTS) # symbolic targets: all: main.hex .c.o: $(COMPILE) -std=c99 -c $< -o $@ .S.o: $(COMPILE) -x assembler-with-cpp -c $< -o $@ # "-x assembler-with-cpp" should not be necessary since this is the default # file type for the .S (with capital S) extension. However, upper case # characters are not always preserved on Windows. To ensure WinAVR # compatibility define the file type manually. .c.s: $(COMPILE) -S $< -o $@ program: all $(AVRDUDE) -U flash:w:main.hex fuses: # - enable crystal # - disable JTAG, so we can fully use PORTC $(AVRDUDE) -U lfuse:w:0xCF:m -U hfuse:w:0xD8:m clean: rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s # 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 ./checksize main.bin # do the checksize script as our last action to allow successful compilation # on Windows with WinAVR where the Unix commands will fail. disasm: main.bin avr-objdump -d main.bin cpp: $(COMPILE) -E main.c