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
41 _VERS := $(wildcard $(TARBALL_PATTERN))
42 _VERS := $(sort $(_VERS))
43 _LATEST := $(lastword $(_VERS))
47 $(warning Unable to find an archive matching $(TARBALL_PATTERN))
48 $(error No archive found)
51 ifneq ($(_LATEST),$(_VERS))
52 $(warning Multiple archvies found, picked $(_LATEST))
57 DIR := $(patsubst $(TARBALL_TO_DIR_L),$(TARBALL_TO_DIR_R),$(ARCHIVE))
66 CONFIGURE_LINE ?= $(SDIR)/configure --host=$(HOST) --prefix=$(PREFIX) --exec-prefix=$(EPREFIX) $(CONFIGURE_ARGS)
68 .PHONY: all clean install _patch _build
71 cd $(BDIR) && make $(ITARGETS)
73 all: $(DIR) _patch _build
81 $(DIR)/%: patches/%.patch
89 _patch: $(DIR) $(addprefix $(DIR)/,$(PATCHES))
91 $(BDIR)/Makefile: _patch ../common.mk Makefile
93 cd $(BDIR) && $(CONFIGURE_LINE)
95 _build: $(BDIR)/Makefile
96 cd $(BDIR) && make $(BTARGETS)