# AVR32 Toolchain Makefile # # Copyright (C) 2012 by Jasmin Jessich # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # # This Makefile is based on the one from here: # https://github.com/jsnyder/avr32-toolchain/blob/master/Makefile # Copyright (C) 2011 by James Snyder # ############################################################################### # # 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. # # 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 GDB_VERSION = 6.7.1 GDB_VERSION_DLOAD = $(GDB_VERSION)a #BINUTILS_VERSION = 2.20.1 BINUTILS_VERSION = 2.22 NEWLIB_VERSION = 1.16.0 DFU_VERSION = 0.5.4 AVR_PATCH_REV = 3.2.3.261 AVR_HEADER_REV = 3.2.3.258 #### PATHS AND ENVIRONMENT VARIABLES ##### SHELL = /bin/bash TARGET = avr32 TODAY = $(shell date "+%Y%m%d") 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) TOOL_REV = $(TODAY) else PREFIX ?= $(HOME)/avr32-tools-$(SVN_REV) TOOL_REV = $(SVN_REV) BUG_URL = jasmin@anw.at endif else PREFIX ?= $(HOME)/avr32-tools-$(GIT_REV) TOOL_REV = $(GIT_REV) endif ifeq ($(UNAME), Linux) PROCS ?= $(shell grep -c ^processor /proc/cpuinfo) else ifeq ($(UNAME), Darwin) PROCS ?= $(shell sysctl hw.ncpu | awk '{print $$2}') else 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 # enable binutils autotool file regeneration with yes BINUTILS_REGEN ?= no SUPP_PREFIX = $(CURDIR)/supp PATH := ${PREFIX}/bin:${SUPP_PREFIX}/bin:${PATH} AUTOCONF = $(SUPP_PREFIX)/bin/autoconf AUTOMAKE = $(SUPP_PREFIX)/bin/automake STAMP_DIR := $(CURDIR)/stamps DOWNLOAD_DIR := $(CURDIR)/downloads BUILD_DIR := $(CURDIR)/build ifeq ($(strip $(BUG_URL)),) BUG_URL = https://github.com/jsnyder/avr32-toolchain endif #PKG_VERSION ?= "AVR 32 bit GNU Toolchain-$(AVR_PATCH_REV)-$(TOOL_REV)" PKG_VERSION ?= "AVR 32 bit GNU Toolchain-$(TOOL_REV)" #### PRIMARY TOOLCHAIN URLS ##### GCC_ARCHIVE = gcc-$(GCC_VERSION).tar.bz2 GCC_URL = http://mirror.anl.gov/pub/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE) GCC_MD5 = fe1ca818fc6d2caeffc9051fe67ff103 GDB_ARCHIVE = gdb-$(GDB_VERSION_DLOAD).tar.bz2 GDB_URL = http://mirror.anl.gov/pub/gnu/gdb/$(GDB_ARCHIVE) GDB_MD5 = 3564f308f3e4d4f2750891bc2ce9b214 BINUTILS_ARCHIVE = binutils-$(BINUTILS_VERSION).tar.bz2 BINUTILS_URL = http://mirror.anl.gov/pub/gnu/binutils/$(BINUTILS_ARCHIVE) # V 2.20.1 #BINUTILS_MD5 = 2b9dc8f2b7dbd5ec5992c6e29de0b764 # V 2.22 BINUTILS_MD5 = ee0f10756c84979622b992a4a61ea3f5 NEWLIB_ARCHIVE = newlib-$(NEWLIB_VERSION).tar.gz NEWLIB_URL = ftp://sources.redhat.com/pub/newlib/$(NEWLIB_ARCHIVE) NEWLIB_MD5 = bf8f1f9e3ca83d732c00a79a6ef29bc4 AVR32PATCHES_ARCHIVE = avr32-gnu-toolchain-$(AVR_PATCH_REV)-source.zip AVR32PATCHES_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32PATCHES_ARCHIVE) AVR32PATCHES_MD5 = 69a03828a328068f25d457cfd8341857 install_dir_avr32patches := source/avr32 NEWPATCHESBINUTILS_ARCHIVE = binutils-2.22-avr32-full.patch NEWPATCHESBINUTILS_URL=http://avr.anw.at/avr32/patches/binutils/2_22/$(NEWPATCHESBINUTILS_ARCHIVE) NEWPATCHESBINUTILS_MD5 = 09c091b9acb369fd39fb21d0334bb9a6 install_dir_newpatchesbinutils := source/avr32/binutils AVR32HEADERS_ARCHIVE = avr32-headers-$(AVR_HEADER_REV).zip AVR32HEADERS_URL=http://www.atmel.com/dyn/resources/prod_documents/$(AVR32HEADERS_ARCHIVE) AVR32HEADERS_MD5 = 3293d70a46e460d342e1f939b8e0d228 DFU_ARCHIVE = dfu-programmer-$(DFU_VERSION).tar.gz DFU_URL = http://surfnet.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/$(DFU_VERSION)/$(DFU_ARCHIVE) DFU_MD5 = 707dcd0f957a74e92456ea6919faa772 ##### SUPPORT TOOLS VERSIONS / URLS ###### AUTOCONF_VERSION = 2.64 #AUTOMAKE_VERSION = 1.11 AUTOMAKE_VERSION = 1.11.1 LIBTOOL_VERSION = 2.2.6b DEJAGNU_VERSION = 1.5 MPC_VERSION = 0.8.1 AUTOCONF_ARCHIVE = autoconf-$(AUTOCONF_VERSION).tar.bz2 AUTOCONF_URL = http://mirror.anl.gov/pub/gnu/autoconf/$(AUTOCONF_ARCHIVE) AUTOCONF_MD5 = ef400d672005e0be21e0d20648169074 AUTOMAKE_ARCHIVE = automake-$(AUTOMAKE_VERSION).tar.bz2 AUTOMAKE_URL = http://mirror.anl.gov/pub/gnu/automake/$(AUTOMAKE_ARCHIVE) # V 1.11 #AUTOMAKE_MD5 = 4db4efe027e26b33930a7e151de19d0f # V 1.11.1 AUTOMAKE_MD5 = c2972c4d9b3e29c03d5f2af86249876f LIBTOOL_ARCHIVE = libtool-$(LIBTOOL_VERSION).tar.gz LIBTOOL_URL = http://mirror.anl.gov/pub/gnu/libtool/$(LIBTOOL_ARCHIVE) LIBTOOL_MD5 = 07da460450490148c6d2df0f21481a25 DEJAGNU_ARCHIVE = dejagnu-$(DEJAGNU_VERSION).tar.gz DEJAGNU_URL = http://mirror.anl.gov/pub/gnu/dejagnu/$(DEJAGNU_ARCHIVE) DEJAGNU_MD5 = 3df1cbca885e751e22d3ebd1ac64dc3c SUPP_TOOLS := autoconf automake libtool SUPP_TOOLS_TEST := dejagnu ALL_TOOLS := gcc gdb binutils newlib avr32patches avr32headers dfu \ newpatchesbinutils \ $(SUPP_TOOLS) $(SUPP_TOOLS_TEST) all: install-cross ############ MACROS for the lazy people ;-) ############ ## in silent mode (make -s),, print whats ging on ifeq ($(strip $(MAKEFLAGS)),s) define quiet_text @echo "$1" endef else define quiet_text endef endif ## the stamp name define name_stamp $(STAMP_DIR)/$(1) endef ## remove a stamp define rm_stamp rm -f $(STAMP_DIR)/$(1) endef ## remove all stamps define rm_stamps rm -f $(STAMP_DIR)/*-$(1) endef ## create the stamp directory if not existing and the stamp define make_stamp @[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR) date > $(STAMP_DIR)/$(1) endef ## delete empty directories define del_empty-directories @find . -type d -empty -not -path "*.git*" -not -path "*.svn*" -delete endef ## delete all empty directories ## need to do this several times to remove all empty sub directories define del_all_empty-directories $(call del_empty-directories) $(call del_empty-directories) $(call del_empty-directories) $(call del_empty-directories) $(call del_empty-directories) endef ## to make the following macros more simply, we need the variables ## with the tool name in lowercase. I could have changed the original ## definition, but I don't want to break the make convention of upper ## case definitions for such user defined variables. define LOWER_TOOL_VARS UP_$(1) := $(shell echo "$(1)" | tr '[a-z]' '[A-Z]') $(1)_VERSION := $$($$(UP_$(1))_VERSION) $(1)_ARCHIVE := $$($$(UP_$(1))_ARCHIVE) $(1)_URL := $$($$(UP_$(1))_URL) $(1)_MD5 := $$($$(UP_$(1))_MD5) endef $(foreach tool,$(ALL_TOOLS),$(eval $(call LOWER_TOOL_VARS,$(tool)))) ## create the download rule and force download rule define DOWNLOAD_template download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE) download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE): [ -d $(DOWNLOAD_DIR) ] || mkdir -p $(DOWNLOAD_DIR) cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL) download-$(1)_TEXT := "Removing $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE)" download-$(1)-remove: $(call quiet_text,$$(download-$(1)_TEXT)) rm -f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE) available_targets += download-$(1) download-$(1)-f download-$(1)-remove PHONY += download-$(1) download-$(1)-f download-$(1)-remove endef ## extract commands EXT_BZ2 := tar -jxf EXT_TGZ := tar -xf EXT_ZIP := unzip -o ## create the extract rule and force extract rule define EXTRACT_template $(1)_extract_cmds ?= $($(2)) $$< $(3) extract-$(1)_TEXT := "Extracting $$($(1)_ARCHIVE)" extract-$(1): $(call name_stamp,extract-$(1)) extract-$(1)-f $(call name_stamp,extract-$(1)): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE) @(rm -rf $(1)-*; \ t1=`openssl md5 $$< | cut -f 2 -d " " -` && \ [ "$$$$t1" = "$$($(1)_MD5)" ] || \ ( echo "Bad Checksum! Please remove the following file and retry: $$<" && false )) $(call quiet_text,$$(extract-$(1)_TEXT)) $$($(1)_extract_cmds) $(call make_stamp,extract-$(1)) extract-$(1)-remove: rm -rf $(1)-* $(call rm_stamp,extract-$(1)) clean_extract_$(1)_rule := extract-$(1)-remove available_targets += extract-$(1) extract-$(1)-f extract-$(1)-remove PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove endef ## create the patch rule define PATCH_template $(1)_patch_level ?= -p0 patch-$(1)_TEXT := "Patching $$($(1)_ARCHIVE)" patch-$(1): $(call name_stamp,patch-$(1)) $(call name_stamp,patch-$(1)): $(call name_stamp,extract-$(1)) $(call name_stamp,extract-avr32patches) \ $(call name_stamp,extract-newpatchesbinutils) $(call quiet_text,$$(patch-$(1)_TEXT)) @(pushd $(1)-$$($(1)_VERSION) ; \ for f in ../$(install_dir_avr32patches)/$(1)/*.patch; do \ echo "Patching using: $$$${f}" ; \ patch -N $$($(1)_patch_level) --no-backup-if-mismatch -i $$$${f} ; \ if [ $$$$? -ne 0 ] ; then exit -1 ; fi ; \ done ; \ popd) $(call make_stamp,patch-$(1)) patch-$(1)-remove: extract-$(1)-remove $(call rm_stamp,patch-$(1)) clean_patch_$(1)_rule := patch-$(1)-remove available_targets += patch-$(1) patch-$(1)-remove PHONY += patch-$(1) patch-$(1)-remove endef ## one rule for all required support tools install-supp-tools_targets := $(foreach tool,$(SUPP_TOOLS),$(call name_stamp,install-$(tool))) install-supp-tools: $(install-supp-tools_targets) clean-supp-tools: $(foreach tool,$(SUPP_TOOLS),clean-$(tool)) available_targets += install-supp-tools clean-supp-tools PHONY += install-supp-tools clean-supp-tools ## create the regen rule ## it is used to regenerate the auto tools result files define REGEN_template regen-$(1)_TEXT := "Regenerate auto tool files for $$($(1)_ARCHIVE)" regen-$(1): $(call name_stamp,regen-$(1)) regen-$(1)-f $(call name_stamp,regen-$(1)): $(call name_stamp,$(2)-$(1)) \ $(install-supp-tools_targets) $(call quiet_text,$$(regen-$(1)_TEXT)) @(pushd $(1)-$$($(1)_VERSION) ; \ PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \ for dir in $$($(1)_regen_dirs) ; do \ pushd $$$$dir ; \ PATH=$(SUPP_PREFIX)/bin:$$$${PATH} $(SUPP_PREFIX)/bin/autoreconf -v ; \ popd ; \ done; \ popd) $(call make_stamp,regen-$(1)) regen-$(1)-remove: $(call rm_stamp,regen-$(1)) clean_regen_$(1)_rule := regen-$(1)-remove available_targets += regen-$(1) regen-$(1)-f regen-$(1)-remove PHONY += regen-$(1) regen-$(1)-f regen-$(1)-remove endef ## create the configure rule and force configure rule define CONF_template # 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)) conf-$(1)-remove: $(call rm_stamp,conf-$(1)) clean_conf_$(1)_rule := conf-$(1)-remove available_targets += conf-$(1) conf-$(1)-f conf-$(1)-remove PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove endef ## create the build rule and force build rule define BUILD_template build-$(1): $(call name_stamp,build-$(1)) build-$(1)-f: build-$(1)-clean build-$(1) # default commands overrideable $(1)_build_cmds ?= $(MAKE) -j$(PROCS) $(1)_build_clean_cmds ?= $(MAKE) clean build-$(1)_TEXT := "Building $(1) $$($(1)_VERSION)" $(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)) build-$(1)-clean_TEXT := "Cleaning $(1) $$($(1)_VERSION)" build-$(1)-clean: $(call quiet_text,$$(build-$(1)-clean_TEXT)) cd $(BUILD_DIR)/$(1) && \ $$($(1)_build_clean_cmds) $(call rm_stamp,build-$(1)) build-$(1)-remove: rm -rf $(BUILD_DIR)/$(1) $(call rm_stamp,build-$(1)) clean_build_$(1)_rule := build-$(1)-remove available_targets += build-$(1) build-$(1)-f build-$(1)-clean build-$(1)-remove PHONY += build-$(1) build-$(1)-f build-$(1)-clean build-$(1)-remove endef ## create the install rule and force install rule define INSTALL_template install-$(1)_TEXT := "Installing $(1) $$($(1)_VERSION)" install-$(1): $(call name_stamp,install-$(1)) install-$(1)-f $(call name_stamp,install-$(1)): $(call name_stamp,build-$(1)) $(call quiet_text,$$(install-$(1)_TEXT)) cd $(BUILD_DIR)/$(1) && \ $(MAKE) install $(call make_stamp,install-$(1)) uninstall-$(1)_TEXT := "Uninstalling $(1) $$($(1)_VERSION)" uninstall-$(1): $(call quiet_text,$$(uninstall-$(1)_TEXT)) [ -f $(BUILD_DIR)/$(1)/Makefile ] && \ [ -f $(call name_stamp,install-$(1)) ] && \ cd $(BUILD_DIR)/$(1) && \ $(MAKE) uninstall || true $(call rm_stamp,install-$(1)) clean_uninstall_$(1)_rule := uninstall-$(1) available_targets += install-$(1) install-$(1)-f uninstall-$(1) PHONY += install-$(1) install-$(1)-f uninstall-$(1) endef ## create the clean rule and realclean rule define CLEAN_template clean-$(1)_TEXT := "Cleaning $(1) $$($(1)_VERSION)" clean-$(1)-text: $(call quiet_text,$$(clean-$(1)_TEXT)) clean-$(1): clean-$(1)-text $$(clean_uninstall_$(1)_rule) $$(clean_extract_$(1)_rule) \ $$(clean_patch_$(1)_rule) $$(clean_regen_$(1)_rule) $$(clean_build_$(1)_rule) \ $$(clean_conf_$(1)_rule) $(call del_all_empty-directories) clean_rules += clean-$(1) realclean-$(1): clean-$(1) download-$(1)-remove $(call del_all_empty-directories) realclean_rules += realclean-$(1) available_targets += clean-$(1) realclean-$(1) PHONY += clean-$(1) realclean-$(1) clean-$(1)-text endef ############# SUPP: AUTOCONF ############ $(eval $(call DOWNLOAD_template,autoconf)) $(eval $(call EXTRACT_template,autoconf,EXT_BZ2)) autoconf_conf_opts := --prefix="$(SUPP_PREFIX)" $(eval $(call CONF_template,autoconf,extract)) $(eval $(call BUILD_template,autoconf)) $(eval $(call INSTALL_template,autoconf)) $(eval $(call CLEAN_template,autoconf)) ############ SUPP: AUTOMAKE ############ $(eval $(call DOWNLOAD_template,automake)) $(eval $(call EXTRACT_template,automake,EXT_BZ2)) automake_conf_opts := --prefix="$(SUPP_PREFIX)" # automake needs the new autoconf allready installed automake_conf_deps := $(call name_stamp,install-autoconf) $(eval $(call CONF_template,automake,extract)) $(eval $(call BUILD_template,automake)) $(eval $(call INSTALL_template,automake)) $(eval $(call CLEAN_template,automake)) ############ SUPP: LIBTOOL ############ $(eval $(call DOWNLOAD_template,libtool)) $(eval $(call EXTRACT_template,libtool,EXT_TGZ)) libtool_conf_opts := --prefix="$(SUPP_PREFIX)" # libtool needs the new autoconf/automake allready installed libtool_conf_deps := $(call name_stamp,install-autoconf) \ $(call name_stamp,install-automake) $(eval $(call CONF_template,libtool,extract)) $(eval $(call BUILD_template,libtool)) $(eval $(call INSTALL_template,libtool)) $(eval $(call CLEAN_template,libtool)) ############ SUPP-TEST: DEJAGNU ############ $(eval $(call DOWNLOAD_template,dejagnu)) $(eval $(call EXTRACT_template,dejagnu,EXT_TGZ)) dejagnu_conf_opts := --prefix="$(SUPP_PREFIX)" # dejagnu needs the new autoconf/automake allready installed dejagnu_conf_deps := $(call name_stamp,install-autoconf) \ $(call name_stamp,install-automake) $(eval $(call CONF_template,dejagnu,extract)) $(eval $(call BUILD_template,dejagnu)) $(eval $(call INSTALL_template,dejagnu)) $(eval $(call CLEAN_template,dejagnu)) ############# AVR32 PATCHES ############ $(eval $(call DOWNLOAD_template,avr32patches)) $(eval $(call EXTRACT_template,avr32patches,EXT_ZIP)) ## use the uninstall-XXX rule to remove the patches directory PHONY += uninstall-avr32patches uninstall-avr32patches: rm -rf $(install_dir_avr32patches) clean_uninstall_avr32patches_rule = uninstall-avr32patches $(eval $(call CLEAN_template,avr32patches)) ############# NEWPATCHESBINUTILS ############ $(eval $(call DOWNLOAD_template,newpatchesbinutils)) newpatchesbinutils_extract_cmds := \ @([ -d $(install_dir_newpatchesbinutils) ] && \ mv $(install_dir_newpatchesbinutils) $(install_dir_newpatchesbinutils).x ; \ mkdir -p $(install_dir_newpatchesbinutils) ; \ cp $(DOWNLOAD_DIR)/$(NEWPATCHESBINUTILS_ARCHIVE) $(install_dir_newpatchesbinutils) \ ) $(eval $(call EXTRACT_template,newpatchesbinutils)) ## use the uninstall-XXX rule to remove the patches directory PHONY += uninstall-avr32patches uninstall-newpatchesbinutils: rm -rf $(install_dir_newpatchesbinutils) clean_uninstall_newpatchesbinutils_rule = uninstall-newpatchesbinutils $(eval $(call CLEAN_template,newpatchesbinutils)) ############# AVR32 HEADERS ############ $(eval $(call DOWNLOAD_template,avr32headers)) ###### FIXME: Need to add a dependency to "stamps/install-final-gcc" install_path_avr32headers := $(PREFIX)/$(TARGET)/include avr32headers_unzip_opt := -d "$(install_path_avr32headers)" $(eval $(call EXTRACT_template,avr32headers,EXT_ZIP,$(avr32headers_unzip_opt))) ## use the uninstall-XXX rule to remove the patches directory install_dir_avr32headers := $(install_path_avr32headers)/avr32 PHONY += uninstall-avr32headers uninstall-avr32headers: rm -rf $(install_dir_avr32headers) clean_uninstall_avr32headers_rule = uninstall-avr32headers $(eval $(call CLEAN_template,avr32headers)) ################ BINUTILS ################ $(eval $(call DOWNLOAD_template,binutils)) $(eval $(call EXTRACT_template,binutils,EXT_BZ2)) #binutils_patch_level := -p1 $(eval $(call PATCH_template,binutils)) binutils_regen_dirs := bfd opcodes binutils gas ld $(eval $(call REGEN_template,binutils,patch)) ifneq ($(M_MODE),no) binutils_maintainer_mode := --enable-maintainer-mode endif # do not add a ' ' between after ":=" ifneq ($(BINUTILS_REGEN),no) binutils_conf_depend :=regen else binutils_conf_depend :=patch endif binutils_conf_opts := \ $(binutils_maintainer_mode) \ --prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \ --disable-shared --disable-werror \ --enable-ld=yes --enable-gold=no \ --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 #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)) .PHONY: $(PHONY) .PHONY: tst tst: @echo "PREFIX=$(PREFIX)" @echo "PKG_VERSION=$(PKG_VERSION)" @echo "BUG_URL=$(BUG_URL)" .PHONY: help help: @echo "" @echo "The following targets are available:" @echo "" @echo "download-XXX : download the required package" @echo "extract-XXX : extract the downloaded package" @echo "conf-XXX : configure the extracted package" @echo "build-XXX : build the configured package" @echo "install-XXX : install the build package" @echo "uninstall-XXX : uninstall the installed package" @echo "clean-XXX : clean the package source and build tree" @echo "realclean-XXX : same as clean-XXX, but remove the downloaded" @echo " package, too" @echo "" @echo "XXX can be one of the following:" @echo "$(ALL_TOOLS)" @echo "supp-tools" @echo "" @echo "The above targets will be executed in the right order and only if" @echo "they need to be be really built. If you want to rebuild one of them" @echo "manualy, you can use the aaaa-XXX-f target (e.g.: build-autoconf-f," @echo "download-automake-f). Please note, that not all steps are available for" @echo "all tools (e.g.: install-avr32patches is not available)." @echo "" @echo "clean : clean all; execute all clean-XXX rules" @echo "realclean : same as clean, but remove all downloaded" @echo " packages, too (execute all realclean-XXX rules)" @echo "" @echo "help : this inforamtion" @echo "helpx : this inforamtion + available targets" @echo "" @echo "The installation prefix can be set by" @echo " PREFIX=.... make aaa-XXX" @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 "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)" endef .PHONY: helpx helpx: help @echo "Available targets:" $(foreach target,$(available_targets),$(call print_target,$(target))) @echo "" .PHONY: install-note install-note: install-tools @echo "" @echo "====== INSTALLATION NOTE ======" @echo "Your tools have now been installed at the following prefix:" @echo "$(PREFIX)" @echo @echo "Please be sure to add something similar to the following to your .bash_profile, .zshrc, etc:" @echo ' export PATH="$(PREFIX)/bin:$$PATH"' @echo .PHONY: install-tools install-tools: install-binutils # FIXME: other currently not finished # install-final-gcc install-newlib install-headers .PHONY: install-cross install-cross: install-tools install-note .PHONY : clean realclean clean: $(clean_rules) realclean: $(realclean_rules) ################################################################# ################################################################# #### ###### #### ###### #### ###### #### FROM HERE ON OLD CODE OF ORIGINAL MAKEFILE ###### #### COMPLETELY UNSUPPORTED AND FOR PATTERN FOR ###### #### ADDITIONAL WORK ONLY ###### #### ###### #### ###### #### ###### ################################################################# ################################################################# ############ SUPP: AUTOMAKE ############ ##.PHONY: download-automake download-automake-force ##download-automake: downloads/$(AUTOMAKE_ARCHIVE) ##download-automake-force downloads/$(AUTOMAKE_ARCHIVE): ## [ -d downloads ] || mkdir downloads ; ## cd downloads && curl -LO $(AUTOMAKE_URL) ##.PHONY: extract-automake extract-automake-force ##extract-automake: stamps/extract-automake ##extract-automake-force stamps/extract-automake: downloads/$(AUTOMAKE_ARCHIVE) ## @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ ## [ "$$t1" = "$(AUTOMAKE_MD5)" ] || \ ## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) ## tar -jxf $< ; ## [ -d stamps ] || mkdir stamps ; ## touch stamps/extract-automake; ##.PHONY: build-automake build-automake-force ##build-automake: stamps/build-automake ##build-automake-force stamps/build-automake: stamps/extract-automake stamps/install-autoconf ## mkdir -p build/automake && cd build/automake && \ ## ../../automake-$(AUTOMAKE_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \ ## $(MAKE) -j$(PROCS) ## [ -d stamps ] || mkdir stamps ## touch stamps/build-automake; ##.PHONY: install-automake install-automake-force ##install-automake: stamps/install-automake ##install-automake-force stamps/install-automake: stamps/build-automake ## cd build/automake && \ ## $(MAKE) install ## [ -d stamps ] || mkdir stamps ## touch stamps/install-automake; ##.PHONY: clean-automake ##clean-automake: ## rm -rf build/automake stamps/*-automake automake-* ##.PHONY: realclean-automake ##realclean-automake: clean-automake ## rm downloads/$(AUTOMAKE_ARCHIVE) ############# AVR32 PATCHES ############ ##.PHONY: download-avr32patches download-avr32patches-force ##download-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE) ##download-avr32patches-force downloads/$(AVR32PATCHES_ARCHIVE): ## cd downloads && curl -LO $(AVR32PATCHES_URL) ##.PHONY: extract-avr32patches extract-avr32patches-force ##extract-avr32patches: stamps/extract-avr32patches ##extract-avr32patches-force stamps/extract-avr32patches: downloads/$(AVR32PATCHES_ARCHIVE) ## @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ ## [ "$$t1" = "$(AVR32PATCHES_MD5)" ] || \ ## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) ## unzip -o $< ## [ -d stamps ] || mkdir stamps ## touch stamps/extract-avr32patches; ##.PHONY: clean-avr32patches ##clean-avr32patches: ## rm -rf stamps/*-avr32patches source ##.PHONY: realclean-avr32patches ##realclean-avr32patches: clean-avr32patches ## rm downloads/$(AVR32PATCHES_ARCHIVE) ############# AVR32 HEADERS ############ ##.PHONY: download-avr32headers download-avr32headers-force ##download-avr32headers: downloads/$(AVR32HEADERS_ARCHIVE) ##download-avr32headers-force downloads/$(AVR32HEADERS_ARCHIVE): ## cd downloads && curl -LO $(AVR32HEADERS_URL) ##.PHONY: install-headers install-headers-force ##install-headers: stamps/install-headers ##install-headers-force stamps/install-headers: downloads/$(AVR32HEADERS_ARCHIVE) stamps/install-final-gcc ## @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ ## [ "$$t1" = "$(AVR32HEADERS_MD5)" ] || \ ## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) ## unzip -o $< -d "$(PREFIX)/$(TARGET)/include/" && \ ## [ -d stamps ] || mkdir stamps ## touch stamps/install-headers; ##.PHONY: clean-headers ##clean-headers: ## rm -rf stamps/*-headers $(PREFIX)/$(TARGET)/include/avr32 ##.PHONY: realclean-headers ##realclean-headers: clean-headers ## rm downloads/$(AVR32HEADERS_ARCHIVE) ################ NEWLIB ################ .PHONY: download-newlib download-newlib-force download-newlib: downloads/$(NEWLIB_ARCHIVE) download-newlib-force downloads/$(NEWLIB_ARCHIVE): [ -d downloads ] || mkdir downloads ; cd downloads && curl -LO $(NEWLIB_URL) .PHONY: extract-newlib extract-newlib-force extract-newlib: stamps/extract-newlib extract-newlib-force stamps/extract-newlib : downloads/$(NEWLIB_ARCHIVE) @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ [ "$$t1" = "$(NEWLIB_MD5)" ] || \ ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) tar -xf $< [ -d stamps ] || mkdir stamps touch stamps/extract-newlib; .PHONY: patch-newlib patch-newlib-force patch-newlib: stamps/patch-newlib patch-newlib-force stamps/patch-newlib: stamps/extract-newlib stamps/extract-avr32patches pushd newlib-$(NEWLIB_VERSION) ; \ for f in ../source/avr32/newlib/*.patch; do \ patch -N -p0 <$${f} ; \ done ; \ popd ; [ -d stamps ] || mkdir stamps touch stamps/patch-newlib; .PHONY: regen-newlib regen-newlib-force regen-newlib: stamps/regen-newlib regen-newlib-force stamps/regen-newlib: stamps/patch-newlib stamps/install-supp-tools pushd newlib-$(NEWLIB_VERSION) ; \ "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake" ; \ for dir in newlib/libc/machine/avr32 newlib/libc/machine newlib/libc/sys/avr32 newlib/libc/sys; do \ pushd $$dir ; \ "$(SUPP_PREFIX)/bin/aclocal" -I ../.. -I ../../.. -I ../../../.. ; \ "$(SUPP_PREFIX)/bin/autoconf"; "$(SUPP_PREFIX)/bin/automake"; \ popd ; \ done; \ popd; [ -d stamps ] || mkdir stamps touch stamps/regen-newlib; NEWLIB_FLAGS="-ffunction-sections -fdata-sections \ -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g -Os \ -fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=128 \ -DSMALL_MEMORY" .PHONY: build-newlib build-newlib-force build-newlib: stamps/build-newlib build-newlib-force stamps/build-newlib: stamps/regen-newlib stamps/install-binutils stamps/install-gcc mkdir -p build/newlib && cd build/newlib && \ pushd ../../newlib-$(NEWLIB_VERSION) ; \ make clean ; \ popd ; \ ../../newlib-$(NEWLIB_VERSION)/configure --prefix=$(PREFIX) \ --with-build-time-tools=$(PREFIX) \ --target=$(TARGET) --disable-newlib-supplied-syscalls \ --disable-libgloss --disable-nls --disable-shared \ --enable-newlib-io-long-long --enable-newlib-io-long-double \ --enable-target-optspace --enable-newlib-io-pos-args \ --enable-newlib-reent-small && \ $(MAKE) -j$(PROCS) CFLAGS_FOR_TARGET=$(NEWLIB_FLAGS) CCASFLAGS=$(NEWLIB_FLAGS) && \ [ -d stamps ] || mkdir stamps touch stamps/build-newlib; .PHONY: install-newlib install-newlib-force install-newlib: stamps/install-newlib install-newlib-force stamps/install-newlib: stamps/build-newlib cd build/newlib && \ $(MAKE) install [ -d stamps ] || mkdir stamps touch stamps/install-newlib; .PHONY: clean-newlib clean-newlib: rm -rf build/newlib stamps/*-newlib newlib-* .PHONY: realclean-newlib realclean-newlib: clean-newlib rm downloads/$(NEWLIB_ARCHIVE) ################ BINUTILS ################ ##.PHONY: download-binutils download-binutils-force ##download-binutils: downloads/$(BINUTILS_ARCHIVE) ##download-binutils-force downloads/$(BINUTILS_ARCHIVE): ## [ -d downloads ] || mkdir downloads ; ## cd downloads && curl -LO $(BINUTILS_URL) ##.PHONY: extract-binutils extract-binutils-force ##extract-binutils: stamps/extract-binutils ##extract-binutils-force stamps/extract-binutils: downloads/$(BINUTILS_ARCHIVE) ## @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ ## [ "$$t1" = "$(BINUTILS_MD5)" ] || \ ## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) ## tar -jxf $< ; ## [ -d stamps ] || mkdir stamps ; ## touch stamps/extract-binutils; ##.PHONY: patch-binutils patch-binutils-force ##patch-binutils: stamps/patch-binutils ##patch-binutils-force stamps/patch-binutils: stamps/extract-binutils stamps/extract-avr32patches ## pushd binutils-$(BINUTILS_VERSION) ; \ ## for f in ../source/avr32/binutils/*.patch; do \ ## patch -N -p0 <$${f} ; \ ## done ; \ ## popd ; \ ## [ -d stamps ] || mkdir stamps ## touch stamps/patch-binutils; ##.PHONY: regen-binutils regen-binutils-force ##regen-binutils: stamps/regen-binutils ##regen-binutils-force stamps/regen-binutils: stamps/patch-binutils stamps/install-supp-tools ## pushd binutils-$(BINUTILS_VERSION) ; \ ## "$(SUPP_PREFIX)/bin/aclocal" -I config ; \ ## "$(SUPP_PREFIX)/bin/autoconf" ; \ ## "$(SUPP_PREFIX)/bin/automake" ; \ ## "$(SUPP_PREFIX)/bin/autoheader" ; \ ## for dir in bfd opcodes binutils gas ld; do \ ## pushd $$dir ; \ ## "$(SUPP_PREFIX)/bin/autoconf"; \ ## "$(SUPP_PREFIX)/bin/automake"; \ ## "$(SUPP_PREFIX)/bin/autoheader"; \ ## popd ; \ ## done; \ ## popd; \ ## [ -d stamps ] || mkdir stamps ; ## touch stamps/regen-binutils; ##.PHONY: build-binutils build-binutils-force ##build-binutils: stamps/build-binutils ##build-binutils-force stamps/build-binutils: stamps/regen-binutils stamps/install-supp-tools ## cd binutils-$(BINUTILS_VERSION) ; \ ## ./configure --enable-maintainer-mode \ ## --prefix="$(PREFIX)" --target=$(TARGET) --disable-nls \ ## --disable-shared --disable-werror \ ## --with-sysroot="$(PREFIX)/$(TARGET)" --with-bugurl=$(BUG_URL) && \ ## $(MAKE) all-bfd TARGET-bfd=headers; \ ## rm bfd/Makefile; \ ## make configure-bfd; \ ## $(MAKE) ## [ -d stamps ] || mkdir stamps ; ## touch stamps/build-binutils; ##.PHONY: install-binutils install-binutils-force ##install-binutils: stamps/install-binutils ##install-binutils-force stamps/install-binutils: stamps/build-binutils ## cd binutils-$(BINUTILS_VERSION) && \ ## $(MAKE) installdirs install-host install-target ## [ -d stamps ] || mkdir stamps ; ## touch stamps/install-binutils; ##.PHONY: clean-binutils ##clean-binutils: ## rm -rf build/binutils stamps/*-binutils binutils-* ##.PHONY: realclean-binutils ##realclean-binutils: clean-binutils ## rm downloads/$(BINUTILS_ARCHIVE) ########## DFU PROGRAMMER ########### .PHONY: download-dfu download-dfu-force download-dfu: downloads/$(DFU_ARCHIVE) download-dfu-force downloads/$(DFU_ARCHIVE): [ -d downloads ] || mkdir downloads ; cd downloads && curl -LO $(DFU_URL) .PHONY: extract-dfu extract-dfu-force extract-dfu: stamps/extract-dfu extract-dfu-force stamps/extract-dfu: downloads/$(DFU_ARCHIVE) @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ [ "$$t1" = "$(DFU_MD5)" ] || \ ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) tar -zxf $< ; [ -d stamps ] || mkdir stamps ; touch stamps/extract-dfu; .PHONY: build-dfu build-dfu-force build-dfu: stamps/build-dfu build-dfu-force stamps/build-dfu: stamps/extract-dfu mkdir -p build/dfu-programmer && cd build/dfu-programmer && \ ../../dfu-programmer-$(DFU_VERSION)/configure --prefix="$(PREFIX)" && \ $(MAKE) -j$(PROCS) [ -d stamps ] || mkdir stamps touch stamps/build-dfu; .PHONY: install-dfu install-dfu-force install-dfu: stamps/install-dfu install-dfu-force stamps/install-dfu: stamps/build-dfu cd build/dfu-programmer && \ $(MAKE) install [ -d stamps ] || mkdir stamps touch stamps/install-dfu; .PHONY: clean-dfu clean-dfu: rm -rf build/dfu stamps/*-dfu dfu-* .PHONY: realclean-dfu realclean-dfu: clean-dfu rm downloads/$(DFU_ARCHIVE) ################ Bootstrap GCC ################ .PHONY: download-gcc download-gcc-force download-gcc: downloads/$(GCC_ARCHIVE) download-gcc-force downloads/$(GCC_ARCHIVE): [ -d downloads ] || mkdir downloads ; cd downloads && curl -LO $(GCC_URL) .PHONY: extract-gcc extract-gcc-force extract-gcc: stamps/extract-gcc extract-gcc-force stamps/extract-gcc: downloads/$(GCC_ARCHIVE) @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ [ "$$t1" = "$(GCC_MD5)" ] || \ ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) tar -jxf $< ; [ -d stamps ] || mkdir stamps ; touch stamps/extract-gcc; .PHONY: patch-gcc patch-gcc-force patch-gcc: stamps/patch-gcc patch-gcc-force stamps/patch-gcc: stamps/extract-gcc stamps/extract-avr32patches pushd gcc-$(GCC_VERSION) ; \ for f in ../source/avr32/gcc/*.patch; do \ patch -N -p0 <$${f} ; \ done ; \ popd ; [ -d stamps ] || mkdir stamps touch stamps/patch-gcc; CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections \ -fomit-frame-pointer -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -g \ -Os -fno-unroll-loops" .PHONY: build-gcc build-gcc-force build-gcc: stamps/build-gcc build-gcc-force stamps/build-gcc: stamps/install-binutils stamps/patch-gcc mkdir -p build/gcc && cd build/gcc && \ pushd ../../gcc-$(GCC_VERSION) ; \ make clean ; \ popd ; \ ../../gcc-$(GCC_VERSION)/configure --prefix="$(PREFIX)" \ --target=$(TARGET) --enable-languages="c" --with-gnu-ld \ --with-gnu-as --with-newlib --disable-nls --disable-libssp \ --with-dwarf2 --enable-sjlj-exceptions \ --enable-version-specific-runtime-libs --disable-libstdcxx-pch \ --disable-shared \ --with-build-time-tools="$(PREFIX)/$(TARGET)/bin" \ --enable-cxx-flags=$(CFLAGS_FOR_TARGET) \ --with-sysroot="$(PREFIX)/$(TARGET)" \ --with-build-sysroot="$(PREFIX)/$(TARGET)" \ --with-build-time-tools="$(PREFIX)/$(TARGET)/bin" \ CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \ LDFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\"" \ CPPFLAGS_FOR_TARGET="--sysroot=\"$(PREFIX)/$(TARGET)\"" \ --with-bugurl=$(BUG_URL) \ --with-pkgversion=$(PKG_VERSION) && \ $(MAKE) -j$(PROCS) [ -d stamps ] || mkdir stamps touch stamps/build-gcc; .PHONY: install-gcc install-gcc-force install-gcc: stamps/install-gcc install-gcc-force stamps/install-gcc: stamps/build-gcc cd build/gcc && \ $(MAKE) installdirs install-target && \ $(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man [ -d stamps ] || mkdir stamps touch stamps/install-gcc; .PHONY: clean-gcc clean-gcc: rm -rf build/gcc stamps/*-gcc gcc-* .PHONY: realclean-gcc realclean-gcc: clean-gcc rm downloads/$(GCC_ARCHIVE) ################ Final GCC ################ .PHONY: build-final-gcc build-final-gcc-force build-final-gcc: stamps/build-final-gcc build-final-gcc-force stamps/build-final-gcc: stamps/install-binutils stamps/install-gcc stamps/install-newlib stamps/patch-gcc mkdir -p build/final-gcc && cd build/final-gcc && \ pushd ../../gcc-$(GCC_VERSION) ; \ make clean ; \ popd ; \ ../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX) \ --target=$(TARGET) $(DEPENDENCIES) --enable-languages="c,c++" --with-gnu-ld \ --with-gnu-as --with-newlib --disable-nls --disable-libssp \ --with-dwarf2 --enable-sjlj-exceptions \ --enable-version-specific-runtime-libs --disable-libstdcxx-pch \ --disable-shared --enable-__cxa_atexit \ --with-build-time-tools=$(PREFIX)/$(TARGET)/bin \ --enable-cxx-flags=$(CFLAGS_FOR_TARGET) \ --with-sysroot=$(PREFIX)/$(TARGET) \ --with-build-sysroot=$(PREFIX)/$(TARGET) \ --with-build-time-tools=$(PREFIX)/$(TARGET)/bin \ CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) \ LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \ CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)" \ --with-bugurl=$(BUG_URL) \ --with-pkgversion=$(PKG_VERSION) && \ $(MAKE) -j$(PROCS) [ -d stamps ] || mkdir stamps touch stamps/build-final-gcc; .PHONY: install-final-gcc install-final-gcc-force install-final-gcc: stamps/install-final-gcc install-final-gcc-force stamps/install-final-gcc: stamps/build-final-gcc cd build/final-gcc && \ $(MAKE) installdirs install-target && \ $(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man [ -d stamps ] || mkdir stamps touch stamps/install-final-gcc; .PHONY: clean-final-gcc clean-final-gcc: clean-gcc rm -rf build/final-gcc stamps/*-final-gcc .PHONY: realclean-final-gcc realclean-final-gcc: realclean-gcc ########## GDB ########### .PHONY: download-gdb download-gdb-force download-gdb: downloads/$(GDB_ARCHIVE) download-gdb-force downloads/$(GDB_ARCHIVE): [ -d downloads ] || mkdir downloads ; cd downloads && curl -LO $(GDB_URL) .PHONY: extract-gdb extract-gdb-force extract-gdb: stamps/extract-gdb extract-gdb-force stamps/extract-gdb: downloads/$(GDB_ARCHIVE) @(t1=`openssl md5 $< | cut -f 2 -d " " -` && \ [ "$$t1" = "$(GDB_MD5)" ] || \ ( echo "Bad Checksum! Please remove the following file and retry: $<" && false )) tar -jxf $< ; [ -d stamps ] || mkdir stamps ; touch stamps/extract-gdb; .PHONY: patch-gdb patch-gdb-force patch-gdb: stamps/patch-gdb patch-gdb-force stamps/patch-gdb: stamps/extract-gdb stamps/extract-avr32patches pushd gdb-$(GDB_VERSION) ; \ for f in ../source/avr32/gdb/*.patch; do \ patch -N -p0 <$${f} ; \ done ; \ popd ; \ [ -d stamps ] || mkdir stamps touch stamps/patch-gdb; .PHONY: regen-gdb regen-gdb-force regen-gdb: stamps/regen-gdb regen-gdb-force stamps/regen-gdb: stamps/patch-gdb stamps/install-supp-tools pushd gdb-$(GDB_VERSION) ; \ "$(SUPP_PREFIX)/bin/aclocal" -I config ; \ "$(SUPP_PREFIX)/bin/autoconf" ; \ "$(SUPP_PREFIX)/bin/automake" ; \ "$(SUPP_PREFIX)/bin/autoheader" ; \ for dir in bfd opcodes gdb; do \ pushd $$dir ; \ echo "JESS 1: $$dir" >&2 ; \ "$(SUPP_PREFIX)/bin/autoconf"; \ "$(SUPP_PREFIX)/bin/automake"; \ "$(SUPP_PREFIX)/bin/autoheader"; \ echo "JESS 2: $$dir" >&2 ; \ popd ; \ done; \ popd; \ [ -d stamps ] || mkdir stamps ; touch stamps/regen-gdb; .PHONY: build-gdb build-gdb-force build-gdb: stamps/build-gdb build-gdb-force stamps/build-gdb: stamps/regen-gdb stamps/install-supp-tools echo "JESS 3" >&2 ; \ mkdir -p build/gdb && cd build/gdb && \ ../../gdb-$(GDB_VERSION)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \ $(MAKE) -j$(PROCS) $(MAKE) installdirs install-host install-target [ -d stamps ] || mkdir stamps touch stamps/build-gdb; .PHONY: install-gdb install-gdb-force install-gdb: stamps/install-gdb install-gdb-force stamps/install-gdb: stamps/build-gdb cd build/gdb && \ $(MAKE) install [ -d stamps ] || mkdir stamps touch stamps/install-gdb; .PHONY: clean-gdb clean-gdb: rm -rf build/gdb stamps/*-gdb gdb-* .PHONY: realclean-gdb realclean-gdb: clean-gdb rm downloads/$(GDB_ARCHIVE) ################ NON-WORKING/NON-ADJUSTED TARGETS ################ gcc-optsize-patch: gcc-$(GCC_VERSION)-$(CS_BASE)/ pushd gcc-$(GCC_VERSION)-$(CS_BASE) ; \ patch -N -p1 < ../patches/gcc-optsize.patch ; \ popd ; gmp: gmp-$(CS_BASE)/ sudomode sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \ pushd ../../gmp-$(CS_BASE) ; \ make clean ; \ popd ; \ sudo -u $(SUDO_USER) ../../gmp-$(CS_BASE)/configure --disable-shared && \ sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \ $(MAKE) install mpc: mpc-$(MPC_VERSION)/ sudomode sudo -u $(SUDO_USER) mkdir -p build/gmp && cd build/gmp ; \ pushd ../../mpc-$(MPC_VERSION) ; \ make clean ; \ popd ; \ sudo -u $(SUDO_USER) ../../mpc-$(MPC_VERSION)/configure --disable-shared && \ sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \ $(MAKE) install mpc-$(MPC_VERSION) : $(LOCAL_BASE)/mpc-$(CS_VERSION).tar.bz2 ifeq ($(USER),root) sudo -u $(SUDO_USER) tar -jxf $< else tar -jxf $< endif mpfr: gmp mpfr-$(CS_BASE)/ sudomode sudo -u $(SUDO_USER) mkdir -p build/mpfr && cd build/mpfr && \ pushd ../../mpfr-$(CS_BASE) ; \ make clean ; \ popd ; \ sudo -u $(SUDO_USER) ../../mpfr-$(CS_BASE)/configure LDFLAGS="-Wl,-search_paths_first" --disable-shared && \ sudo -u $(SUDO_USER) $(MAKE) -j$(PROCS) all && \ $(MAKE) install cross-gdb: gdb-$(CS_BASE)/ mkdir -p build/gdb && cd build/gdb && \ pushd ../../gdb-$(CS_BASE) ; \ make clean ; \ popd ; \ ../../gdb-$(CS_BASE)/configure --prefix="$(PREFIX)" --target=$(TARGET) --disable-werror && \ $(MAKE) -j$(PROCS) && \ $(MAKE) installdirs install-host install-target && \ mkdir -p "$(PREFIX)/man/man1" && \ cp ../../gdb-$(CS_BASE)/gdb/gdb.1 "$(PREFIX)/man/man1/arm-none-eabi-gdb.1"