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