2 # Acess2 OS - "Externals"
3 # - By John Hodge (thePowersGang)
6 # - Makefile code used by all externals
8 include $(dir $(lastword $(MAKEFILE_LIST)))/config.mk
11 # DEPS : Dependencies for this program/library
12 # TARBALL_PATTERN : $(wildcard ) format [glob] pattern
13 # TARBALL_TO_DIR : $(patsubst ) format conversion
14 # PATCHES : List of altered files in the source
15 # > If patches/%.patch exists, the original is patched, else patches/% is copied in
16 # [?]BTARGETS : Build targets (Defaults to all)
17 # [?]ARCHIVE : Optional forced archive (Defaults to latest)
18 # [?]NOBDIR : Set to non-empty to disable use of a separate build dir
20 # CONFIGURE_ARGS : Extra arguments to ./configure (ignoring host and prefix)
21 # [?]CONFIGURE_LINE : Command to create makefile (defaults to autotools configure)
22 # [?]AUTORECONF : Set to non-empty to regenerate ./configure
28 _VERS := $(wildcard $(TARBALL_PATTERN))
29 _VERS := $(sort $(_VERS))
30 _LATEST := $(lastword $(_VERS))
34 $(warning Unable to find an archive matching $(TARBALL_PATTERN))
35 $(error No archive found)
38 ifneq ($(_LATEST),$(_VERS))
39 $(warning Multiple archvies found, picked $(_LATEST))
44 DIR := $(patsubst $(TARBALL_TO_DIR_L),$(TARBALL_TO_DIR_R),$(ARCHIVE))
53 .PHONY: all clean install _patch _build
55 all: $(DIR) _patch _build
60 $(DIR): $(ARCHIVE) patches/UNIFIED.patch
62 ifneq ($(wildcard patches/UNIFIED.patch),)
63 cd $(DIR) && patch -p1 < ../patches/UNIFIED.patch
66 patches/UNIFIED.patch:
69 $(DIR)/%: patches/%.patch
71 @tar -xf $(ARCHIVE) $@
79 PATCHED_FILES := $(addprefix $(DIR)/,$(PATCHES))
80 _patch: $(DIR) $(PATCHED_FILES)