From 3848feb1df64622ad05cbc6b4e6ac3b550e8d805 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 8 Jun 2013 11:51:33 +0800 Subject: [PATCH] Externals - Added zlib meta-makefile (and common) --- Externals/common.mk | 95 +++++++++++++++++++++++++++++++++++++++ Externals/zlib/.gitignore | 2 + Externals/zlib/Makefile | 15 +++++++ 3 files changed, 112 insertions(+) create mode 100644 Externals/common.mk create mode 100644 Externals/zlib/.gitignore create mode 100644 Externals/zlib/Makefile diff --git a/Externals/common.mk b/Externals/common.mk new file mode 100644 index 00000000..e74b4942 --- /dev/null +++ b/Externals/common.mk @@ -0,0 +1,95 @@ +# +# Acess2 OS - "Externals" +# - By John Hodge (thePowersGang) +# +# common.mk +# - Common makefile code for imported code + +-include ../../Makefile.cfg + +ifeq ($(ARCH),x86) + BFD := i586 +else ifeq ($(ARCH),x86_64) + BFD := x86_64 +else + $(error No BFD translation for $(ARCH) in Externals/common.mk) +endif + +PREFIX=$(ACESSDIR)/Externals/Output/common +EPREFIX=$(ACESSDIR)/Externals/Output/$(ARCH) +SYSROOT=$(ACESSDIR)/Externals/Output/sysroot-$(ARCH) +HOST=$(BFD)-acess_proxy-elf + +# +# DEPS : Dependencies for this program/library +# TARBALL_PATTERN : $(wildcard ) format [glob] pattern +# TARBALL_TO_DIR : $(patsubst ) format conversion +# PATCHES : List of altered files in the source +# > If patches/%.patch exists, the original is patched, else patches/% is copied in +# CONFIGURE_ARGS : Extra arguments to ./configure (ignoring host and prefix) +# [?]BTARGETS : Build targets (Defaults to all) +# [?]ARCHIVE : Optional forced archive (Defaults to latest) +# [?]CONFIGURE_LINE : Command to create makefile (defaults to autotools configure) +# [?]NOBDIR : Set to non-empty to disable use of a separate build dir + + +BTARGETS ?= all +ITARGETS ?= install + +_VERS := $(wildcard $(TARBALL_PATTERN)) +_VERS := $(sort $(_VERS)) +_LATEST := $(lastword $(_VERS)) + +ifeq ($(ARCHIVE),) + ifeq ($(_LATEST),) + $(warning Unable to find an archive matching $(TARBALL_PATTERN)) + $(error No archive found) + endif + + ifneq ($(_LATEST),$(_VERS)) + $(warning Multiple archvies found, picked $(_LATEST)) + endif + ARCHIVE := $(_LATEST) +endif + +DIR := $(patsubst $(TARBALL_TO_DIR_L),$(TARBALL_TO_DIR_R),$(ARCHIVE)) + +ifeq ($(NOBDIR),) + BDIR := build-$(DIR) +else + BDIR := $(DIR) +endif +SDIR := ../$(DIR) + +CONFIGURE_LINE ?= ./configure --host=$(HOST) --prefx=$(PREFIX) --eprefix=$(EPREFIX) $(CONFIGURE_ARGS) + +.PHONY: all clean install _patch _build + +all: $(DIR) _patch _build + +clean: + rm -rf $(DIR) $(BDIR) + +install: all + cd $(BDIR) && make $(ITARGETS) + +$(DIR): $(ARCHIVE) + tar -xf $(ARCHIVE) + +$(DIR)/%: patches/%.patch + @echo [PATCH] $@ + @patch $@ $< + +$(DIR)/%: patches/% + @echo [CP] $@ + @cp $< $@ + +_patch: $(DIR) $(addprefix $(DIR)/,$(PATCHES)) + +$(BDIR)/Makefile: _patch ../common.mk Makefile + mkdir -p $(BDIR) + cd $(BDIR) && $(CONFIGURE_LINE) + +_build: $(BDIR)/Makefile + cd $(BDIR) && make $(BTARGETS) + diff --git a/Externals/zlib/.gitignore b/Externals/zlib/.gitignore new file mode 100644 index 00000000..7d12b7b8 --- /dev/null +++ b/Externals/zlib/.gitignore @@ -0,0 +1,2 @@ +zlib-* +configure.log diff --git a/Externals/zlib/Makefile b/Externals/zlib/Makefile new file mode 100644 index 00000000..01e6c498 --- /dev/null +++ b/Externals/zlib/Makefile @@ -0,0 +1,15 @@ +# +# Acess2 External: zlib +# - Makefile and patches by John Hodge (thePowersGang) +# + +DEPS := +TARBALL_PATTERN := zlib-*.tar.gz +TARBALL_TO_DIR_L := %.tar.gz +TARBALL_TO_DIR_R := % +PATCHES := +CONFIGURE_LINE = CC=$(HOST)-gcc $(SDIR)/configure --static --prefix=$(PREFIX) --eprefix=$(EPREFIX) +NOBDIR = yes + +include ../common.mk + -- 2.20.1