Subversion Repositories avr32-toolchain

Rev

Rev 6 | Rev 9 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6 Rev 7
Line 20... Line 20...
20
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
# THE SOFTWARE.
21
# THE SOFTWARE.
22
22
23
#### PRIMARY TOOLCHAIN VERSIONS #####
23
#### PRIMARY TOOLCHAIN VERSIONS #####
24
24
25
GCC_VERSION      = 4.4.3
25
GCC_VERSION       = 4.4.3
-
 
26
GDB_VERSION_DLOAD = 6.7.1a
26
GDB_VERSION      = 6.7.1
27
GDB_VERSION       = 6.7.1
27
BINUTILS_VERSION = 2.20.1
28
BINUTILS_VERSION  = 2.20.1
28
NEWLIB_VERSION   = 1.16.0
29
NEWLIB_VERSION    = 1.16.0
29
DFU_VERSION      = 0.5.4
30
DFU_VERSION       = 0.5.4
30
AVR_PATCH_REV	 = 3.2.3.261
31
AVR_PATCH_REV	  = 3.2.3.261
31
AVR_HEADER_REV   = 3.2.3.258
32
AVR_HEADER_REV    = 3.2.3.258
32
33
33
34
34
#### PATHS AND ENVIRONMENT VARIABLES #####
35
#### PATHS AND ENVIRONMENT VARIABLES #####
35
36
36
SHELL       = /bin/bash
37
SHELL       = /bin/bash
Line 66... Line 67...
66
67
67
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
68
GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2
68
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
69
GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
69
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
70
GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103
70
71
71
GDB_ARCHIVE = gdb-$(GDB_VERSION).tar.bz2
72
GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2
72
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
73
GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE)
73
GDB_MD5 = 30a6bf36eded4ae5a152d7d71b86dc14
74
GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214
74
75
75
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
76
BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2
76
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
77
BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE)
77
BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
78
BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764
78
79
Line 107... Line 108...
107
AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
108
AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f
108
109
109
110
110
111
111
.PHONY: install-tools
112
.PHONY: install-tools
112
install-tools: stamps/install-binutils stamps/install-final-gcc stamps/install-newlib stamps/install-headers
113
install-tools: install-binutils install-final-gcc install-newlib install-headers
113
114
114
.PHONY: install-cross
115
.PHONY: install-cross
115
install-cross: install-tools install-note
116
install-cross: install-tools install-note
116
117
117
118
Line 137... Line 138...
137
	@echo
138
	@echo
138
	@echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:
139
	@echo Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:
139
	@echo export PATH=$(PREFIX)/bin:'$$PATH'
140
	@echo export PATH=$(PREFIX)/bin:'$$PATH'
140
141
141
142
142
.PHONY: download-gdb
-
 
143
downloads/$(GDB_ARCHIVE) download-gdb:
-
 
144
	[ -d downloads ] || mkdir downloads ;
143
.PHONY: install-supp-tools install-supp-tools-force
145
	cd downloads && curl -LO $(GDB_URL)
-
 
146
-
 
147
-
 
148
-
 
149
-
 
150
.PHONY: install-supp-tools
144
install-supp-tools: stamps/install-supp-tools
151
install-supp-tools stamps/install-supp-tools: install-autoconf install-automake
145
install-supp-tools-force stamps/install-supp-tools: stamps/install-autoconf stamps/install-automake
152
	[ -d stamps ] || mkdir stamps ;
146
	[ -d stamps ] || mkdir stamps ;
153
	touch stamps/install-supp-tools;
147
	touch stamps/install-supp-tools;
154
148
-
 
149
.PHONY: clean-supp-tools
-
 
150
clean-supp-tools: clean-autoconf clean-automake
-
 
151
	rm stamps/install-supp-tools;
-
 
152
-
 
153
.PHONY: realclean-supp-tools
-
 
154
realclean-supp-tools: realclean-autoconf realclean-automake
-
 
155
	rm stamps/install-supp-tools;
-
 
156
155
157
156
############# SUPP: AUTOCONF ############
158
############# SUPP: AUTOCONF ############
157
159
158
.PHONY: download-autoconf
160
.PHONY: download-autoconf download-autoconf-force
159
downloads/$(AUTOCONF_ARCHIVE) download-autoconf:
161
download-autoconf: downloads/$(AUTOCONF_ARCHIVE)
-
 
162
download-autoconf-force downloads/$(AUTOCONF_ARCHIVE):
160
	[ -d downloads ] || mkdir downloads ;
163
	[ -d downloads ] || mkdir downloads ;
161
	cd downloads && curl -LO $(AUTOCONF_URL)
164
	cd downloads && curl -LO $(AUTOCONF_URL)
162
165
163
.PHONY: extract-autoconf
166
.PHONY: extract-autoconf extract-autoconf-force
-
 
167
extract-autoconf: stamps/extract-autoconf
164
extract-autoconf stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE)
168
extract-autoconf-force stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE)
165
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
169
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
166
	[ "$$t1" = "$(AUTOCONF_MD5)" ] || \
170
	[ "$$t1" = "$(AUTOCONF_MD5)" ] || \
167
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
171
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
168
	tar -jxf $< ;
172
	tar -jxf $< ;
169
	[ -d stamps ] || mkdir stamps ;
173
	[ -d stamps ] || mkdir stamps ;
170
	touch stamps/extract-autoconf;
174
	touch stamps/extract-autoconf;
171
175
172
.PHONY: build-autoconf
176
.PHONY: build-autoconf build-autoconf-force
-
 
177
build-autoconf: stamps/build-autoconf
173
build-autoconf stamps/build-autoconf: stamps/extract-autoconf
178
build-autoconf-force stamps/build-autoconf: stamps/extract-autoconf
174
	mkdir -p build/autoconf && cd build/autoconf && \
179
	mkdir -p build/autoconf && cd build/autoconf && \
175
	../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
180
	../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
176
	$(MAKE) -j$(PROCS)
181
	$(MAKE) -j$(PROCS)
177
	[ -d stamps ] || mkdir stamps
182
	[ -d stamps ] || mkdir stamps
178
	touch stamps/build-autoconf;
183
	touch stamps/build-autoconf;
179
184
180
.PHONY: install-autoconf
185
.PHONY: install-autoconf install-autoconf-force
-
 
186
install-autoconf: stamps/install-autoconf
181
install-autoconf stamps/install-autoconf:  stamps/build-autoconf
187
install-autoconf-force stamps/install-autoconf:  stamps/build-autoconf
182
	cd build/autoconf && \
188
	cd build/autoconf && \
183
	$(MAKE) install
189
	$(MAKE) install
184
	[ -d stamps ] || mkdir stamps
190
	[ -d stamps ] || mkdir stamps
185
	touch stamps/install-autoconf;
191
	touch stamps/install-autoconf;
186
192
-
 
193
.PHONY: clean-autoconf
-
 
194
clean-autoconf:
-
 
195
	rm -rf build/autoconf stamps/*-autoconf autoconf-*
-
 
196
-
 
197
.PHONY: realclean-autoconf
-
 
198
realclean-gdb: clean-autoconf
-
 
199
	rm downloads/$(AUTOCONF_ARCHIVE)
187
200
188
201
189
############ SUPP: AUTOMAKE ############
202
############ SUPP: AUTOMAKE ############
190
203
191
.PHONY: download-automake
204
.PHONY: download-automake download-automake-force
192
downloads/$(AUTOMAKE_ARCHIVE) download-automake:
205
download-automake: downloads/$(AUTOMAKE_ARCHIVE)
-
 
206
download-automake-force downloads/$(AUTOMAKE_ARCHIVE):
193
	[ -d downloads ] || mkdir downloads ;
207
	[ -d downloads ] || mkdir downloads ;
194
	cd downloads && curl -LO $(AUTOMAKE_URL)
208
	cd downloads && curl -LO $(AUTOMAKE_URL)
195
209
196
.PHONY: extract-automake
210
.PHONY: extract-automake extract-automake-force
-
 
211
extract-automake: stamps/extract-automake
197
extract-automake stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
212
extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE)
198
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
213
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
199
	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
214
	[ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
200
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
215
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
201
	tar -jxf $< ;
216
	tar -jxf $< ;
202
	[ -d stamps ] || mkdir stamps ;
217
	[ -d stamps ] || mkdir stamps ;
203
	touch stamps/extract-automake;
218
	touch stamps/extract-automake;
204
219
205
.PHONY: build-automake
220
.PHONY: build-automake build-automake-force
-
 
221
build-automake: stamps/build-automake
206
build-automake stamps/build-automake: stamps/extract-automake stamps/install-autoconf
222
build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf
207
	mkdir -p build/automake && cd build/automake && \
223
	mkdir -p build/automake && cd build/automake && \
208
	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
224
	../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
209
	$(MAKE) -j$(PROCS)
225
	$(MAKE) -j$(PROCS)
210
	[ -d stamps ] || mkdir stamps
226
	[ -d stamps ] || mkdir stamps
211
	touch stamps/build-automake;
227
	touch stamps/build-automake;
212
228
213
.PHONY: install-automake
229
.PHONY: install-automake install-automake-force
-
 
230
install-automake: stamps/install-automake
214
install-automake stamps/install-automake:  stamps/build-automake
231
install-automake-force stamps/install-automake: stamps/build-automake
215
	cd build/automake && \
232
	cd build/automake && \
216
	$(MAKE) install
233
	$(MAKE) install
217
	[ -d stamps ] || mkdir stamps
234
	[ -d stamps ] || mkdir stamps
218
	touch stamps/install-automake;
235
	touch stamps/install-automake;
219
236
-
 
237
.PHONY: clean-automake
-
 
238
clean-automake:
-
 
239
	rm -rf build/automake stamps/*-automake automake-*
-
 
240
-
 
241
.PHONY: realclean-automake
-
 
242
realclean-automake: clean-automake
-
 
243
	rm downloads/$(AUTOMAKE_ARCHIVE)
220
244
221
245
222
############# AVR32 PATCHES ############
246
############# AVR32 PATCHES ############
223
247
224
.PHONY: download-avr32patches
248
.PHONY: download-avr32patches download-avr32patches-force
-
 
249
download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
225
downloads/$(AVR32PATCHES_ARCHIVE) download-avr32patches:
250
download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
226
	cd downloads && curl -LO $(AVR32PATCHES_URL)
251
	cd downloads && curl -LO $(AVR32PATCHES_URL)
227
252
228
.PHONY: extract-avr32patches
253
.PHONY: extract-avr32patches extract-avr32patches-force
-
 
254
extract-avr32patches: stamps/extract-avr32patches
229
extract-avr32patches stamps/extract-avr32patches : downloads/$(AVR32PATCHES_ARCHIVE)
255
extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
230
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
256
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
231
	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
257
	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
232
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
258
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
233
	unzip -o $<
259
	unzip -o $<
234
	[ -d stamps ] || mkdir stamps
260
	[ -d stamps ] || mkdir stamps
235
	touch stamps/extract-avr32patches;
261
	touch stamps/extract-avr32patches;
236
262
-
 
263
.PHONY: clean-avr32patches
-
 
264
clean-avr32patches:
-
 
265
	rm -rf stamps/*-avr32patches source
-
 
266
-
 
267
.PHONY: realclean-avr32patches
-
 
268
realclean-avr32patches: clean-avr32patches
-
 
269
	rm downloads/$(AVR32PATCHES_ARCHIVE)
-
 
270
237
271
238
############# AVR32 HEADERS ############
272
############# AVR32 HEADERS ############
239
273
240
.PHONY: download-avr32headers
274
.PHONY: download-avr32headers download-avr32headers-force
-
 
275
download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
241
downloads/$(AVR32HEADERS_ARCHIVE) download-avr32headers:
276
download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
242
	cd downloads && curl -LO $(AVR32HEADERS_URL)
277
	cd downloads && curl -LO $(AVR32HEADERS_URL)
243
278
244
.PHONY: install-headers
279
.PHONY: install-headers install-headers-force
-
 
280
install-headers: stamps/install-headers
245
install-headers stamps/install-headers : downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
281
install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
246
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
282
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
247
	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
283
	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
248
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
284
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
249
	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
285
	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
250
	[ -d stamps ] || mkdir stamps
286
	[ -d stamps ] || mkdir stamps
251
	touch stamps/install-headers;
287
	touch stamps/install-headers;
252
288
-
 
289
.PHONY: clean-headers
-
 
290
clean-headers:
-
 
291
	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
-
 
292
-
 
293
.PHONY: realclean-headers
-
 
294
realclean-headers: clean-headers
-
 
295
	rm downloads/$(AVR32HEADERS_ARCHIVE)
-
 
296
253
297
254
################ NEWLIB ################
298
################ NEWLIB ################
255
299
256
.PHONY: download-newlib
300
.PHONY: download-newlib download-newlib-force
257
downloads/$(NEWLIB_ARCHIVE) download-newlib:
301
download-newlib: downloads/$(NEWLIB_ARCHIVE)
-
 
302
download-newlib-force downloads/$(NEWLIB_ARCHIVE):
258
	[ -d downloads ] || mkdir downloads ;
303
	[ -d downloads ] || mkdir downloads ;
259
	cd downloads && curl -LO $(NEWLIB_URL)
304
	cd downloads && curl -LO $(NEWLIB_URL)
260
305
261
.PHONY: prep-newlib
306
.PHONY: extract-newlib extract-newlib-force
262
prep-newlib stamps/prep-newlib: stamps/regen-newlib
-
 
263
	[ -d stamps ] || mkdir stamps
-
 
264
	touch stamps/prep-newlib;
307
extract-newlib: stamps/extract-newlib
265
-
 
266
-
 
267
.PHONY: extract-newlib
-
 
268
extract-newlib stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
308
extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE)
269
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
309
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
270
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
310
	[ "$$t1" = "$(NEWLIB_MD5)" ] || \
271
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
311
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
272
	tar -xf $<
312
	tar -xf $<
273
	[ -d stamps ] || mkdir stamps
313
	[ -d stamps ] || mkdir stamps
274
	touch stamps/extract-newlib;
314
	touch stamps/extract-newlib;
275
315
276
316
277
.PHONY: patch-newlib
317
.PHONY: patch-newlib patch-newlib-force
-
 
318
patch-newlib: stamps/patch-newlib
278
patch-newlib stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
319
patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches
279
	pushd newlib-$(NEWLIB_VERSION) ; \
320
	pushd newlib-$(NEWLIB_VERSION) ; \
280
	for f in ../source/avr32/newlib/*.patch; do \
321
	for f in ../source/avr32/newlib/*.patch; do \
281
	patch -N -p0 <$${f} ; \
322
	patch -N -p0 <$${f} ; \
282
	done ; \
323
	done ; \
283
	popd ;
324
	popd ;
284
	[ -d stamps ] || mkdir stamps
325
	[ -d stamps ] || mkdir stamps
285
	touch stamps/patch-newlib;
326
	touch stamps/patch-newlib;
286
327
287
.PHONY: regen-newlib
328
.PHONY: regen-newlib regen-newlib-force
-
 
329
regen-newlib: stamps/regen-newlib
288
regen-newlib stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
330
regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools
289
	pushd newlib-$(NEWLIB_VERSION) ; \
331
	pushd newlib-$(NEWLIB_VERSION) ; \
290
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
332
	"$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \
291
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
333
	for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \
292
	  pushd $$dir ; \
334
	  pushd $$dir ; \
293
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
335
	  "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \
Line 301... Line 343...
301
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
343
NEWLIB_FLAGS="-ffunction-sections -fdata-sections	\
302
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
344
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os	\
303
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
345
-fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128	\
304
-DSMALL_MEMORY"
346
-DSMALL_MEMORY"
305
347
306
.PHONY: cross-newlib
348
.PHONY: build-newlib build-newlib-force
-
 
349
build-newlib: stamps/build-newlib
307
build-newlib stamps/build-newlib: stamps/prep-newlib stamps/install-binutils stamps/install-gcc
350
build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc
308
	mkdir -p build/newlib && cd build/newlib && \
351
	mkdir -p build/newlib && cd build/newlib && \
309
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
352
	pushd ../../newlib-$(NEWLIB_VERSION) ; \
310
	make clean ; \
353
	make clean ; \
311
	popd ; \
354
	popd ; \
312
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
355
	../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX)	\
Line 318... Line 361...
318
	--enable-newlib-reent-small  && \
361
	--enable-newlib-reent-small  && \
319
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
362
	$(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \
320
	[ -d stamps ] || mkdir stamps
363
	[ -d stamps ] || mkdir stamps
321
	touch stamps/build-newlib;
364
	touch stamps/build-newlib;
322
365
323
.PHONY: install-newlib
366
.PHONY: install-newlib install-newlib-force
-
 
367
install-newlib: stamps/install-newlib
324
install-newlib stamps/install-newlib: stamps/build-newlib
368
install-newlib-force stamps/install-newlib: stamps/build-newlib
325
	cd build/newlib && \
369
	cd build/newlib && \
326
	$(MAKE) install
370
	$(MAKE) install
327
	[ -d stamps ] || mkdir stamps
371
	[ -d stamps ] || mkdir stamps
328
	touch stamps/install-newlib;
372
	touch stamps/install-newlib;
329
373
-
 
374
.PHONY: clean-newlib
-
 
375
clean-newlib:
-
 
376
	rm -rf build/newlib stamps/*-newlib newlib-*
-
 
377
-
 
378
.PHONY: realclean-newlib
-
 
379
realclean-newlib: clean-newlib
-
 
380
	rm downloads/$(NEWLIB_ARCHIVE)
-
 
381
-
 
382
330
################ BINUTILS ################
383
################ BINUTILS ################
331
384
332
.PHONY: download-binutils
385
.PHONY: download-binutils download-binutils-force
333
downloads/$(BINUTILS_ARCHIVE) download-binutils:
386
download-binutils: downloads/$(BINUTILS_ARCHIVE)
-
 
387
download-binutils-force downloads/$(BINUTILS_ARCHIVE):
334
	[ -d downloads ] || mkdir downloads ;
388
	[ -d downloads ] || mkdir downloads ;
335
	cd downloads && curl -LO $(BINUTILS_URL)
389
	cd downloads && curl -LO $(BINUTILS_URL)
336
390
337
.PHONY: prep-binutils
391
.PHONY: extract-binutils extract-binutils-force
338
prep-binutils stamps/prep-binutils: stamps/regen-binutils
392
extract-binutils: stamps/extract-binutils
339
	[ -d stamps ] || mkdir stamps;
-
 
340
	touch stamps/prep-binutils;
-
 
341
-
 
342
.PHONY: extract-binutils
-
 
343
extract-binutils stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
393
extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
344
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
394
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
345
	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
395
	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
346
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
396
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
347
	tar -jxf $< ;
397
	tar -jxf $< ;
348
	[ -d stamps ] || mkdir stamps ;
398
	[ -d stamps ] || mkdir stamps ;
349
	touch stamps/extract-binutils;
399
	touch stamps/extract-binutils;
350
400
351
.PHONY: patch-binutils
401
.PHONY: patch-binutils patch-binutils-force
-
 
402
patch-binutils: stamps/patch-binutils
352
patch-binutils stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
403
patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
353
	pushd binutils-$(BINUTILS_VERSION) ; \
404
	pushd binutils-$(BINUTILS_VERSION) ; \
354
	for f in ../source/avr32/binutils/*.patch; do \
405
	for f in ../source/avr32/binutils/*.patch; do \
355
	patch -N -p0 <$${f} ; \
406
	patch -N -p0 <$${f} ; \
356
	done ; \
407
	done ; \
357
	popd ; \
408
	popd ; \
358
	[ -d stamps ] || mkdir stamps
409
	[ -d stamps ] || mkdir stamps
359
	touch stamps/patch-binutils;
410
	touch stamps/patch-binutils;
360
411
361
.PHONY: regen-binutils
412
.PHONY: regen-binutils regen-binutils-force
-
 
413
regen-binutils: stamps/regen-binutils
362
regen-binutils stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
414
regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
363
	pushd binutils-$(BINUTILS_VERSION) ; \
415
	pushd binutils-$(BINUTILS_VERSION) ; \
364
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
416
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
365
	"$(SUPP_PREFIX)/bin/autoconf" ; \
417
	"$(SUPP_PREFIX)/bin/autoconf" ; \
366
	"$(SUPP_PREFIX)/bin/automake" ; \
418
	"$(SUPP_PREFIX)/bin/automake" ; \
367
	"$(SUPP_PREFIX)/bin/autoheader" ; \
419
	"$(SUPP_PREFIX)/bin/autoheader" ; \
Line 374... Line 426...
374
	done; \
426
	done; \
375
	popd; \
427
	popd; \
376
	[ -d stamps ] || mkdir stamps ;
428
	[ -d stamps ] || mkdir stamps ;
377
	touch stamps/regen-binutils;
429
	touch stamps/regen-binutils;
378
430
379
.PHONY: build-binutils
431
.PHONY: build-binutils build-binutils-force
-
 
432
build-binutils: stamps/build-binutils
380
build-binutils stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
433
build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
381
	cd binutils-$(BINUTILS_VERSION) ; \
434
	cd binutils-$(BINUTILS_VERSION) ; \
382
	./configure   --enable-maintainer-mode		\
435
	./configure   --enable-maintainer-mode		\
383
	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
436
	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
384
	--disable-shared --disable-werror				\
437
	--disable-shared --disable-werror				\
385
	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
438
	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
Line 388... Line 441...
388
	make configure-bfd; \
441
	make configure-bfd; \
389
	$(MAKE)
442
	$(MAKE)
390
	[ -d stamps ] || mkdir stamps ;
443
	[ -d stamps ] || mkdir stamps ;
391
	touch stamps/build-binutils;
444
	touch stamps/build-binutils;
392
445
393
.PHONY: install-binutils
446
.PHONY: install-binutils install-binutils-force
-
 
447
install-binutils: stamps/install-binutils
394
install-binutils stamps/install-binutils: stamps/build-binutils
448
install-binutils-force stamps/install-binutils: stamps/build-binutils
395
	cd binutils-$(BINUTILS_VERSION) && \
449
	cd binutils-$(BINUTILS_VERSION) && \
396
	$(MAKE) installdirs install-host install-target
450
	$(MAKE) installdirs install-host install-target
397
	[ -d stamps ] || mkdir stamps ;
451
	[ -d stamps ] || mkdir stamps ;
398
	touch stamps/install-binutils;
452
	touch stamps/install-binutils;
399
453
-
 
454
-
 
455
.PHONY: clean-binutils
-
 
456
clean-binutils:
-
 
457
	rm -rf build/binutils stamps/*-binutils binutils-*
-
 
458
-
 
459
.PHONY: realclean-binutils
-
 
460
realclean-binutils: clean-binutils
-
 
461
	rm downloads/$(BINUTILS_ARCHIVE)
-
 
462
-
 
463
400
########## DFU PROGRAMMER ###########
464
########## DFU PROGRAMMER ###########
401
465
402
.PHONY: download-dfu
466
.PHONY: download-dfu download-dfu-force
403
downloads/$(DFU_ARCHIVE) download-dfu:
467
download-dfu: downloads/$(DFU_ARCHIVE)
-
 
468
download-dfu-force downloads/$(DFU_ARCHIVE):
404
	[ -d downloads ] || mkdir downloads ;
469
	[ -d downloads ] || mkdir downloads ;
405
	cd downloads && curl -LO $(DFU_URL)
470
	cd downloads && curl -LO $(DFU_URL)
406
471
407
.PHONY: extract-dfu
472
.PHONY: extract-dfu extract-dfu-force
-
 
473
extract-dfu: stamps/extract-dfu
408
extract-dfu stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
474
extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE)
409
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
475
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
410
	[ "$$t1" = "$(DFU_MD5)" ] || \
476
	[ "$$t1" = "$(DFU_MD5)" ] || \
411
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
477
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
412
	tar -zxf $< ;
478
	tar -zxf $< ;
413
	[ -d stamps ] || mkdir stamps ;
479
	[ -d stamps ] || mkdir stamps ;
414
	touch stamps/extract-dfu;
480
	touch stamps/extract-dfu;
415
481
416
.PHONY: build-dfu
482
.PHONY: build-dfu build-dfu-force
-
 
483
build-dfu: stamps/build-dfu
417
build-dfu stamps/build-dfu: stamps/extract-dfu
484
build-dfu-force stamps/build-dfu: stamps/extract-dfu
418
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
485
	mkdir -p build/dfu-programmer && cd build/dfu-programmer && \
419
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
486
	../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \
420
	$(MAKE) -j$(PROCS)
487
	$(MAKE) -j$(PROCS)
421
	[ -d stamps ] || mkdir stamps
488
	[ -d stamps ] || mkdir stamps
422
	touch stamps/build-dfu;
489
	touch stamps/build-dfu;
423
490
424
.PHONY: install-dfu
491
.PHONY: install-dfu install-dfu-force
-
 
492
install-dfu: stamps/install-dfu
425
install-dfu stamps/install-dfu:  stamps/build-dfu
493
install-dfu-force stamps/install-dfu: stamps/build-dfu
426
	cd build/dfu-programmer && \
494
	cd build/dfu-programmer && \
427
	$(MAKE) install
495
	$(MAKE) install
428
	[ -d stamps ] || mkdir stamps
496
	[ -d stamps ] || mkdir stamps
429
	touch stamps/install-dfu;
497
	touch stamps/install-dfu;
430
498
-
 
499
.PHONY: clean-dfu
-
 
500
clean-dfu:
-
 
501
	rm -rf build/dfu stamps/*-dfu dfu-*
-
 
502
-
 
503
.PHONY: realclean-dfu
-
 
504
realclean-dfu: clean-dfu
-
 
505
	rm downloads/$(DFU_ARCHIVE)
-
 
506
431
507
432
################ Bootstrap GCC ################
508
################ Bootstrap GCC ################
433
509
434
.PHONY: download-gcc
510
.PHONY: download-gcc download-gcc-force
435
downloads/$(GCC_ARCHIVE) download-gcc:
511
download-gcc: downloads/$(GCC_ARCHIVE)
-
 
512
download-gcc-force downloads/$(GCC_ARCHIVE):
436
	[ -d downloads ] || mkdir downloads ;
513
	[ -d downloads ] || mkdir downloads ;
437
	cd downloads && curl -LO $(GCC_URL)
514
	cd downloads && curl -LO $(GCC_URL)
438
515
439
.PHONY: prep-gcc
516
.PHONY: extract-gcc extract-gcc-force
440
prep-gcc stamps/prep-gcc: stamps/patch-gcc
517
extract-gcc: stamps/extract-gcc
441
	[ -d stamps ] || mkdir stamps;
-
 
442
	touch stamps/prep-gcc;
-
 
443
-
 
444
.PHONY: extract-gcc
-
 
445
extract-gcc stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
518
extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE)
446
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
519
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
447
	[ "$$t1" = "$(GCC_MD5)" ] || \
520
	[ "$$t1" = "$(GCC_MD5)" ] || \
448
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
521
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
449
	tar -jxf $< ;
522
	tar -jxf $< ;
450
	[ -d stamps ] || mkdir stamps ;
523
	[ -d stamps ] || mkdir stamps ;
451
	touch stamps/extract-gcc;
524
	touch stamps/extract-gcc;
452
525
453
.PHONY: patch-gcc
526
.PHONY: patch-gcc patch-gcc-force
-
 
527
patch-gcc: stamps/patch-gcc
454
patch-gcc stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
528
patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches
455
	pushd gcc-$(GCC_VERSION) ; \
529
	pushd gcc-$(GCC_VERSION) ; \
456
	for f in ../source/avr32/gcc/*.patch; do \
530
	for f in ../source/avr32/gcc/*.patch; do \
457
	patch -N -p0 <$${f} ; \
531
	patch -N -p0 <$${f} ; \
458
	done ; \
532
	done ; \
459
	popd ;
533
	popd ;
Line 462... Line 536...
462
536
463
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
537
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections			\
464
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
538
-fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g	\
465
-Os -fno-unroll-loops"
539
-Os -fno-unroll-loops"
466
540
467
.PHONY: build-gcc
541
.PHONY: build-gcc build-gcc-force
-
 
542
build-gcc: stamps/build-gcc
468
build-gcc stamps/build-gcc: stamps/install-binutils stamps/prep-gcc
543
build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc
469
	mkdir -p build/gcc && cd build/gcc && \
544
	mkdir -p build/gcc && cd build/gcc && \
470
	pushd ../../gcc-$(GCC_VERSION) ; \
545
	pushd ../../gcc-$(GCC_VERSION) ; \
471
	make clean ; \
546
	make clean ; \
472
	popd ; \
547
	popd ; \
473
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
548
	../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)"		\
Line 488... Line 563...
488
	--with-pkgversion=$(PKG_VERSION) && \
563
	--with-pkgversion=$(PKG_VERSION) && \
489
	$(MAKE) -j$(PROCS)
564
	$(MAKE) -j$(PROCS)
490
	[ -d stamps ] || mkdir stamps
565
	[ -d stamps ] || mkdir stamps
491
	touch stamps/build-gcc;
566
	touch stamps/build-gcc;
492
567
493
.PHONY: install-gcc
568
.PHONY: install-gcc install-gcc-force
-
 
569
install-gcc: stamps/install-gcc
494
install-gcc stamps/install-gcc:  stamps/build-gcc
570
install-gcc-force stamps/install-gcc: stamps/build-gcc
495
	cd build/gcc && \
571
	cd build/gcc && \
496
	$(MAKE) installdirs install-target && \
572
	$(MAKE) installdirs install-target && \
497
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
573
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
498
	[ -d stamps ] || mkdir stamps
574
	[ -d stamps ] || mkdir stamps
499
	touch stamps/install-gcc;
575
	touch stamps/install-gcc;
500
576
-
 
577
.PHONY: clean-gcc
-
 
578
clean-gcc:
-
 
579
	rm -rf build/gcc stamps/*-gcc gcc-*
-
 
580
-
 
581
.PHONY: realclean-gcc
-
 
582
realclean-gcc: clean-gcc
-
 
583
	rm downloads/$(GCC_ARCHIVE)
501
584
502
################ Final GCC ################
-
 
503
585
504
.PHONY: prep-final-gcc
-
 
505
prep-final-gcc stamps/prep-final-gcc: stamps/patch-gcc stamps/prep-gcc
-
 
506
	[ -d stamps ] || mkdir stamps;
586
################ Final GCC ################
507
	touch stamps/prep-final-gcc;
-
 
508
587
509
.PHONY: build-final-gcc
588
.PHONY: build-final-gcc build-final-gcc-force
-
 
589
build-final-gcc: stamps/build-final-gcc
510
build-final-gcc stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/prep-final-gcc
590
build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc
511
	mkdir -p build/final-gcc && cd build/final-gcc && \
591
	mkdir -p build/final-gcc && cd build/final-gcc && \
512
	pushd ../../gcc-$(GCC_VERSION) ; \
592
	pushd ../../gcc-$(GCC_VERSION) ; \
513
	make clean ; \
593
	make clean ; \
514
	popd ; \
594
	popd ; \
515
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
595
	../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \
Line 530... Line 610...
530
	--with-pkgversion=$(PKG_VERSION) && \
610
	--with-pkgversion=$(PKG_VERSION) && \
531
	$(MAKE) -j$(PROCS)
611
	$(MAKE) -j$(PROCS)
532
	[ -d stamps ] || mkdir stamps
612
	[ -d stamps ] || mkdir stamps
533
	touch stamps/build-final-gcc;
613
	touch stamps/build-final-gcc;
534
614
535
.PHONY: install-final-gcc
615
.PHONY: install-final-gcc install-final-gcc-force
-
 
616
install-final-gcc: stamps/install-final-gcc
536
install-final-gcc stamps/install-final-gcc: stamps/build-final-gcc
617
install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc
537
	cd build/final-gcc && \
618
	cd build/final-gcc && \
538
	$(MAKE) installdirs install-target && \
619
	$(MAKE) installdirs install-target && \
539
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
620
	$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
540
	[ -d stamps ] || mkdir stamps
621
	[ -d stamps ] || mkdir stamps
541
	touch stamps/install-final-gcc;
622
	touch stamps/install-final-gcc;
542
623
-
 
624
.PHONY: clean-final-gcc
-
 
625
clean-final-gcc: clean-gcc
-
 
626
	rm -rf build/final-gcc stamps/*-final-gcc
-
 
627
-
 
628
.PHONY: realclean-final-gcc
-
 
629
realclean-final-gcc: realclean-gcc
-
 
630
-
 
631
-
 
632
########## GDB ###########
-
 
633
-
 
634
.PHONY: download-gdb download-gdb-force
-
 
635
download-gdb: downloads/$(GDB_ARCHIVE)
-
 
636
download-gdb-force downloads/$(GDB_ARCHIVE):
-
 
637
	[ -d downloads ] || mkdir downloads ;
-
 
638
	cd downloads && curl -LO $(GDB_URL)
-
 
639
-
 
640
.PHONY: extract-gdb extract-gdb-force
-
 
641
extract-gdb: stamps/extract-gdb
-
 
642
extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE)
-
 
643
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
-
 
644
	[ "$$t1" = "$(GDB_MD5)" ] || \
-
 
645
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
-
 
646
	tar -jxf $< ;
-
 
647
	[ -d stamps ] || mkdir stamps ;
-
 
648
	touch stamps/extract-gdb;
-
 
649
-
 
650
.PHONY: patch-gdb patch-gdb-force
-
 
651
patch-gdb: stamps/patch-gdb
-
 
652
patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches
-
 
653
	pushd gdb-$(GDB_VERSION) ; \
-
 
654
	for f in ../source/avr32/gdb/*.patch; do \
-
 
655
	patch -N -p0 <$${f} ; \
-
 
656
	done ; \
-
 
657
	popd ; \
-
 
658
	[ -d stamps ] || mkdir stamps
-
 
659
	touch stamps/patch-gdb;
-
 
660
-
 
661
.PHONY: regen-gdb regen-gdb-force
-
 
662
regen-gdb: stamps/regen-gdb
-
 
663
regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools
-
 
664
	pushd gdb-$(GDB_VERSION) ; \
-
 
665
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
-
 
666
	"$(SUPP_PREFIX)/bin/autoconf" ; \
-
 
667
	"$(SUPP_PREFIX)/bin/automake" ; \
-
 
668
	"$(SUPP_PREFIX)/bin/autoheader" ; \
-
 
669
	for dir in bfd opcodes gdb; do \
-
 
670
	  pushd $$dir ; \
-
 
671
	  echo "JESS 1: $$dir" >&2 ; \
-
 
672
	  "$(SUPP_PREFIX)/bin/autoconf"; \
-
 
673
	  "$(SUPP_PREFIX)/bin/automake"; \
-
 
674
	  "$(SUPP_PREFIX)/bin/autoheader"; \
-
 
675
	  echo "JESS 2: $$dir" >&2 ; \
-
 
676
	  popd ; \
-
 
677
	done; \
-
 
678
	popd; \
-
 
679
	[ -d stamps ] || mkdir stamps ;
-
 
680
	touch stamps/regen-gdb;
-
 
681
-
 
682
.PHONY: build-gdb build-gdb-force
-
 
683
build-gdb: stamps/build-gdb
-
 
684
build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools
-
 
685
	echo "JESS 3" >&2 ; \
-
 
686
	mkdir -p build/gdb && cd build/gdb && \
-
 
687
	../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \
-
 
688
	$(MAKE) -j$(PROCS)
-
 
689
	$(MAKE) installdirs install-host install-target
-
 
690
	[ -d stamps ] || mkdir stamps
-
 
691
	touch stamps/build-gdb;
-
 
692
-
 
693
.PHONY: install-gdb install-gdb-force
-
 
694
install-gdb: stamps/install-gdb
-
 
695
install-gdb-force stamps/install-gdb: stamps/build-gdb
-
 
696
	cd build/gdb && \
-
 
697
	$(MAKE) install
-
 
698
	[ -d stamps ] || mkdir stamps
-
 
699
	touch stamps/install-gdb;
-
 
700
-
 
701
.PHONY: clean-gdb
-
 
702
clean-gdb:
-
 
703
	rm -rf build/gdb stamps/*-gdb gdb-*
-
 
704
-
 
705
.PHONY: realclean-gdb
-
 
706
realclean-gdb: clean-gdb
-
 
707
	rm downloads/$(GDB_ARCHIVE)
543
708
544
################ NON-WORKING/NON-ADJUSTED TARGETS ################
709
################ NON-WORKING/NON-ADJUSTED TARGETS ################
545
710
546
711
547
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/
712
gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/