23,36 → 23,16 |
# This Makefile is based on the one from here: |
# https://github.com/jsnyder/avr32-toolchain/blob/master/Makefile |
# Copyright (C) 2011 by James Snyder <jbsnyder@fanplastic.org> |
# |
|
|
|
############################################################################### |
# |
# The origial version couldn't handle delta building of parts, which is |
# required during patch development. I didn't want to fix all the different |
# make steps seperately. So I decided to use an new approach, which I never |
# tried before. I used make macros to generate the different rules for the |
# different tools. |
# This saved me a lot of work, when a new tool is added. Moreover, bugfixes |
# have to be done only one place. Enhancments of the targets need to be done |
# on only one place. |
# The drawback of this approach is a little mor complexity when writing shell |
# scripts within the make macro. You need a lot of '$' for escaping. |
# This makefile uses macros to generate the different rules for the different |
# tools. This saves a lot of work, when a new tool is added. Moreover, bugfixes |
# have to be done only one place. |
# |
# I have tested most of the targets with a lot of compinations, but there might |
# one which is not working. Please send me a bug report, if you find such a |
# combination. |
# |
# The development SVN repository can be found at |
# http://web.anw.at/websvn/listing.php?repname=avr32-toolchain |
# |
# NOTE: Currently ONLY binutils is finished! |
# |
############################################################################### |
|
|
|
#### PRIMARY TOOLCHAIN VERSIONS ##### |
|
GCC_VERSION = 4.4.3 |
75,8 → 55,6 |
GIT_REV = $(shell git rev-parse --verify HEAD --short 2> /dev/null) |
SVN_REV = $(shell head -1 ReleaseNotes 2> /dev/null | cut -f 1 -d " ") |
|
PREFIX_RELEASE ?= /opt/avr/avr32-tools |
|
ifeq ($(strip $(GIT_REV)),) |
ifeq ($(strip $(SVN_REV)),) |
PREFIX ?= $(HOME)/avr32-tools-$(TODAY) |
99,19 → 77,6 |
PROCS ?= 2 |
endif |
|
|
RELEASE_VERSION ?= no |
PREFIX_RELEASE ?= /opt/avr/avr32-tools |
|
ifneq ($(RELEASE_VERSION),no) |
FULL_STATIC = y |
PREFIX = $(PREFIX_RELEASE)-$(RELEASE_VERSION) |
endif |
|
|
# enable complete static linking |
FULL_STATIC ?= no |
|
# enable maintainer-mode with yes |
M_MODE ?= no |
|
163,7 → 128,7 |
|
NEWPATCHESBINUTILS_ARCHIVE = binutils-2.22-avr32-full.patch |
NEWPATCHESBINUTILS_URL=http://avr.anw.at/avr32/patches/binutils/2_22/$(NEWPATCHESBINUTILS_ARCHIVE) |
NEWPATCHESBINUTILS_MD5 = 09c091b9acb369fd39fb21d0334bb9a6 |
NEWPATCHESBINUTILS_MD5 = aca9dd1aaeda63fa1a0cc4c68b94fa6f |
install_dir_newpatchesbinutils := source/avr32/binutils |
|
AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip |
251,7 → 216,7 |
endef |
|
## delete all empty directories |
## need to do this several times to remove all empty sub directories |
## need to do this several times. to remove empty sub directories |
define del_all_empty-directories |
$(call del_empty-directories) |
$(call del_empty-directories) |
392,19 → 357,18 |
|
## create the configure rule and force configure rule |
define CONF_template |
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)" |
conf-$(1): $(call name_stamp,conf-$(1)) |
|
# we need configure parameters! |
ifeq ($$(strip $$($(1)_conf_opts)),) |
$$(error "Configure options '$(1)_conf_opts' not defined") |
endif |
|
conf-$(1)_TEXT := "Configuring $(1) $$($(1)_VERSION)" |
conf-$(1): $(call name_stamp,conf-$(1)) |
|
conf-$(1)-f $(call name_stamp,conf-$(1)): $(call name_stamp,$(2)-$(1)) $$($(1)_conf_deps) |
@(rm -rf $(BUILD_DIR)/$(1) ; mkdir -p $(BUILD_DIR)/$(1)) |
$(call quiet_text,$$(conf-$(1)_TEXT)) |
cd $(BUILD_DIR)/$(1) && \ |
$$($(1)_conf_env) \ |
../../$(1)-$$($(1)_VERSION)/configure $$($(1)_conf_opts) |
$(call make_stamp,conf-$(1)) |
|
431,7 → 395,6 |
$(call name_stamp,build-$(1)): $(call name_stamp,conf-$(1)) |
$(call quiet_text,$$(build-$(1)_TEXT)) |
cd $(BUILD_DIR)/$(1) && \ |
$$($(1)_build_env) \ |
$$($(1)_build_cmds) |
$(call make_stamp,build-$(1)) |
|
614,7 → 577,7 |
|
$(eval $(call DOWNLOAD_template,binutils)) |
$(eval $(call EXTRACT_template,binutils,EXT_BZ2)) |
#binutils_patch_level := -p1 |
binutils_patch_level := -p1 |
$(eval $(call PATCH_template,binutils)) |
binutils_regen_dirs := bfd opcodes binutils gas ld |
$(eval $(call REGEN_template,binutils,patch)) |
623,7 → 586,6 |
binutils_maintainer_mode := --enable-maintainer-mode |
endif |
|
# do not add a ' ' between after ":=" |
ifneq ($(BINUTILS_REGEN),no) |
binutils_conf_depend :=regen |
else |
638,14 → 600,10 |
--with-pkgversion=$(PKG_VERSION) \ |
--with-sysroot="$(PREFIX)/$(TARGET)" |
# --with-bugurl=$(BUG_URL) |
$(eval $(call CONF_template,binutils,$(binutils_conf_depend))) |
|
ifneq ($(FULL_STATIC),no) |
binutils_fulls_static := AM_LDFLAGS=-all-static |
endif |
$(eval $(call CONF_template,binutils,$(binutils_conf_depend))) |
#binutils_build_cmds := ??? |
#binutils_build_clean_cmds := ??? |
binutils_build_env := $(binutils_fulls_static) |
$(eval $(call BUILD_template,binutils)) |
$(eval $(call INSTALL_template,binutils)) |
$(eval $(call CLEAN_template,binutils)) |
656,11 → 614,15 |
|
|
|
.PHONY: tst |
.PHONY: tst tst2 tst3 |
tst: |
@echo "PREFIX=$(PREFIX)" |
@echo "PKG_VERSION=$(PKG_VERSION)" |
@echo "BUG_URL=$(BUG_URL)" |
tst2: |
$(call make_stamp,JES) |
tst3: |
$(call rm_stamp,JES) |
|
.PHONY: help |
help: |
699,17 → 661,11 |
@echo "And the package version with" |
@echo " PKG_VERSION=\"AVR 32 bit GNU Toolchain-XXX\"" |
@echo "" |
@echo "Build a full static release with" |
@echo " RELEASE_VERSION=0.1.0" |
@echo "The prefix for the release can changed with" |
@echo " PREFIX_RELEASE=/usr/local/avr/avr32-tools" |
@echo "" |
@echo "Maintainers may use" |
@echo " M_MODE=y, BINUTILS_REGEN=y, FULL_STATIC=y" |
@echo " M_MODE=y or BINUTILS_REGEN=y" |
@echo "Please have a look to the Makefile for details" |
@echo "" |
|
# do not remove the empty line, will add the required \n |
define print_target |
@echo "$(1)" |
|