2 # Acess2 OS - "Externals"
3 # - By John Hodge (thePowersGang)
6 # - Common makefile code for imported code
8 -include ../../Makefile.cfg
12 else ifeq ($(ARCH),x86_64)
15 $(error No BFD translation for $(ARCH) in Externals/common.mk)
18 #PREFIX=$(ACESSDIR)/Externals/Output
19 #EPREFIX=$(ACESSDIR)/Externals/Output/$(BFD)
20 PREFIX=$(ACESSDIR)/Externals/Output/$(ARCH)
22 SYSROOT=$(ACESSDIR)/Externals/Output/sysroot-$(BFD)
23 HOST=$(BFD)-acess_proxy-elf
26 # DEPS : Dependencies for this program/library
27 # TARBALL_PATTERN : $(wildcard ) format [glob] pattern
28 # TARBALL_TO_DIR : $(patsubst ) format conversion
29 # PATCHES : List of altered files in the source
30 # > If patches/%.patch exists, the original is patched, else patches/% is copied in
31 # CONFIGURE_ARGS : Extra arguments to ./configure (ignoring host and prefix)
32 # [?]BTARGETS : Build targets (Defaults to all)
33 # [?]ARCHIVE : Optional forced archive (Defaults to latest)
34 # [?]CONFIGURE_LINE : Command to create makefile (defaults to autotools configure)
35 # [?]NOBDIR : Set to non-empty to disable use of a separate build dir
36 # [?]AUTORECONF : Set to non-empty to regenerate ./configure
42 _VERS := $(wildcard $(TARBALL_PATTERN))
43 _VERS := $(sort $(_VERS))
44 _LATEST := $(lastword $(_VERS))
48 $(warning Unable to find an archive matching $(TARBALL_PATTERN))
49 $(error No archive found)
52 ifneq ($(_LATEST),$(_VERS))
53 $(warning Multiple archvies found, picked $(_LATEST))
58 DIR := $(patsubst $(TARBALL_TO_DIR_L),$(TARBALL_TO_DIR_R),$(ARCHIVE))
67 CONFIGURE_LINE ?= $(SDIR)/configure --host=$(HOST) --prefix=$(PREFIX) --exec-prefix=$(EPREFIX) $(CONFIGURE_ARGS)
69 .PHONY: all clean install _patch _build
72 cd $(BDIR) && make $(ITARGETS)
74 all: $(DIR) _patch _build
82 $(DIR)/%: patches/%.patch
84 @tar -xf $(ARCHIVE) $@
92 PATCHED_FILES := $(addprefix $(DIR)/,$(PATCHES))
93 _patch: $(DIR) $(PATCHED_FILES)
95 CONFIGSCRIPT := $(BDIR)/$(firstword $(CONFIGURE_LINE))
96 PATCHED_ACFILES := $(filter %/configure.in %/config.sub, $(PATCHED_FILES))
97 $(warning $(CONFIGSCRIPT): $(PATCHED_ACFILES))
99 $(CONFIGSCRIPT): $(PATCHED_ACFILES)
100 ifeq ($(AUTORECONF),)
102 cd $(DIR) && autoreconf --force --install
105 $(BDIR)/Makefile: _patch $(CONFIGSCRIPT) ../common.mk Makefile
107 cd $(BDIR) && $(CONFIGURE_LINE)
109 _build: $(BDIR)/Makefile
110 cd $(BDIR) && make $(BTARGETS)