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/common
19 EPREFIX=$(ACESSDIR)/Externals/Output/$(ARCH)
20 SYSROOT=$(ACESSDIR)/Externals/Output/sysroot-$(ARCH)
21 HOST=$(BFD)-acess_proxy-elf
24 # DEPS : Dependencies for this program/library
25 # TARBALL_PATTERN : $(wildcard ) format [glob] pattern
26 # TARBALL_TO_DIR : $(patsubst ) format conversion
27 # PATCHES : List of altered files in the source
28 # > If patches/%.patch exists, the original is patched, else patches/% is copied in
29 # CONFIGURE_ARGS : Extra arguments to ./configure (ignoring host and prefix)
30 # [?]BTARGETS : Build targets (Defaults to all)
31 # [?]ARCHIVE : Optional forced archive (Defaults to latest)
32 # [?]CONFIGURE_LINE : Command to create makefile (defaults to autotools configure)
33 # [?]NOBDIR : Set to non-empty to disable use of a separate build dir
39 _VERS := $(wildcard $(TARBALL_PATTERN))
40 _VERS := $(sort $(_VERS))
41 _LATEST := $(lastword $(_VERS))
45 $(warning Unable to find an archive matching $(TARBALL_PATTERN))
46 $(error No archive found)
49 ifneq ($(_LATEST),$(_VERS))
50 $(warning Multiple archvies found, picked $(_LATEST))
55 DIR := $(patsubst $(TARBALL_TO_DIR_L),$(TARBALL_TO_DIR_R),$(ARCHIVE))
64 CONFIGURE_LINE ?= ./configure --host=$(HOST) --prefx=$(PREFIX) --eprefix=$(EPREFIX) $(CONFIGURE_ARGS)
66 .PHONY: all clean install _patch _build
68 all: $(DIR) _patch _build
74 cd $(BDIR) && make $(ITARGETS)
79 $(DIR)/%: patches/%.patch
87 _patch: $(DIR) $(addprefix $(DIR)/,$(PATCHES))
89 $(BDIR)/Makefile: _patch ../common.mk Makefile
91 cd $(BDIR) && $(CONFIGURE_LINE)
93 _build: $(BDIR)/Makefile
94 cd $(BDIR) && make $(BTARGETS)