Subversion Repositories avr32-toolchain

Rev

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

Rev 13 Rev 15
Line 97... Line 97...
97
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
97
NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4
98
98
99
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
99
AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip
100
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
100
AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE)
101
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
101
AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857
-
 
102
install_dir_avr32patches := source/avr32
102
103
103
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
104
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip
104
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
105
AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE)
105
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
106
AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228
106
107
Line 181... Line 182...
181
define make_stamp
182
define make_stamp
182
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
183
	@[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR)
183
	date > $(STAMP_DIR)/$(1)
184
	date > $(STAMP_DIR)/$(1)
184
endef
185
endef
185
186
186
## delete the given directory, if it is empty
187
## delete empty directories
187
define del_all_empty-directories
188
define del_empty-directories
188
	@find . -type d -empty | xargs rm -rf
189
	@find . -type d -empty | xargs rm -rf
189
endef
190
endef
190
191
-
 
192
## delete all empty directories
-
 
193
## need to do this several times. to remove empty sub directories
-
 
194
define del_all_empty-directories
-
 
195
	$(call del_empty-directories)
-
 
196
	$(call del_empty-directories)
-
 
197
	$(call del_empty-directories)
-
 
198
endef
-
 
199
-
 
200
191
## to make the following macros more simply, we need the variables
201
## to make the following macros more simply, we need the variables
192
## with the tool name in lowercase. I could have changed the original
202
## with the tool name in lowercase. I could have changed the original
193
## definition, but I don't want to break the make convention of upper
203
## definition, but I don't want to break the make convention of upper
194
## case definitions for such user defined variables.
204
## case definitions for such user defined variables.
195
205
Line 205... Line 215...
205
215
206
216
207
## create the download rule and force download rule
217
## create the download rule and force download rule
208
define DOWNLOAD_template
218
define DOWNLOAD_template
209
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
219
download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)
210
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE): $(DOWNLOAD_DIR)
220
download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE):
-
 
221
	[ -d $(DOWNLOAD_DIR) ] || mkdir -p $(DOWNLOAD_DIR)
211
	cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL)
222
	cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL)
212
223
213
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
224
download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)"
214
download-$(1)-remove:
225
download-$(1)-remove:
215
	$(call quiet_text,$$(download-$(1)_TEXT))
226
	$(call quiet_text,$$(download-$(1)_TEXT))
Line 232... Line 243...
232
	@(rm -rf $(1)-*; \
243
	@(rm -rf $(1)-*; \
233
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
244
	t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
234
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
245
	[ "$$$$t1" = "$$($(1)_MD5)" ] || \
235
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
246
	( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
236
	$(call quiet_text,$$(extract-$(1)_TEXT))
247
	$(call quiet_text,$$(extract-$(1)_TEXT))
237
	$($(2)) $$<
248
	$($(2)) $$< $(3)
238
	$(call make_stamp,extract-$(1))
249
	$(call make_stamp,extract-$(1))
239
250
240
extract-$(1)-remove:
251
extract-$(1)-remove:
241
	rm -rf $(1)-*
252
	rm -rf $(1)-*
242
	$(call rm_stamp,extract-$(1))
253
	$(call rm_stamp,extract-$(1))
243
254
244
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
255
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
245
endef
256
endef
246
257
-
 
258
## create the patch rule
-
 
259
define PATCH_template
-
 
260
patch-$(1)_TEXT := "Patching $$($(1)_ARCHIVE)"
-
 
261
patch-$(1): $(STAMP_DIR)/patch-$(1)
-
 
262
$(STAMP_DIR)/patch-$(1): $(STAMP_DIR)/extract-$(1) $(STAMP_DIR)/extract-avr32patches
-
 
263
	$(call quiet_text,$$(patch-$(1)_TEXT))
-
 
264
	@(pushd $(1)-$$($(1)_VERSION) ; \
-
 
265
	for f in ../$(install_dir_avr32patches)/$(1)/*.patch; do \
-
 
266
	patch -N -p0 < $$$${f} ; \
-
 
267
	done ; \
-
 
268
	popd)
-
 
269
	$(call make_stamp,patch-$(1))
-
 
270
-
 
271
patch-$(1)-remove: extract-$(1)-remove
-
 
272
	$(call rm_stamp,patch-$(1))
-
 
273
-
 
274
PHONY += patch-$(1) patch-$(1)-remove
-
 
275
endef
-
 
276
-
 
277
-
 
278
#.PHONY: regen-binutils regen-binutils-force
-
 
279
#regen-binutils: stamps/regen-binutils
-
 
280
#regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
-
 
281
#	pushd binutils-$(BINUTILS_VERSION) ; \
-
 
282
#	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
-
 
283
#	"$(SUPP_PREFIX)/bin/autoconf" ; \
-
 
284
#	"$(SUPP_PREFIX)/bin/automake" ; \
-
 
285
#	"$(SUPP_PREFIX)/bin/autoheader" ; \
-
 
286
#	for dir in bfd opcodes binutils gas ld; do \
-
 
287
#	  pushd $$dir ; \
-
 
288
#	  "$(SUPP_PREFIX)/bin/autoconf"; \
-
 
289
#	  "$(SUPP_PREFIX)/bin/automake"; \
-
 
290
#	  "$(SUPP_PREFIX)/bin/autoheader"; \
-
 
291
#	  popd ; \
-
 
292
#	done; \
-
 
293
#	popd; \
-
 
294
#	[ -d stamps ] || mkdir stamps ;
-
 
295
#	touch stamps/regen-binutils;
-
 
296
-
 
297
247
## create the configure rule and force configure rule
298
## create the configure rule and force configure rule
248
define CONF_template
299
define CONF_template
249
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
300
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)"
250
conf-$(1): $(STAMP_DIR)/conf-$(1)
301
conf-$(1): $(STAMP_DIR)/conf-$(1)
251
conf-$(1)-f $(STAMP_DIR)/conf-$(1): $(STAMP_DIR)/$(2)-$(1) $(BUILD_DIR)/$(1)
302
conf-$(1)-f $(STAMP_DIR)/conf-$(1): $(STAMP_DIR)/$(2)-$(1) $(BUILD_DIR)/$(1)
Line 304... Line 355...
304
define CLEAN_template
355
define CLEAN_template
305
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
356
clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)"
306
clean-$(1)-text:
357
clean-$(1)-text:
307
	$(call quiet_text,$$(clean-$(1)_TEXT))
358
	$(call quiet_text,$$(clean-$(1)_TEXT))
308
359
309
clean-$(1): clean-$(1)-text uninstall-$(1) extract-$(1)-remove build-$(1)-remove conf-$(1)-remove
360
clean-$(1): clean-$(1)-text uninstall-$(1) extract-$(1)-remove patch-$(1)-remove \
310
	$(call del_all_empty-directories)
-
 
311
	$(call del_all_empty-directories)
361
            build-$(1)-remove conf-$(1)-remove
312
	$(call del_all_empty-directories)
362
	$(call del_all_empty-directories)
313
363
314
realclean-$(1): clean-$(1) download-$(1)-remove
364
realclean-$(1): clean-$(1) download-$(1)-remove
315
	$(call del_all_empty-directories)
365
	$(call del_all_empty-directories)
316
	$(call del_all_empty-directories)
-
 
317
	$(call del_all_empty-directories)
-
 
318
366
319
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
367
PHONY += clean-$(1) realclean-$(1) clean-$(1)-text
320
endef
368
endef
321
369
-
 
370
## create some dummy rules for the clean rule
-
 
371
define DUMMY_patch_remove
-
 
372
patch-$(1)-remove:
-
 
373
PHONY += patch-$(1)-remove
-
 
374
endef
-
 
375
define DUMMY_conf_remove
-
 
376
conf-$(1)-remove:
-
 
377
PHONY += conf-$(1)-remove
-
 
378
endef
-
 
379
define DUMMY_build_remove
-
 
380
build-$(1)-remove:
-
 
381
PHONY += build-$(1)-remove
-
 
382
endef
322
383
323
384
324
-
 
325
$(DOWNLOAD_DIR):
-
 
326
	mkdir -p $@
-
 
327
-
 
328
$(BUILD_DIR)/%:
385
$(BUILD_DIR)/%:
329
	mkdir -p $@
386
	mkdir -p $@
330
387
331
388
332
############# SUPP: AUTOCONF ############
389
############# SUPP: AUTOCONF ############
Line 349... Line 406...
349
$(eval $(call BUILD_template,automake))
406
$(eval $(call BUILD_template,automake))
350
$(eval $(call INSTALL_template,automake))
407
$(eval $(call INSTALL_template,automake))
351
$(eval $(call CLEAN_template,automake))
408
$(eval $(call CLEAN_template,automake))
352
409
353
410
-
 
411
############# AVR32 PATCHES ############
-
 
412
-
 
413
$(eval $(call DOWNLOAD_template,avr32patches))
-
 
414
$(eval $(call EXTRACT_template,avr32patches,EXT_ZIP))
-
 
415
-
 
416
## use the uninstall-XXX rule to remove the patches directory
-
 
417
PHONY += uninstall-avr32patches
-
 
418
uninstall-avr32patches:
-
 
419
	rm -rf $(install_dir_avr32patches)
-
 
420
-
 
421
$(eval $(call CLEAN_template,avr32patches))
-
 
422
-
 
423
-
 
424
############# AVR32 HEADERS ############
-
 
425
$(eval $(call DOWNLOAD_template,avr32headers))
-
 
426
-
 
427
###### FIXME: Need to add a dependency to "stamps/install-final-gcc"
-
 
428
install_path_avr32headers := $(PREFIX)/$(TARGET)/include/
-
 
429
avr32headers_unzip_opt := -d "$(install_path_avr32headers)"
-
 
430
$(eval $(call EXTRACT_template,avr32headers,EXT_ZIP,$(avr32headers_unzip_opt)))
-
 
431
-
 
432
## use the uninstall-XXX rule to remove the patches directory
-
 
433
install_dir_avr32headers := $(install_path_avr32headers)/avr32
-
 
434
PHONY += uninstall-avr32headers
-
 
435
uninstall-avr32headers:
-
 
436
	rm -rf $(install_dir_avr32headers)
-
 
437
-
 
438
$(eval $(call CLEAN_template,avr32headers))
-
 
439
-
 
440
-
 
441
################ BINUTILS ################
-
 
442
-
 
443
$(eval $(call DOWNLOAD_template,binutils))
-
 
444
$(eval $(call EXTRACT_template,binutils,EXT_BZ2))
-
 
445
$(eval $(call PATCH_template,binutils))
-
 
446
#$(eval $(call REGEN_template,binutils))
-
 
447
binutils_conf_opts = \
-
 
448
--enable-maintainer-mode \
-
 
449
--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \
-
 
450
--disable-shared --disable-werror \
-
 
451
--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL)
-
 
452
$(eval $(call CONF_template,binutils,extract))
-
 
453
$(eval $(call BUILD_template,binutils))
-
 
454
$(eval $(call INSTALL_template,binutils))
-
 
455
$(eval $(call CLEAN_template,binutils))
-
 
456
-
 
457
-
 
458
# we need to satisfy the rules, generated by the CLEAN_template, if they not exist
-
 
459
patch_remove_dummy_tools := autoconf automake avr32patches avr32headers
-
 
460
$(foreach tool,$(patch_remove_dummy_tools),$(eval $(call DUMMY_patch_remove,$(tool))))
-
 
461
conf_remove_dummy_tools := avr32patches avr32headers
-
 
462
$(foreach tool,$(conf_remove_dummy_tools),$(eval $(call DUMMY_conf_remove,$(tool))))
-
 
463
build_remove_dummy_tools := avr32patches avr32headers
-
 
464
$(foreach tool,$(build_remove_dummy_tools),$(eval $(call DUMMY_build_remove,$(tool))))
-
 
465
-
 
466
354
.PHONY: $(PHONY)
467
.PHONY: $(PHONY)
355
468
356
469
357
.PHONY: tst2 tst3
470
.PHONY: tst2 tst3
358
tst2:
471
tst2:
359
	$(call make_stamp,JES)
472
	$(call make_stamp,JES)
360
tst3:
473
tst3:
361
	$(call rm_stamp,JES)
474
	$(call rm_stamp,JES)
362
475
363
476
-
 
477
.PHONY: help
-
 
478
help:
-
 
479
	@echo ""
-
 
480
	@echo "The following targets are available:"
-
 
481
	@echo ""
-
 
482
	@echo "download-XXX	: download the required package"
-
 
483
	@echo "extract-XXX	: extract the downloaded package"
-
 
484
	@echo "conf-XXX	: configure the extracted package"
-
 
485
	@echo "build-XXX	: build the configured package"
-
 
486
	@echo "install-XXX	: install the build package"
-
 
487
	@echo "uninstall-XXX	: uninstall the installed package"
-
 
488
	@echo "clean-XXX	: clean the package source and build tree"
-
 
489
	@echo "realclean-XXX	: same as clean-XXX, but remove the downloaded"
-
 
490
	@echo "		  package, too"
-
 
491
	@echo ""
-
 
492
	@echo "XXX can be one of the following: "
-
 
493
	@echo "$(ALL_TOOLS)"
-
 
494
	@echo ""
-
 
495
	@echo "The above targets will be executed in the right order and only if"
-
 
496
	@echo "they need to be be really built. If you want to rebuild one of then"
-
 
497
	@echo "manualy, you can use the aaaa-XXX-f target (e.g.: build-autoconf-f,"
-
 
498
	@echo "download-automake-f). Please note, that not all steps are available for"
-
 
499
	@echo "all tools (e.g.: install-avr32patches is not available)."
-
 
500
	@echo ""
-
 
501
	@echo ""
-
 
502
-
 
503
364
.PHONY: install-note
504
.PHONY: install-note
365
install-note: install-tools
505
install-note: install-tools
366
	@echo
506
	@echo
367
	@echo ====== INSTALLATION NOTE ======
507
	@echo ====== INSTALLATION NOTE ======
368
	@echo Your tools have now been installed at the following prefix:
508
	@echo Your tools have now been installed at the following prefix:
Line 434... Line 574...
434
##	rm downloads/$(AUTOMAKE_ARCHIVE)
574
##	rm downloads/$(AUTOMAKE_ARCHIVE)
435
575
436
576
437
############# AVR32 PATCHES ############
577
############# AVR32 PATCHES ############
438
578
439
.PHONY: download-avr32patches download-avr32patches-force
579
##.PHONY: download-avr32patches download-avr32patches-force
440
download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
580
##download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
441
download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
581
##download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE):
442
	cd downloads && curl -LO $(AVR32PATCHES_URL)
582
##	cd downloads && curl -LO $(AVR32PATCHES_URL)
443
583
444
.PHONY: extract-avr32patches extract-avr32patches-force
584
##.PHONY: extract-avr32patches extract-avr32patches-force
445
extract-avr32patches: stamps/extract-avr32patches
585
##extract-avr32patches: stamps/extract-avr32patches
446
extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
586
##extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE)
447
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
587
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
448
	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
588
##	[ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \
449
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
589
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
450
	unzip -o $<
590
##	unzip -o $<
451
	[ -d stamps ] || mkdir stamps
591
##	[ -d stamps ] || mkdir stamps
452
	touch stamps/extract-avr32patches;
592
##	touch stamps/extract-avr32patches;
453
593
454
.PHONY: clean-avr32patches
594
##.PHONY: clean-avr32patches
455
clean-avr32patches:
595
##clean-avr32patches:
456
	rm -rf stamps/*-avr32patches source
596
##	rm -rf stamps/*-avr32patches source
457
597
458
.PHONY: realclean-avr32patches
598
##.PHONY: realclean-avr32patches
459
realclean-avr32patches: clean-avr32patches
599
##realclean-avr32patches: clean-avr32patches
460
	rm downloads/$(AVR32PATCHES_ARCHIVE)
600
##	rm downloads/$(AVR32PATCHES_ARCHIVE)
461
601
462
602
463
############# AVR32 HEADERS ############
603
############# AVR32 HEADERS ############
464
604
465
.PHONY: download-avr32headers download-avr32headers-force
605
##.PHONY: download-avr32headers download-avr32headers-force
466
download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
606
##download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE)
467
download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
607
##download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE):
468
	cd downloads && curl -LO $(AVR32HEADERS_URL)
608
##	cd downloads && curl -LO $(AVR32HEADERS_URL)
469
609
470
.PHONY: install-headers install-headers-force
610
##.PHONY: install-headers install-headers-force
471
install-headers: stamps/install-headers
611
##install-headers: stamps/install-headers
472
install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
612
##install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc
473
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
613
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
474
	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
614
##	[ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \
475
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
615
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
476
	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
616
##	unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \
477
	[ -d stamps ] || mkdir stamps
617
##	[ -d stamps ] || mkdir stamps
478
	touch stamps/install-headers;
618
##	touch stamps/install-headers;
479
619
480
.PHONY: clean-headers
620
##.PHONY: clean-headers
481
clean-headers:
621
##clean-headers:
482
	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
622
##	rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32
483
623
484
.PHONY: realclean-headers
624
##.PHONY: realclean-headers
485
realclean-headers: clean-headers
625
##realclean-headers: clean-headers
486
	rm downloads/$(AVR32HEADERS_ARCHIVE)
626
##	rm downloads/$(AVR32HEADERS_ARCHIVE)
487
627
488
628
489
################ NEWLIB ################
629
################ NEWLIB ################
490
630
491
.PHONY: download-newlib download-newlib-force
631
.PHONY: download-newlib download-newlib-force
Line 571... Line 711...
571
	rm downloads/$(NEWLIB_ARCHIVE)
711
	rm downloads/$(NEWLIB_ARCHIVE)
572
712
573
713
574
################ BINUTILS ################
714
################ BINUTILS ################
575
715
576
.PHONY: download-binutils download-binutils-force
716
##.PHONY: download-binutils download-binutils-force
577
download-binutils: downloads/$(BINUTILS_ARCHIVE)
717
##download-binutils: downloads/$(BINUTILS_ARCHIVE)
578
download-binutils-force downloads/$(BINUTILS_ARCHIVE):
718
##download-binutils-force downloads/$(BINUTILS_ARCHIVE):
579
	[ -d downloads ] || mkdir downloads ;
719
##	[ -d downloads ] || mkdir downloads ;
580
	cd downloads && curl -LO $(BINUTILS_URL)
720
##	cd downloads && curl -LO $(BINUTILS_URL)
581
721
582
.PHONY: extract-binutils extract-binutils-force
722
##.PHONY: extract-binutils extract-binutils-force
583
extract-binutils: stamps/extract-binutils
723
##extract-binutils: stamps/extract-binutils
584
extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
724
##extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE)
585
	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
725
##	@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
586
	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
726
##	[ "$$t1" = "$(BINUTILS_MD5)" ] || \
587
	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
727
##	( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
588
	tar -jxf $< ;
728
##	tar -jxf $< ;
589
	[ -d stamps ] || mkdir stamps ;
729
##	[ -d stamps ] || mkdir stamps ;
590
	touch stamps/extract-binutils;
730
##	touch stamps/extract-binutils;
591
731
592
.PHONY: patch-binutils patch-binutils-force
732
##.PHONY: patch-binutils patch-binutils-force
593
patch-binutils: stamps/patch-binutils
733
##patch-binutils: stamps/patch-binutils
594
patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
734
##patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches
595
	pushd binutils-$(BINUTILS_VERSION) ; \
735
##	pushd binutils-$(BINUTILS_VERSION) ; \
596
	for f in ../source/avr32/binutils/*.patch; do \
736
##	for f in ../source/avr32/binutils/*.patch; do \
597
	patch -N -p0 <$${f} ; \
737
##	patch -N -p0 <$${f} ; \
598
	done ; \
738
##	done ; \
599
	popd ; \
739
##	popd ; \
600
	[ -d stamps ] || mkdir stamps
740
##	[ -d stamps ] || mkdir stamps
601
	touch stamps/patch-binutils;
741
##	touch stamps/patch-binutils;
602
742
603
.PHONY: regen-binutils regen-binutils-force
743
##.PHONY: regen-binutils regen-binutils-force
604
regen-binutils: stamps/regen-binutils
744
##regen-binutils: stamps/regen-binutils
605
regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
745
##regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools
606
	pushd binutils-$(BINUTILS_VERSION) ; \
746
##	pushd binutils-$(BINUTILS_VERSION) ; \
607
	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
747
##	"$(SUPP_PREFIX)/bin/aclocal" -I config ; \
608
	"$(SUPP_PREFIX)/bin/autoconf" ; \
748
##	"$(SUPP_PREFIX)/bin/autoconf" ; \
609
	"$(SUPP_PREFIX)/bin/automake" ; \
749
##	"$(SUPP_PREFIX)/bin/automake" ; \
610
	"$(SUPP_PREFIX)/bin/autoheader" ; \
750
##	"$(SUPP_PREFIX)/bin/autoheader" ; \
611
	for dir in bfd opcodes binutils gas ld; do \
751
##	for dir in bfd opcodes binutils gas ld; do \
612
	  pushd $$dir ; \
752
##	  pushd $$dir ; \
613
	  "$(SUPP_PREFIX)/bin/autoconf"; \
753
##	  "$(SUPP_PREFIX)/bin/autoconf"; \
614
	  "$(SUPP_PREFIX)/bin/automake"; \
754
##	  "$(SUPP_PREFIX)/bin/automake"; \
615
	  "$(SUPP_PREFIX)/bin/autoheader"; \
755
##	  "$(SUPP_PREFIX)/bin/autoheader"; \
616
	  popd ; \
756
##	  popd ; \
617
	done; \
757
##	done; \
618
	popd; \
758
##	popd; \
619
	[ -d stamps ] || mkdir stamps ;
759
##	[ -d stamps ] || mkdir stamps ;
620
	touch stamps/regen-binutils;
760
##	touch stamps/regen-binutils;
621
761
622
.PHONY: build-binutils build-binutils-force
762
##.PHONY: build-binutils build-binutils-force
623
build-binutils: stamps/build-binutils
763
##build-binutils: stamps/build-binutils
624
build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
764
##build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools
625
	cd binutils-$(BINUTILS_VERSION) ; \
765
##	cd binutils-$(BINUTILS_VERSION) ; \
626
	./configure   --enable-maintainer-mode		\
766
##	./configure   --enable-maintainer-mode		\
627
	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
767
##	--prefix="$(PREFIX)" --target=$(TARGET) --disable-nls		\
628
	--disable-shared --disable-werror				\
768
##	--disable-shared --disable-werror				\
629
	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
769
##	--with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) &&	\
630
	$(MAKE) all-bfd TARGET-bfd=headers; \
770
##	$(MAKE) all-bfd TARGET-bfd=headers; \
631
	rm bfd/Makefile; \
771
##	rm bfd/Makefile; \
632
	make configure-bfd; \
772
##	make configure-bfd; \
633
	$(MAKE)
773
##	$(MAKE)
634
	[ -d stamps ] || mkdir stamps ;
774
##	[ -d stamps ] || mkdir stamps ;
635
	touch stamps/build-binutils;
775
##	touch stamps/build-binutils;
636
776
637
.PHONY: install-binutils install-binutils-force
777
##.PHONY: install-binutils install-binutils-force
638
install-binutils: stamps/install-binutils
778
##install-binutils: stamps/install-binutils
639
install-binutils-force stamps/install-binutils: stamps/build-binutils
779
##install-binutils-force stamps/install-binutils: stamps/build-binutils
640
	cd binutils-$(BINUTILS_VERSION) && \
780
##	cd binutils-$(BINUTILS_VERSION) && \
641
	$(MAKE) installdirs install-host install-target
781
##	$(MAKE) installdirs install-host install-target
642
	[ -d stamps ] || mkdir stamps ;
782
##	[ -d stamps ] || mkdir stamps ;
643
	touch stamps/install-binutils;
783
##	touch stamps/install-binutils;
644
784
645
785
646
.PHONY: clean-binutils
786
##.PHONY: clean-binutils
647
clean-binutils:
787
##clean-binutils:
648
	rm -rf build/binutils stamps/*-binutils binutils-*
788
##	rm -rf build/binutils stamps/*-binutils binutils-*
649
789
650
.PHONY: realclean-binutils
790
##.PHONY: realclean-binutils
651
realclean-binutils: clean-binutils
791
##realclean-binutils: clean-binutils
652
	rm downloads/$(BINUTILS_ARCHIVE)
792
##	rm downloads/$(BINUTILS_ARCHIVE)
653
793
654
794
655
########## DFU PROGRAMMER ###########
795
########## DFU PROGRAMMER ###########
656
796
657
.PHONY: download-dfu download-dfu-force
797
.PHONY: download-dfu download-dfu-force