Subversion Repositories avr32-toolchain

Compare Revisions

Ignore whitespace Rev 11 → Rev 12

/branches/try_gdb/Makefile
70,6 → 70,7
 
STAMP_DIR := $(CURDIR)/stamps
DOWNLOAD_DIR := $(CURDIR)/downloads
BUILD_DIR := $(CURDIR)/build
 
ifeq ($(strip $(BUG_URL)),)
BUG_URL = https://github.com/jsnyder/avr32-toolchain
162,6 → 163,11
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)
169,19 → 175,32
endef
 
define GET_MY_VARS
UP_$(1):=$$(shell echo "$(1)" | tr '[a-z]' '[A-Z]')
MY_ARCHIVE:=$$($$(UP_$(1))_ARCHIVE)
MY_URL:=$$($$(UP_$(1))_URL)
MY_MD5:=$$($$(UP_$(1))_MD5)
UP_$(1) = $$(shell echo "$(1)" | tr '[a-z]' '[A-Z]')
MY_VERSION = $$($$(UP_$(1))_VERSION)
MY_ARCHIVE = $$($$(UP_$(1))_ARCHIVE)
MY_URL = $$($$(UP_$(1))_URL)
MY_MD5 = $$($$(UP_$(1))_MD5)
endef
 
## create the download rule and force download rule
define DOWNLOAD_template
$(call GET_MY_VARS,$(1))
$(warning $(1) -> $(MY_URL))
$(warning $(1) -> $(MY_URL))
$(warning $(1) -> $(MY_URL))
$(warning $(1) -> $(MY_URL))
$(warning $(1) -> $(MY_URL))
$(warning $(1) -> $(MY_URL))
$(warning $(1) -> $(MY_URL))
$(warning $(1) -> $(MY_URL))
download-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE)
download-$(1)-f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE): $(DOWNLOAD_DIR)
cd $(DOWNLOAD_DIR) && curl -LO $$(MY_URL)
PHONY += download-$(1) download-$(1)-f
 
download-$(1)-remove:
rm -f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE)
 
PHONY += download-$(1) download-$(1)-f download-$(1)-remove
endef
 
## extract commands
194,22 → 213,110
$(call GET_MY_VARS,$(1))
extract-$(1): $(STAMP_DIR)/extract-$(1)
extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE)
@(rm -rf autoconf-*; \
@(rm -rf $(1)-*; \
t1=`openssl md5 $$< | cut -f 2 -d " " -` && \
[ "$$$$t1" = "$$(MY_MD5)" ] || \
( echo "Bad Checksum! Please remove the following file and retry: $$<" && false ))
$(call quiet_text,"Extracting $$(MY_ARCHIVE)")
$($(2)) $$<
$(call make_stamp,extract-$(1))
PHONY += extract-$(1) extract-$(1)-f
 
extract-$(1)-remove:
rm -rf $(1)-*
$(call rm_stamp,extract-$(1))
 
PHONY += extract-$(1) extract-$(1)-f extract-$(1)-remove
endef
 
## create the configure rule and force configure rule
define CONF_template
$(call GET_MY_VARS,$(1))
conf-$(1): $(STAMP_DIR)/conf-$(1)
conf-$(1)-f $(STAMP_DIR)/conf-$(1): $(STAMP_DIR)/$(2)-$(1) $(BUILD_DIR)/$(1)
@rm -rf $(BUILD_DIR)/$(1)/*
cd $(BUILD_DIR)/$(1) && \
../../$(1)-$$(MY_VERSION)/configure $$($(1)_conf_opts)
$(call make_stamp,conf-$(1))
 
conf-$(1)-remove:
$(call rm_stamp,conf-$(1))
 
PHONY += conf-$(1) conf-$(1)-f conf-$(1)-remove
endef
 
## create the build rule and force build rule
define BUILD_template
$(call GET_MY_VARS,$(1))
build-$(1): $(STAMP_DIR)/build-$(1)
build-$(1)-f $(STAMP_DIR)/build-$(1): $(STAMP_DIR)/conf-$(1)
cd $(BUILD_DIR)/$(1) && \
$(MAKE) clean && $(MAKE) -j$(PROCS)
$(call make_stamp,build-$(1))
 
build-$(1)-remove:
rm -rf $(BUILD_DIR)/$(1)
$(call rm_stamp,build-$(1))
 
PHONY += build-$(1) build-$(1)-f build-$(1)-remove
endef
 
## create the install rule and force install rule
define INSTALL_template
install-$(1): $(STAMP_DIR)/install-$(1)
install-$(1)-f $(STAMP_DIR)/install-$(1): $(STAMP_DIR)/build-$(1)
cd $(BUILD_DIR)/$(1) && \
$(MAKE) install
$(call make_stamp,install-$(1))
 
uninstall-$(1):
[ -f $(BUILD_DIR)/$(1)/Makefile ] && \
cd $(BUILD_DIR)/$(1) && \
$(MAKE) uninstall || true
$(call rm_stamp,install-$(1))
 
PHONY += install-$(1) install-$(1)-f uninstall-$(1)
endef
 
## create the clean rule and realclean rule
define CLEAN_template
clean-$(1): uninstall-$(1) extract-$(1)-remove build-$(1)-remove conf-$(1)-remove
 
realclean-$(1): clean-$(1) download-$(1)-remove
 
PHONY += clean-$(1) realclean-$(1)
endef
 
 
 
 
$(DOWNLOAD_DIR):
mkdir $(DOWNLOAD_DIR)
 
$(BUILD_DIR)/%:
mkdir -p $@
 
############# 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)"
$(eval $(call CONF_template,automake,extract))
$(eval $(call BUILD_template,automake))
$(eval $(call INSTALL_template,automake))
$(eval $(call CLEAN_template,automake))
 
 
.PHONY: $(PHONY)
 
 
246,94 → 353,53
rm stamps/install-supp-tools;
 
 
############# SUPP: AUTOCONF ############
 
##.PHONY: download-autoconf download-autoconf-force
##download-autoconf: downloads/$(AUTOCONF_ARCHIVE)
##download-autoconf-force downloads/$(AUTOCONF_ARCHIVE):
 
 
############ 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 $(AUTOCONF_URL)
## cd downloads && curl -LO $(AUTOMAKE_URL)
 
##.PHONY: extract-autoconf extract-autoconf-force
##extract-autoconf: stamps/extract-autoconf
##extract-autoconf-force stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE)
##.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" = "$(AUTOCONF_MD5)" ] || \
## [ "$$t1" = "$(AUTOMAKE_MD5)" ] || \
## ( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
## tar -jxf $< ;
## [ -d stamps ] || mkdir stamps ;
## touch stamps/extract-autoconf;
## touch stamps/extract-automake;
 
.PHONY: build-autoconf build-autoconf-force
build-autoconf: stamps/build-autoconf
build-autoconf-force stamps/build-autoconf: stamps/extract-autoconf
mkdir -p build/autoconf && cd build/autoconf && \
../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
$(MAKE) -j$(PROCS)
[ -d stamps ] || mkdir stamps
touch stamps/build-autoconf;
##.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-autoconf install-autoconf-force
install-autoconf: stamps/install-autoconf
install-autoconf-force stamps/install-autoconf: stamps/build-autoconf
cd build/autoconf && \
$(MAKE) install
[ -d stamps ] || mkdir stamps
touch stamps/install-autoconf;
##.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-autoconf
clean-autoconf:
rm -rf build/autoconf stamps/*-autoconf autoconf-*
##.PHONY: clean-automake
##clean-automake:
## rm -rf build/automake stamps/*-automake automake-*
 
.PHONY: realclean-autoconf
realclean-autoconf: clean-autoconf
rm downloads/$(AUTOCONF_ARCHIVE)
##.PHONY: realclean-automake
##realclean-automake: clean-automake
## rm downloads/$(AUTOMAKE_ARCHIVE)
 
 
############ 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