Subversion Repositories svnkaklik

Rev

Rev 509 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
507 kaklik 1
 
2
NAME := gpsrl
3
HEX := $(NAME).hex
4
OUT := $(NAME).out
5
MAP := $(NAME).map
6
SOURCES := $(wildcard *.c)
7
HEADERS := $(wildcard *.h)
8
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
9
 
509 kaklik 10
MCU := atmega64
11
MCU_AVRDUDE := m64
507 kaklik 12
 
13
CC := avr-gcc
14
OBJCOPY := avr-objcopy
15
SIZE := avr-size -A
16
DOXYGEN := doxygen
17
 
18
CFLAGS := -Wall -pedantic -mmcu=$(MCU) -std=c99 -g -Os
19
 
20
all: $(HEX)
21
 
22
clean:
23
	rm -f $(HEX) $(OUT) $(MAP) $(OBJECTS)
24
	rm -rf doc/html
25
 
26
flash: $(HEX)
27
	avrdude -y -p $(MCU_AVRDUDE) -P /dev/ttyUSB0 -c stk500v2 -U flash:w:$(HEX)
28
 
29
$(HEX): $(OUT)
30
	$(OBJCOPY) -R .eeprom -O ihex $< $@
31
 
32
$(OUT): $(OBJECTS)
33
	$(CC) $(CFLAGS) -o $@ -Wl,-Map,$(MAP) $^
34
	@echo
35
	@$(SIZE) $@
36
	@echo
37
 
38
%.o: %.c $(HEADERS)
39
	$(CC) $(CFLAGS) -c -o $@ $<
40
 
41
%.pp: %.c
42
	$(CC) $(CFLAGS) -E -o $@ $<
43
 
44
%.ppo: %.c
45
	$(CC) $(CFLAGS) -E $<
46
 
47
doc: $(HEADERS) $(SOURCES) Doxyfile
48
	$(DOXYGEN) Doxyfile
49
 
50
.PHONY: all clean flash doc
51