X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Externals%2Fcommon.mk;h=575c51a96aee94c636706e8b24eb470f80b74cce;hb=d1e3e105c7605d0c9f02dd7e2f3b1377ea61aea4;hp=42386e5a418350a169fb5f1811b7ff35b4f8cac8;hpb=a30bd6e6d712dc6d4e64e33414b461e1377d4056;p=tpg%2Facess2.git diff --git a/Externals/common.mk b/Externals/common.mk index 42386e5a..575c51a9 100644 --- a/Externals/common.mk +++ b/Externals/common.mk @@ -3,102 +3,30 @@ # - By John Hodge (thePowersGang) # # common.mk -# - Common makefile code for imported code +# - Common makefile code for many autoconf(-like) externals --include ../../Makefile.cfg - -ifeq ($(ARCH),x86) - BFD := i586 -else ifeq ($(ARCH),x86_64) - BFD := x86_64 -else - $(error No BFD translation for $(ARCH) in Externals/common.mk) -endif - -#PREFIX=$(ACESSDIR)/Externals/Output -#EPREFIX=$(ACESSDIR)/Externals/Output/$(BFD) -PREFIX=$(ACESSDIR)/Externals/Output/$(ARCH) -EPREFIX=$(PREFIX) -SYSROOT=$(ACESSDIR)/Externals/Output/sysroot-$(BFD) -HOST=$(BFD)-acess_proxy-elf - -# -# DEPS : Dependencies for this program/library -# TARBALL_PATTERN : $(wildcard ) format [glob] pattern -# TARBALL_TO_DIR : $(patsubst ) format conversion -# PATCHES : List of altered files in the source -# > If patches/%.patch exists, the original is patched, else patches/% is copied in -# CONFIGURE_ARGS : Extra arguments to ./configure (ignoring host and prefix) -# [?]BTARGETS : Build targets (Defaults to all) -# [?]ARCHIVE : Optional forced archive (Defaults to latest) -# [?]CONFIGURE_LINE : Command to create makefile (defaults to autotools configure) -# [?]NOBDIR : Set to non-empty to disable use of a separate build dir -# [?]AUTORECONF : Set to non-empty to regenerate ./configure - - -BTARGETS ?= all -ITARGETS ?= install - -_VERS := $(wildcard $(TARBALL_PATTERN)) -_VERS := $(sort $(_VERS)) -_LATEST := $(lastword $(_VERS)) - -ifeq ($(ARCHIVE),) - ifeq ($(_LATEST),) - $(warning Unable to find an archive matching $(TARBALL_PATTERN)) - $(error No archive found) - endif - - ifneq ($(_LATEST),$(_VERS)) - $(warning Multiple archvies found, picked $(_LATEST)) - endif - ARCHIVE := $(_LATEST) -endif - -DIR := $(patsubst $(TARBALL_TO_DIR_L),$(TARBALL_TO_DIR_R),$(ARCHIVE)) - -ifeq ($(NOBDIR),) - BDIR := build-$(DIR) -else - BDIR := $(DIR) -endif -SDIR := ../$(DIR) +include $(dir $(lastword $(MAKEFILE_LIST)))/core.mk CONFIGURE_LINE ?= $(SDIR)/configure --host=$(HOST) --prefix=$(PREFIX) --exec-prefix=$(EPREFIX) $(CONFIGURE_ARGS) -.PHONY: all clean install _patch _build - -install: all - cd $(BDIR) && make $(ITARGETS) - -all: $(DIR) _patch _build - -clean: - rm -rf $(DIR) $(BDIR) -$(DIR): $(ARCHIVE) - tar -xf $(ARCHIVE) +CONFIGSCRIPT := $(BDIR)/$(firstword $(CONFIGURE_LINE)) +PATCHED_ACFILES := $(filter %/configure.in %/config.sub, $(PATCHED_FILES)) +$(warning $(CONFIGSCRIPT): $(PATCHED_ACFILES)) -$(DIR)/%: patches/%.patch - @echo [PATCH] $@ - @patch $@ $< - -$(DIR)/%: patches/% - @echo [CP] $@ - @cp $< $@ - -_patch: $(DIR) $(addprefix $(DIR)/,$(PATCHES)) - -_autoreconf: _patch +$(CONFIGSCRIPT): $(PATCHED_ACFILES) ifeq ($(AUTORECONF),) else cd $(DIR) && autoreconf --force --install endif -$(BDIR)/Makefile: _autoreconf ../common.mk Makefile +$(BDIR)/Makefile: _patch $(CONFIGSCRIPT) ../common.mk Makefile mkdir -p $(BDIR) - cd $(BDIR) && $(CONFIGURE_LINE) + cd $(BDIR) && PATH=$(PREFIX)-BUILD/bin:$(PATH) $(CONFIGURE_LINE) _build: $(BDIR)/Makefile cd $(BDIR) && make $(BTARGETS) +install: all + cd $(BDIR) && make $(ITARGETS) +