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