Rev 772 | Rev 1197 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
902 | - | 1 | #/**************************************************************************** |
2 | # * Copyright (C) 2009-2011 by Claas Anders "CaScAdE" Rathje * |
||
3 | # * admiralcascade@gmail.com * |
||
4 | # * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
||
5 | # * * |
||
6 | # * This program is free software; you can redistribute it and/or modify * |
||
7 | # * it under the terms of the GNU General Public License as published by * |
||
8 | # * the Free Software Foundation; either version 2 of the License. * |
||
9 | # * * |
||
10 | # * This program is distributed in the hope that it will be useful, * |
||
11 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
12 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
13 | # * GNU General Public License for more details. * |
||
14 | # * * |
||
15 | # * You should have received a copy of the GNU General Public License * |
||
16 | # * along with this program; if not, write to the * |
||
17 | # * Free Software Foundation, Inc., * |
||
18 | # * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
19 | # ****************************************************************************/ |
||
321 | cascade | 20 | |
902 | - | 21 | |
321 | cascade | 22 | ## General Flags |
23 | PROJECT = C-OSD |
||
24 | MCU = atmega162 |
||
25 | TARGET = C-OSD.elf |
||
26 | CC = avr-gcc |
||
27 | |||
28 | ## Options common to compile, link and assembly rules |
||
29 | COMMON = -mmcu=$(MCU) |
||
30 | |||
31 | ## Compile options common for all C compilation units. |
||
456 | cascade | 32 | CFLAGS += $(COMMON) |
738 | cascade | 33 | ##CFLAGS += -fno-common |
757 | cascade | 34 | CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
346 | cascade | 35 | CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d |
321 | cascade | 36 | |
37 | ## Assembly specific flags |
||
38 | ASMFLAGS = $(COMMON) |
||
39 | ASMFLAGS += $(CFLAGS) |
||
40 | ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 |
||
41 | |||
42 | ## Linker flags |
||
43 | LDFLAGS = $(COMMON) |
||
44 | LDFLAGS += -Wl,-Map=C-OSD.map |
||
45 | |||
46 | |||
47 | ## Intel Hex file production flags |
||
48 | HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature |
||
49 | |||
50 | HEX_EEPROM_FLAGS = -j .eeprom |
||
51 | HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" |
||
52 | HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings |
||
53 | |||
54 | |||
55 | ## Objects that must be built in order to link |
||
772 | - | 56 | OBJECTS = main.o usart0.o usart1.o max7456_software_spi.o osd_helpers.o config.o spi.o buttons.o ppm.o osd_ncmode_default.o osd_ncmode_minimal.o osd_fcmode_default.o osd_fcmode_jopl.o characters.o |
321 | cascade | 57 | |
58 | ## Objects explicitly added by the user |
||
346 | cascade | 59 | LINKONLYOBJECTS = |
321 | cascade | 60 | |
61 | ## Build |
||
62 | all: $(TARGET) C-OSD.hex C-OSD.eep C-OSD.lss size |
||
63 | |||
64 | ## Compile |
||
65 | main.o: ../main.c |
||
66 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
67 | |||
346 | cascade | 68 | usart1.o: ../usart1.c |
69 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
349 | cascade | 70 | |
772 | - | 71 | usart0.o: ../usart0.c |
72 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
73 | |||
346 | cascade | 74 | max7456_software_spi.o: ../max7456_software_spi.c |
75 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
349 | cascade | 76 | |
389 | cascade | 77 | osd_helpers.o: ../osd_helpers.c |
78 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
477 | cascade | 79 | |
471 | cascade | 80 | config.o: ../config.c |
81 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
389 | cascade | 82 | |
471 | cascade | 83 | spi.o: ../spi.c |
84 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
477 | cascade | 85 | |
471 | cascade | 86 | buttons.o: ../buttons.c |
87 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
88 | |||
477 | cascade | 89 | ppm.o: ../ppm.c |
90 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
514 | cascade | 91 | |
497 | cascade | 92 | osd_ncmode_default.o: ../osd_ncmode_default.c |
93 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
514 | cascade | 94 | |
497 | cascade | 95 | osd_ncmode_minimal.o: ../osd_ncmode_minimal.c |
96 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
477 | cascade | 97 | |
497 | cascade | 98 | osd_fcmode_default.o: ../osd_fcmode_default.c |
99 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
685 | cascade | 100 | |
101 | osd_fcmode_jopl.o: ../osd_fcmode_jopl.c |
||
102 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
514 | cascade | 103 | |
104 | characters.o: ../characters.c |
||
105 | $(CC) $(INCLUDES) $(CFLAGS) -c $< |
||
497 | cascade | 106 | |
321 | cascade | 107 | ##Link |
108 | $(TARGET): $(OBJECTS) |
||
109 | $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) |
||
110 | |||
111 | %.hex: $(TARGET) |
||
112 | avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ |
||
113 | |||
114 | %.eep: $(TARGET) |
||
115 | -avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0 |
||
116 | |||
117 | %.lss: $(TARGET) |
||
118 | avr-objdump -h -S $< > $@ |
||
119 | |||
120 | size: ${TARGET} |
||
121 | @echo |
||
122 | @avr-size -C --mcu=${MCU} ${TARGET} |
||
123 | |||
124 | ## Clean target |
||
125 | .PHONY: clean |
||
126 | clean: |
||
127 | -rm -rf $(OBJECTS) C-OSD.elf dep/* C-OSD.hex C-OSD.eep C-OSD.lss C-OSD.map |
||
128 | |||
129 | |||
130 | ## Other dependencies |
||
685 | cascade | 131 | -include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) |