| 
									
										
										
										
											2008-07-09 20:47:12 +00:00
										 |  |  | # 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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-25 21:21:51 +00:00
										 |  |  | # Options:
 | 
					
						
							|  |  |  | HWOBJECTS = modelibmmodelm.o | 
					
						
							|  |  |  | #HWOBJECTS = modelsuntype5.o
 | 
					
						
							| 
									
										
										
										
											2008-07-09 20:47:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-25 21:21:51 +00:00
										 |  |  | 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) | 
					
						
							| 
									
										
										
										
											2008-07-09 20:47:12 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # 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 | 
					
						
							| 
									
										
										
										
											2008-10-25 23:33:11 +00:00
										 |  |  | 	$(AVRDUDE) -U lfuse:w:0xCF:m -U hfuse:w:0xD8:m | 
					
						
							| 
									
										
										
										
											2008-07-09 20:47:12 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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 |