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
64 $(DIR)/%: patches/%.patch
66 @tar -xf $(ARCHIVE) $@
74 PATCHED_FILES := $(addprefix $(DIR)/,$(PATCHES))
76 ifneq ($(wildcard patches/UNIFIED.patch),)
77 $(DIR)/_unified_applied: $(wildcard patches/UNIFIED.patch)
78 cd $(DIR) && patch -p1 < ../patches/UNIFIED.patch
80 UNIFIED_TARGET=$(DIR)/_unified_applied
85 _patch: $(DIR) $(PATCHED_FILES) $(UNIFIED_TARGET)