Rev 1775 | Rev 1805 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1775 | Rev 1801 | ||
---|---|---|---|
1 | #-------------------------------------------------------------------- |
1 | #-------------------------------------------------------------------- |
2 | # MCU name |
2 | # MCU name |
3 | MCU = atmega644p |
3 | MCU = atmega644p |
4 | F_CPU = 20000000 |
4 | F_CPU = 20000000 |
5 | #------------------------------------------------------------------- |
5 | #------------------------------------------------------------------- |
6 | VERSION_MAJOR = 0 |
6 | VERSION_MAJOR = 0 |
7 | VERSION_MINOR = 74 |
7 | VERSION_MINOR = 74 |
8 | VERSION_PATCH = 100 |
8 | VERSION_PATCH = 100 |
9 | 9 | ||
10 | VERSION_SERIAL_MAJOR = 10 # Serial Protocol Major Version |
10 | VERSION_SERIAL_MAJOR = 10 # Serial Protocol Major Version |
11 | VERSION_SERIAL_MINOR = 1 # Serial Protocol Minor Version |
11 | VERSION_SERIAL_MINOR = 1 # Serial Protocol Minor Version |
12 | NC_SPI_COMPATIBLE = 6 # SPI Protocol Version |
12 | NC_SPI_COMPATIBLE = 6 # SPI Protocol Version |
13 | 13 | ||
14 | #------------------------------------------------------------------- |
14 | #------------------------------------------------------------------- |
15 | #OPTIONS |
15 | #OPTIONS |
16 | 16 | ||
17 | # Use one of the extensions for a gps solution |
17 | # Use one of the extensions for a gps solution |
18 | EXT = NAVICTRL |
18 | #EXT = NAVICTRL |
19 | #EXT = MK3MAG |
19 | EXT = MK3MAG |
20 | 20 | ||
21 | # Use optional one the RCs if EXT = NAVICTRL has been used |
21 | # Use optional one the RCs if EXT = NAVICTRL has been used |
22 | #RC = DSL |
22 | #RC = DSL |
23 | #RC = SPECTRUM |
23 | #RC = SPECTRUM |
24 | 24 | ||
25 | #GYRO=ENC-03_FC1.3 |
25 | #GYRO=ENC-03_FC1.3 |
26 | #GYRO_HW_NAME=ENC |
26 | #GYRO_HW_NAME=ENC |
27 | #GYRO_HW_FACTOR=1.304f |
27 | #GYRO_HW_FACTOR=1.304f |
28 | #GYRO_PITCHROLL_CORRECTION=0.83f |
28 | #GYRO_PITCHROLL_CORRECTION=0.83f |
29 | #GYRO_YAW_CORRECTION=0.93f |
29 | #GYRO_YAW_CORRECTION=0.93f |
30 | 30 | ||
31 | GYRO=ADXRS610_FC2.0 |
31 | #GYRO=ADXRS610_FC2.0 |
32 | GYRO_HW_NAME=ADXR |
32 | #GYRO_HW_NAME=ADXR |
33 | GYRO_HW_FACTOR=1.2288f |
33 | #GYRO_HW_FACTOR=1.2288f |
34 | GYRO_PITCHROLL_CORRECTION=1.0f |
34 | #GYRO_PITCHROLL_CORRECTION=1.0f |
35 | GYRO_YAW_CORRECTION=1.0f |
35 | #GYRO_YAW_CORRECTION=1.0f |
36 | 36 | ||
37 | #GYRO=invenSense |
37 | GYRO=invenSense |
38 | #GYRO_HW_NAME=Isense |
38 | GYRO_HW_NAME=Isense |
39 | #GYRO_HW_FACTOR=0.6827f |
39 | GYRO_HW_FACTOR=0.6827f |
40 | #GYRO_PITCHROLL_CORRECTION=0.93f |
40 | GYRO_PITCHROLL_CORRECTION=0.93f |
41 | #GYRO_YAW_CORRECTION=0.97f |
41 | GYRO_YAW_CORRECTION=0.97f |
42 | 42 | ||
43 | #GYRO= |
43 | #GYRO= |
44 | #GYRO=invenSense |
44 | #GYRO=invenSense |
45 | 45 | ||
46 | #------------------------------------------------------------------- |
46 | #------------------------------------------------------------------- |
47 | # get SVN revision |
47 | # get SVN revision |
48 | REV=0001 |
48 | REV=0001 |
49 | #$(shell sh -c "cat .svn/entries | sed -n '4p'") |
49 | #$(shell sh -c "cat .svn/entries | sed -n '4p'") |
50 | 50 | ||
51 | ifeq ($(MCU), atmega644) |
51 | ifeq ($(MCU), atmega644) |
52 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
52 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
53 | HEX_NAME = MEGA644_$(EXT)_$(RC)_$(GYRO) |
53 | HEX_NAME = MEGA644_$(EXT)_$(RC)_$(GYRO) |
54 | endif |
54 | endif |
55 | 55 | ||
56 | ifeq ($(MCU), atmega644p) |
56 | ifeq ($(MCU), atmega644p) |
57 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
57 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
58 | HEX_NAME = MEGA644p_$(EXT)_$(RC)_$(GYRO) |
58 | HEX_NAME = MEGA644p_$(EXT)_$(RC)_$(GYRO) |
59 | endif |
59 | endif |
60 | 60 | ||
61 | 61 | ||
62 | ifeq ($(F_CPU), 16000000) |
62 | ifeq ($(F_CPU), 16000000) |
63 | QUARZ = 16MHZ |
63 | QUARZ = 16MHZ |
64 | endif |
64 | endif |
65 | 65 | ||
66 | ifeq ($(F_CPU), 20000000) |
66 | ifeq ($(F_CPU), 20000000) |
67 | QUARZ = 20MHZ |
67 | QUARZ = 20MHZ |
68 | endif |
68 | endif |
69 | 69 | ||
70 | 70 | ||
71 | # Output format. (can be srec, ihex, binary) |
71 | # Output format. (can be srec, ihex, binary) |
72 | FORMAT = ihex |
72 | FORMAT = ihex |
73 | 73 | ||
74 | # Target file name (without extension). |
74 | # Target file name (without extension). |
75 | 75 | ||
76 | ifeq ($(VERSION_PATCH), 0) |
76 | ifeq ($(VERSION_PATCH), 0) |
77 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
77 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
78 | endif |
78 | endif |
79 | ifeq ($(VERSION_PATCH), 1) |
79 | ifeq ($(VERSION_PATCH), 1) |
80 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
80 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
81 | endif |
81 | endif |
82 | ifeq ($(VERSION_PATCH), 2) |
82 | ifeq ($(VERSION_PATCH), 2) |
83 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
83 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
84 | endif |
84 | endif |
85 | ifeq ($(VERSION_PATCH), 3) |
85 | ifeq ($(VERSION_PATCH), 3) |
86 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
86 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
87 | endif |
87 | endif |
88 | ifeq ($(VERSION_PATCH), 4) |
88 | ifeq ($(VERSION_PATCH), 4) |
89 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
89 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
90 | endif |
90 | endif |
91 | ifeq ($(VERSION_PATCH), 5) |
91 | ifeq ($(VERSION_PATCH), 5) |
92 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
92 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
93 | endif |
93 | endif |
94 | ifeq ($(VERSION_PATCH), 6) |
94 | ifeq ($(VERSION_PATCH), 6) |
95 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
95 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
96 | endif |
96 | endif |
97 | ifeq ($(VERSION_PATCH), 7) |
97 | ifeq ($(VERSION_PATCH), 7) |
98 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
98 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
99 | endif |
99 | endif |
100 | ifeq ($(VERSION_PATCH), 8) |
100 | ifeq ($(VERSION_PATCH), 8) |
101 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
101 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
102 | endif |
102 | endif |
103 | ifeq ($(VERSION_PATCH), 9) |
103 | ifeq ($(VERSION_PATCH), 9) |
104 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
104 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
105 | endif |
105 | endif |
106 | ifeq ($(VERSION_PATCH), 10) |
106 | ifeq ($(VERSION_PATCH), 10) |
107 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV) |
107 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV) |
108 | endif |
108 | endif |
109 | ifeq ($(VERSION_PATCH), 11) |
109 | ifeq ($(VERSION_PATCH), 11) |
110 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)l_SVN$(REV) |
110 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)l_SVN$(REV) |
111 | endif |
111 | endif |
112 | ifeq ($(VERSION_PATCH), 12) |
112 | ifeq ($(VERSION_PATCH), 12) |
113 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV) |
113 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV) |
114 | endif |
114 | endif |
115 | ifeq ($(VERSION_PATCH), 13) |
115 | ifeq ($(VERSION_PATCH), 13) |
116 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV) |
116 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV) |
117 | endif |
117 | endif |
118 | ifeq ($(VERSION_PATCH), 14) |
118 | ifeq ($(VERSION_PATCH), 14) |
119 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV) |
119 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV) |
120 | endif |
120 | endif |
121 | ifeq ($(VERSION_PATCH), 15) |
121 | ifeq ($(VERSION_PATCH), 15) |
122 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV) |
122 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV) |
123 | endif |
123 | endif |
124 | ifeq ($(VERSION_PATCH), 16) |
124 | ifeq ($(VERSION_PATCH), 16) |
125 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV) |
125 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV) |
126 | endif |
126 | endif |
127 | ifeq ($(VERSION_PATCH), 17) |
127 | ifeq ($(VERSION_PATCH), 17) |
128 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)r_SVN$(REV) |
128 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)r_SVN$(REV) |
129 | endif |
129 | endif |
130 | ifeq ($(VERSION_PATCH), 100) |
130 | ifeq ($(VERSION_PATCH), 100) |
131 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)df_SVN$(REV) |
131 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)df_SVN$(REV) |
132 | endif |
132 | endif |
133 | 133 | ||
134 | # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
134 | # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
135 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
135 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
136 | OPT = 2 |
136 | OPT = 2 |
137 | #OPT = s |
137 | #OPT = s |
138 | 138 | ||
139 | ########################################################################################################## |
139 | ########################################################################################################## |
140 | # List C source files here. (C dependencies are automatically generated.) |
140 | # List C source files here. (C dependencies are automatically generated.) |
141 | SRC = main.c uart0.c printf_P.c timer0.c timer2.c analog.c menu.c output.c controlMixer.c |
141 | SRC = main.c uart0.c printf_P.c timer0.c timer2.c analog.c menu.c output.c controlMixer.c |
142 | SRC += externalControl.c GPSControl.c dongfangMath.c twimaster.c rc.c attitude.c flight.c |
142 | SRC += externalControl.c GPSControl.c dongfangMath.c twimaster.c rc.c attitude.c flight.c |
143 | SRC += eeprom.c uart1.c heightControl.c configuration.c attitudeControl.c commands.c $(GYRO).c |
143 | SRC += eeprom.c uart1.c heightControl.c configuration.c attitudeControl.c commands.c $(GYRO).c |
144 | 144 | ||
145 | ifeq ($(EXT), MK3MAG) |
145 | ifeq ($(EXT), MK3MAG) |
146 | SRC += mk3mag.c gps.c ubx.c |
146 | SRC += mk3mag.c gps.c ubx.c |
147 | #mymath.c |
147 | #mymath.c |
148 | endif |
148 | endif |
149 | ifeq ($(EXT), NAVICTRL) |
149 | ifeq ($(EXT), NAVICTRL) |
150 | SRC += spi.c |
150 | SRC += spi.c |
151 | ifeq ($(RC), DSL) |
151 | ifeq ($(RC), DSL) |
152 | SRC += dsl.c |
152 | SRC += dsl.c |
153 | endif |
153 | endif |
154 | ifeq ($(RC), SPECTRUM) |
154 | ifeq ($(RC), SPECTRUM) |
155 | SRC += spectrum.c |
155 | SRC += spectrum.c |
156 | endif |
156 | endif |
157 | endif |
157 | endif |
158 | ########################################################################################################## |
158 | ########################################################################################################## |
159 | 159 | ||
160 | # List Assembler source files here. |
160 | # List Assembler source files here. |
161 | # Make them always end in a capital .S. Files ending in a lowercase .s |
161 | # Make them always end in a capital .S. Files ending in a lowercase .s |
162 | # will not be considered source files but generated files (assembler |
162 | # will not be considered source files but generated files (assembler |
163 | # output from the compiler), and will be deleted upon "make clean"! |
163 | # output from the compiler), and will be deleted upon "make clean"! |
164 | # Even though the DOS/Win* filesystem matches both .s and .S the same, |
164 | # Even though the DOS/Win* filesystem matches both .s and .S the same, |
165 | # it will preserve the spelling of the filenames, and gcc itself does |
165 | # it will preserve the spelling of the filenames, and gcc itself does |
166 | # care about how the name is spelled on its command-line. |
166 | # care about how the name is spelled on its command-line. |
167 | ASRC = |
167 | ASRC = |
168 | 168 | ||
169 | # List any extra directories to look for include files here. |
169 | # List any extra directories to look for include files here. |
170 | # Each directory must be seperated by a space. |
170 | # Each directory must be seperated by a space. |
171 | EXTRAINCDIRS = |
171 | EXTRAINCDIRS = |
172 | 172 | ||
173 | 173 | ||
174 | # Optional compiler flags. |
174 | # Optional compiler flags. |
175 | # -g: generate debugging information (for GDB, or for COFF conversion) |
175 | # -g: generate debugging information (for GDB, or for COFF conversion) |
176 | # -O*: optimization level |
176 | # -O*: optimization level |
177 | # -f...: tuning, see gcc manual and avr-libc documentation |
177 | # -f...: tuning, see gcc manual and avr-libc documentation |
178 | # -Wall...: warning level |
178 | # -Wall...: warning level |
179 | # -Wa,...: tell GCC to pass this to the assembler. |
179 | # -Wa,...: tell GCC to pass this to the assembler. |
180 | # -ahlms: create assembler listing |
180 | # -ahlms: create assembler listing |
181 | CFLAGS = -O$(OPT) \ |
181 | CFLAGS = -O$(OPT) \ |
182 | -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
182 | -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
183 | -Wall -Wstrict-prototypes \ |
183 | -Wall -Wstrict-prototypes \ |
184 | -DGYRO=$(GYRO) \ |
184 | -DGYRO=$(GYRO) \ |
185 | -Wa,-adhlns=$(<:.c=.lst) \ |
185 | -Wa,-adhlns=$(<:.c=.lst) \ |
186 | $(patsubst %,-I%,$(EXTRAINCDIRS)) |
186 | $(patsubst %,-I%,$(EXTRAINCDIRS)) |
187 | 187 | ||
188 | 188 | ||
189 | # Set a "language standard" compiler flag. |
189 | # Set a "language standard" compiler flag. |
190 | # Unremark just one line below to set the language standard to use. |
190 | # Unremark just one line below to set the language standard to use. |
191 | # gnu99 = C99 + GNU extensions. See GCC manual for more information. |
191 | # gnu99 = C99 + GNU extensions. See GCC manual for more information. |
192 | #CFLAGS += -std=c89 |
192 | #CFLAGS += -std=c89 |
193 | #CFLAGS += -std=gnu89 |
193 | #CFLAGS += -std=gnu89 |
194 | #CFLAGS += -std=c99 |
194 | #CFLAGS += -std=c99 |
195 | CFLAGS += -std=gnu99 |
195 | CFLAGS += -std=gnu99 |
196 | 196 | ||
197 | CFLAGS += -DF_CPU=$(F_CPU) -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DNC_SPI_COMPATIBLE=$(NC_SPI_COMPATIBLE) -DGYRO_HW_NAME=${GYRO_HW_NAME} -DGYRO_HW_FACTOR=${GYRO_HW_FACTOR} -DGYRO_PITCHROLL_CORRECTION=${GYRO_PITCHROLL_CORRECTION} -DGYRO_YAW_CORRECTION=${GYRO_YAW_CORRECTION} |
197 | CFLAGS += -DF_CPU=$(F_CPU) -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DNC_SPI_COMPATIBLE=$(NC_SPI_COMPATIBLE) -DGYRO_HW_NAME=${GYRO_HW_NAME} -DGYRO_HW_FACTOR=${GYRO_HW_FACTOR} -DGYRO_PITCHROLL_CORRECTION=${GYRO_PITCHROLL_CORRECTION} -DGYRO_YAW_CORRECTION=${GYRO_YAW_CORRECTION} |
198 | 198 | ||
199 | ifeq ($(EXT), MK3MAG) |
199 | ifeq ($(EXT), MK3MAG) |
200 | CFLAGS += -DUSE_MK3MAG |
200 | CFLAGS += -DUSE_MK3MAG |
201 | endif |
201 | endif |
202 | ifeq ($(EXT), NAVICTRL) |
202 | ifeq ($(EXT), NAVICTRL) |
203 | CFLAGS += -DUSE_NAVICTRL |
203 | CFLAGS += -DUSE_NAVICTRL |
204 | ifeq ($(RC), DSL) |
204 | ifeq ($(RC), DSL) |
205 | CFLAGS += -DUSE_RC_DSL |
205 | CFLAGS += -DUSE_RC_DSL |
206 | endif |
206 | endif |
207 | ifeq ($(RC), SPECTRUM) |
207 | ifeq ($(RC), SPECTRUM) |
208 | CFLAGS += -DUSE_RC_SPECTRUM |
208 | CFLAGS += -DUSE_RC_SPECTRUM |
209 | endif |
209 | endif |
210 | endif |
210 | endif |
211 | 211 | ||
212 | ifeq ($(SETUP), QUADRO) |
212 | ifeq ($(SETUP), QUADRO) |
213 | CFLAGS += -DUSE_QUADRO |
213 | CFLAGS += -DUSE_QUADRO |
214 | endif |
214 | endif |
215 | ifeq ($(SETUP), OCTO) |
215 | ifeq ($(SETUP), OCTO) |
216 | CFLAGS += -DUSE_OCTO |
216 | CFLAGS += -DUSE_OCTO |
217 | endif |
217 | endif |
218 | ifeq ($(SETUP), OCTO2) |
218 | ifeq ($(SETUP), OCTO2) |
219 | CFLAGS += -DUSE_OCTO2 |
219 | CFLAGS += -DUSE_OCTO2 |
220 | endif |
220 | endif |
221 | ifeq ($(SETUP), OCTO3) |
221 | ifeq ($(SETUP), OCTO3) |
222 | CFLAGS += -DUSE_OCTO3 |
222 | CFLAGS += -DUSE_OCTO3 |
223 | endif |
223 | endif |
224 | 224 | ||
225 | 225 | ||
226 | # Optional assembler flags. |
226 | # Optional assembler flags. |
227 | # -Wa,...: tell GCC to pass this to the assembler. |
227 | # -Wa,...: tell GCC to pass this to the assembler. |
228 | # -ahlms: create listing |
228 | # -ahlms: create listing |
229 | # -gstabs: have the assembler create line number information; note that |
229 | # -gstabs: have the assembler create line number information; note that |
230 | # for use in COFF files, additional information about filenames |
230 | # for use in COFF files, additional information about filenames |
231 | # and function names needs to be present in the assembler source |
231 | # and function names needs to be present in the assembler source |
232 | # files -- see avr-libc docs [FIXME: not yet described there] |
232 | # files -- see avr-libc docs [FIXME: not yet described there] |
233 | ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
233 | ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
234 | 234 | ||
235 | 235 | ||
236 | 236 | ||
237 | # Optional linker flags. |
237 | # Optional linker flags. |
238 | # -Wl,...: tell GCC to pass this to linker. |
238 | # -Wl,...: tell GCC to pass this to linker. |
239 | # -Map: create map file |
239 | # -Map: create map file |
240 | # --cref: add cross reference to map file |
240 | # --cref: add cross reference to map file |
241 | LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
241 | LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
242 | 242 | ||
243 | # Additional libraries |
243 | # Additional libraries |
244 | 244 | ||
245 | # Minimalistic printf version |
245 | # Minimalistic printf version |
246 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
246 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
247 | 247 | ||
248 | # Floating point printf version (requires -lm below) |
248 | # Floating point printf version (requires -lm below) |
249 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
249 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
250 | 250 | ||
251 | # -lm = math library |
251 | # -lm = math library |
252 | LDFLAGS += -lm |
252 | LDFLAGS += -lm |
253 | 253 | ||
254 | 254 | ||
255 | ##LDFLAGS += -T./linkerfile/avr5.x |
255 | ##LDFLAGS += -T./linkerfile/avr5.x |
256 | - | ||
257 | 256 | ||
258 | 257 | ||
259 | # Programming support using avrdude. Settings and variables. |
258 | # Programming support using avrdude. Settings and variables. |
260 | 259 | ||
261 | # Programming hardware: alf avr910 avrisp bascom bsd |
260 | # Programming hardware: alf avr910 avrisp bascom bsd |
262 | # dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
261 | # dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
263 | # |
262 | # |
264 | # Type: avrdude -c ? |
263 | # Type: avrdude -c ? |
265 | # to get a full listing. |
264 | # to get a full listing. |
266 | # |
265 | # |
267 | #AVRDUDE_PROGRAMMER = dt006 |
266 | #AVRDUDE_PROGRAMMER = dt006 |
268 | #AVRDUDE_PROGRAMMER = stk200 |
267 | #AVRDUDE_PROGRAMMER = stk200 |
269 | #AVRDUDE_PROGRAMMER = ponyser |
268 | #AVRDUDE_PROGRAMMER = ponyser |
270 | AVRDUDE_PROGRAMMER = avrispv2 |
269 | AVRDUDE_PROGRAMMER = avrispv2 |
271 | #falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden |
270 | #falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden |
272 | 271 | ||
273 | #AVRDUDE_PORT = com1 # programmer connected to serial device |
272 | #AVRDUDE_PORT = com1 # programmer connected to serial device |
274 | #AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
273 | #AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
275 | AVRDUDE_PORT = usb # programmer connected to USB |
274 | AVRDUDE_PORT = usb # programmer connected to USB |
276 | 275 | ||
277 | #AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
276 | #AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
278 | AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS) |
277 | AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS) |
279 | #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
278 | #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
280 | 279 | ||
281 | #avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex |
280 | #avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex |
282 | AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
281 | AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
283 | 282 | ||
284 | # Uncomment the following if you want avrdude's erase cycle counter. |
283 | # Uncomment the following if you want avrdude's erase cycle counter. |
285 | # Note that this counter needs to be initialized first using -Yn, |
284 | # Note that this counter needs to be initialized first using -Yn, |
286 | # see avrdude manual. |
285 | # see avrdude manual. |
287 | #AVRDUDE_ERASE += -y |
286 | #AVRDUDE_ERASE += -y |
288 | 287 | ||
289 | # Uncomment the following if you do /not/ wish a verification to be |
288 | # Uncomment the following if you do /not/ wish a verification to be |
290 | # performed after programming the device. |
289 | # performed after programming the device. |
291 | AVRDUDE_FLAGS += -V |
290 | AVRDUDE_FLAGS += -V |
292 | 291 | ||
293 | # Increase verbosity level. Please use this when submitting bug |
292 | # Increase verbosity level. Please use this when submitting bug |
294 | # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
293 | # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
295 | # to submit bug reports. |
294 | # to submit bug reports. |
296 | #AVRDUDE_FLAGS += -v -v |
295 | #AVRDUDE_FLAGS += -v -v |
297 | 296 | ||
298 | # --------------------------------------------------------------------------- |
297 | # --------------------------------------------------------------------------- |
299 | # Define directories, if needed. |
298 | # Define directories, if needed. |
300 | DIRAVR = c:/winavr |
299 | DIRAVR = c:/winavr |
301 | DIRAVRBIN = $(DIRAVR)/bin |
300 | DIRAVRBIN = $(DIRAVR)/bin |
302 | DIRAVRUTILS = $(DIRAVR)/utils/bin |
301 | DIRAVRUTILS = $(DIRAVR)/utils/bin |
303 | DIRINC = . |
302 | DIRINC = . |
304 | DIRLIB = $(DIRAVR)/avr/lib |
303 | DIRLIB = $(DIRAVR)/avr/lib |
305 | 304 | ||
306 | 305 | ||
307 | # Define programs and commands. |
306 | # Define programs and commands. |
308 | SHELL = sh |
307 | SHELL = sh |
309 | 308 | ||
310 | CC = avr-gcc |
309 | CC = avr-gcc |
311 | 310 | ||
312 | OBJCOPY = avr-objcopy |
311 | OBJCOPY = avr-objcopy |
313 | OBJDUMP = avr-objdump |
312 | OBJDUMP = avr-objdump |
314 | SIZE = avr-size |
313 | SIZE = avr-size |
315 | 314 | ||
316 | # Programming support using avrdude. |
315 | # Programming support using avrdude. |
317 | AVRDUDE = avrdude |
316 | AVRDUDE = avrdude |
318 | 317 | ||
319 | REMOVE = rm -f |
318 | REMOVE = rm -f |
320 | COPY = cp |
319 | COPY = cp |
321 | 320 | ||
322 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
321 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
323 | ELFSIZE = $(SIZE) -A $(TARGET).elf |
322 | ELFSIZE = $(SIZE) -A $(TARGET).elf |
324 | 323 | ||
325 | # Define Messages |
324 | # Define Messages |
326 | # English |
325 | # English |
327 | MSG_ERRORS_NONE = Errors: none |
326 | MSG_ERRORS_NONE = Errors: none |
328 | MSG_BEGIN = -------- begin -------- |
327 | MSG_BEGIN = -------- begin -------- |
329 | MSG_END = -------- end -------- |
328 | MSG_END = -------- end -------- |
330 | MSG_SIZE_BEFORE = Size before: |
329 | MSG_SIZE_BEFORE = Size before: |
331 | MSG_SIZE_AFTER = Size after: |
330 | MSG_SIZE_AFTER = Size after: |
332 | MSG_COFF = Converting to AVR COFF: |
331 | MSG_COFF = Converting to AVR COFF: |
333 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
332 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
334 | MSG_FLASH = Creating load file for Flash: |
333 | MSG_FLASH = Creating load file for Flash: |
335 | MSG_EEPROM = Creating load file for EEPROM: |
334 | MSG_EEPROM = Creating load file for EEPROM: |
336 | MSG_EXTENDED_LISTING = Creating Extended Listing: |
335 | MSG_EXTENDED_LISTING = Creating Extended Listing: |
337 | MSG_SYMBOL_TABLE = Creating Symbol Table: |
336 | MSG_SYMBOL_TABLE = Creating Symbol Table: |
338 | MSG_LINKING = Linking: |
337 | MSG_LINKING = Linking: |
339 | MSG_COMPILING = Compiling: |
338 | MSG_COMPILING = Compiling: |
340 | MSG_ASSEMBLING = Assembling: |
339 | MSG_ASSEMBLING = Assembling: |
341 | MSG_CLEANING = Cleaning project: |
340 | MSG_CLEANING = Cleaning project: |
342 | 341 | ||
343 | 342 | ||
344 | # Define all object files. |
343 | # Define all object files. |
345 | OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
344 | OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
346 | 345 | ||
347 | # Define all listing files. |
346 | # Define all listing files. |
348 | LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
347 | LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
349 | 348 | ||
350 | # Combine all necessary flags and optional flags. |
349 | # Combine all necessary flags and optional flags. |
351 | # Add target processor to flags. |
350 | # Add target processor to flags. |
352 | #ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS) |
351 | #ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS) |
353 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
352 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
354 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
353 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
355 | 354 | ||
356 | 355 | ||
357 | # Default target. |
356 | # Default target. |
358 | all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
357 | all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
359 | $(TARGET).lss $(TARGET).sym sizeafter finished end |
358 | $(TARGET).lss $(TARGET).sym sizeafter finished end |
360 | 359 | ||
361 | 360 | ||
362 | # Eye candy. |
361 | # Eye candy. |
363 | # AVR Studio 3.x does not check make's exit code but relies on |
362 | # AVR Studio 3.x does not check make's exit code but relies on |
364 | # the following magic strings to be generated by the compile job. |
363 | # the following magic strings to be generated by the compile job. |
365 | begin: |
364 | begin: |
366 | @echo |
365 | @echo |
367 | @echo $(MSG_BEGIN) |
366 | @echo $(MSG_BEGIN) |
368 | 367 | ||
369 | finished: |
368 | finished: |
370 | @echo $(MSG_ERRORS_NONE) |
369 | @echo $(MSG_ERRORS_NONE) |
371 | 370 | ||
372 | end: |
371 | end: |
373 | @echo $(MSG_END) |
372 | @echo $(MSG_END) |
374 | @echo |
373 | @echo |
375 | 374 | ||
376 | 375 | ||
377 | # Display size of file. |
376 | # Display size of file. |
378 | sizebefore: |
377 | sizebefore: |
379 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
378 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
380 | 379 | ||
381 | sizeafter: |
380 | sizeafter: |
382 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
381 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
383 | 382 | ||
384 | 383 | ||
385 | 384 | ||
386 | # Display compiler version information. |
385 | # Display compiler version information. |
387 | gccversion : |
386 | gccversion : |
388 | @$(CC) --version |
387 | @$(CC) --version |
389 | 388 | ||
390 | 389 | ||
391 | # Convert ELF to COFF for use in debugging / simulating in |
390 | # Convert ELF to COFF for use in debugging / simulating in |
392 | # AVR Studio or VMLAB. |
391 | # AVR Studio or VMLAB. |
393 | COFFCONVERT=$(OBJCOPY) --debugging \ |
392 | COFFCONVERT=$(OBJCOPY) --debugging \ |
394 | --change-section-address .data-0x800000 \ |
393 | --change-section-address .data-0x800000 \ |
395 | --change-section-address .bss-0x800000 \ |
394 | --change-section-address .bss-0x800000 \ |
396 | --change-section-address .noinit-0x800000 \ |
395 | --change-section-address .noinit-0x800000 \ |
397 | --change-section-address .eeprom-0x810000 |
396 | --change-section-address .eeprom-0x810000 |
398 | 397 | ||
399 | 398 | ||
400 | coff: $(TARGET).elf |
399 | coff: $(TARGET).elf |
401 | @echo |
400 | @echo |
402 | @echo $(MSG_COFF) $(TARGET).cof |
401 | @echo $(MSG_COFF) $(TARGET).cof |
403 | $(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
402 | $(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
404 | 403 | ||
405 | 404 | ||
406 | extcoff: $(TARGET).elf |
405 | extcoff: $(TARGET).elf |
407 | @echo |
406 | @echo |
408 | @echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
407 | @echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
409 | $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
408 | $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
410 | 409 | ||
411 | 410 | ||
412 | 411 | ||
413 | 412 | ||
414 | # Program the device. |
413 | # Program the device. |
415 | program: $(TARGET).hex $(TARGET).eep |
414 | program: $(TARGET).hex $(TARGET).eep |
416 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
415 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
417 | 416 | ||
418 | 417 | ||
419 | 418 | ||
420 | 419 | ||
421 | # Create final output files (.hex, .eep) from ELF output file. |
420 | # Create final output files (.hex, .eep) from ELF output file. |
422 | %.hex: %.elf |
421 | %.hex: %.elf |
423 | @echo |
422 | @echo |
424 | @echo $(MSG_FLASH) $@ |
423 | @echo $(MSG_FLASH) $@ |
425 | $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
424 | $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
426 | 425 | ||
427 | %.eep: %.elf |
426 | %.eep: %.elf |
428 | @echo |
427 | @echo |
429 | @echo $(MSG_EEPROM) $@ |
428 | @echo $(MSG_EEPROM) $@ |
430 | -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
429 | -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
431 | --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
430 | --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
432 | 431 | ||
433 | # Create extended listing file from ELF output file. |
432 | # Create extended listing file from ELF output file. |
434 | %.lss: %.elf |
433 | %.lss: %.elf |
435 | @echo |
434 | @echo |
436 | @echo $(MSG_EXTENDED_LISTING) $@ |
435 | @echo $(MSG_EXTENDED_LISTING) $@ |
437 | $(OBJDUMP) -h -S $< > $@ |
436 | $(OBJDUMP) -h -S $< > $@ |
438 | 437 | ||
439 | # Create a symbol table from ELF output file. |
438 | # Create a symbol table from ELF output file. |
440 | %.sym: %.elf |
439 | %.sym: %.elf |
441 | @echo |
440 | @echo |
442 | @echo $(MSG_SYMBOL_TABLE) $@ |
441 | @echo $(MSG_SYMBOL_TABLE) $@ |
443 | avr-nm -n $< > $@ |
442 | avr-nm -n $< > $@ |
444 | 443 | ||
445 | 444 | ||
446 | 445 | ||
447 | # Link: create ELF output file from object files. |
446 | # Link: create ELF output file from object files. |
448 | .SECONDARY : $(TARGET).elf |
447 | .SECONDARY : $(TARGET).elf |
449 | .PRECIOUS : $(OBJ) |
448 | .PRECIOUS : $(OBJ) |
450 | %.elf: $(OBJ) |
449 | %.elf: $(OBJ) |
451 | @echo |
450 | @echo |
452 | @echo $(MSG_LINKING) $@ |
451 | @echo $(MSG_LINKING) $@ |
453 | $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
452 | $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
454 | 453 | ||
455 | 454 | ||
456 | # Compile: create object files from C source files. |
455 | # Compile: create object files from C source files. |
457 | %.o : %.c |
456 | %.o : %.c |
458 | @echo |
457 | @echo |
459 | @echo $(MSG_COMPILING) $< |
458 | @echo $(MSG_COMPILING) $< |
460 | $(CC) -c $(ALL_CFLAGS) $< -o $@ |
459 | $(CC) -c $(ALL_CFLAGS) $< -o $@ |
461 | 460 | ||
462 | 461 | ||
463 | # Compile: create assembler files from C source files. |
462 | # Compile: create assembler files from C source files. |
464 | %.s : %.c |
463 | %.s : %.c |
465 | $(CC) -S $(ALL_CFLAGS) $< -o $@ |
464 | $(CC) -S $(ALL_CFLAGS) $< -o $@ |
466 | 465 | ||
467 | 466 | ||
468 | # Assemble: create object files from assembler source files. |
467 | # Assemble: create object files from assembler source files. |
469 | %.o : %.S |
468 | %.o : %.S |
470 | @echo |
469 | @echo |
471 | @echo $(MSG_ASSEMBLING) $< |
470 | @echo $(MSG_ASSEMBLING) $< |
472 | $(CC) -c $(ALL_ASFLAGS) $< -o $@ |
471 | $(CC) -c $(ALL_ASFLAGS) $< -o $@ |
473 | 472 | ||
474 | 473 | ||
475 | 474 | ||
476 | 475 | ||
477 | 476 | ||
478 | 477 | ||
479 | # Target: clean project. |
478 | # Target: clean project. |
480 | clean: begin clean_list finished end |
479 | clean: begin clean_list finished end |
481 | 480 | ||
482 | clean_list : |
481 | clean_list : |
483 | @echo |
482 | @echo |
484 | @echo $(MSG_CLEANING) |
483 | @echo $(MSG_CLEANING) |
485 | # $(REMOVE) $(TARGET).hex |
484 | # $(REMOVE) $(TARGET).hex |
486 | $(REMOVE) $(TARGET).eep |
485 | $(REMOVE) $(TARGET).eep |
487 | $(REMOVE) $(TARGET).obj |
486 | $(REMOVE) $(TARGET).obj |
488 | $(REMOVE) $(TARGET).cof |
487 | $(REMOVE) $(TARGET).cof |
489 | $(REMOVE) $(TARGET).elf |
488 | $(REMOVE) $(TARGET).elf |
490 | $(REMOVE) $(TARGET).map |
489 | $(REMOVE) $(TARGET).map |
491 | $(REMOVE) $(TARGET).obj |
490 | $(REMOVE) $(TARGET).obj |
492 | $(REMOVE) $(TARGET).a90 |
491 | $(REMOVE) $(TARGET).a90 |
493 | $(REMOVE) $(TARGET).sym |
492 | $(REMOVE) $(TARGET).sym |
494 | $(REMOVE) $(TARGET).lnk |
493 | $(REMOVE) $(TARGET).lnk |
495 | $(REMOVE) $(TARGET).lss |
494 | $(REMOVE) $(TARGET).lss |
496 | $(REMOVE) $(OBJ) |
495 | $(REMOVE) $(OBJ) |
497 | $(REMOVE) $(LST) |
496 | $(REMOVE) $(LST) |
498 | $(REMOVE) $(SRC:.c=.s) |
497 | $(REMOVE) $(SRC:.c=.s) |
499 | $(REMOVE) $(SRC:.c=.d) |
498 | $(REMOVE) $(SRC:.c=.d) |
500 | 499 | ||
501 | 500 | ||
502 | # Automatically generate C source code dependencies. |
501 | # Automatically generate C source code dependencies. |
503 | # (Code originally taken from the GNU make user manual and modified |
502 | # (Code originally taken from the GNU make user manual and modified |
504 | # (See README.txt Credits).) |
503 | # (See README.txt Credits).) |
505 | # |
504 | # |
506 | # Note that this will work with sh (bash) and sed that is shipped with WinAVR |
505 | # Note that this will work with sh (bash) and sed that is shipped with WinAVR |
507 | # (see the SHELL variable defined above). |
506 | # (see the SHELL variable defined above). |
508 | # This may not work with other shells or other seds. |
507 | # This may not work with other shells or other seds. |
509 | # |
508 | # |
510 | %.d: %.c |
509 | %.d: %.c |
511 | set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
510 | set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
512 | | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
511 | | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
513 | [ -s $@ ] || rm -f $@ |
512 | [ -s $@ ] || rm -f $@ |
514 | 513 | ||
515 | 514 | ||
516 | # Remove the '-' if you want to see the dependency files generated. |
515 | # Remove the '-' if you want to see the dependency files generated. |
517 | -include $(SRC:.c=.d) |
516 | -include $(SRC:.c=.d) |
518 | 517 | ||
519 | 518 | ||
520 | 519 | ||
521 | # Listing of phony targets. |
520 | # Listing of phony targets. |
522 | .PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
521 | .PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
523 | clean clean_list program |
522 | clean clean_list program |
524 | 523 |