2007-08-10 21:07:51 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Makefile.autotools.in --
|
|
|
|
#
|
2007-09-30 14:46:02 +02:00
|
|
|
# Implicit and Generated Rules for easily creating autotools-compatible
|
2007-08-10 21:07:51 +02:00
|
|
|
# buildroot packages
|
|
|
|
#
|
|
|
|
## Example minimal makefile for a package named 'foo'
|
2007-09-30 14:46:02 +02:00
|
|
|
#
|
2007-08-10 21:07:51 +02:00
|
|
|
# | FOO_VERSION = 1.0
|
|
|
|
# | FOO_SOURCE = foo-$(FOO_VERSION).tar.gz
|
|
|
|
# | FOO_SITE = http://www.libfoo.org/dist
|
|
|
|
# | $(eval $(call AUTOTARGETS,foo))
|
2007-09-30 14:46:02 +02:00
|
|
|
#
|
2007-08-10 21:07:51 +02:00
|
|
|
## The following targets can be called from the shell:
|
|
|
|
#
|
|
|
|
# foo, foo-source, foo-patch, foo-configure, foo-build, foo-install,
|
2007-09-30 14:46:02 +02:00
|
|
|
# foo-install-target, foo-install-staging, foo-uninstall, foo-clean,
|
2007-08-10 21:07:51 +02:00
|
|
|
# foo-dirclean
|
|
|
|
#
|
|
|
|
## The following variables which can be (re)defined in the package makefile:
|
|
|
|
#
|
|
|
|
# FOO_VERSION [mandatory]
|
|
|
|
# version string of the package
|
|
|
|
# FOO_SOURCE [default foo-$(FOO_VERSION).tar.gz]
|
|
|
|
# file name of the package source
|
|
|
|
# FOO_SITE [default sourceforge project "foo"]
|
|
|
|
# URL under wich $(FOO_SOURCE) can be found
|
2007-08-22 17:52:01 +02:00
|
|
|
# FOO_DEPENDENCIES [default empty]
|
2007-08-10 21:07:51 +02:00
|
|
|
# list of (package) targets that must be built before foo
|
|
|
|
# FOO_AUTORECONF [YES/NO, default NO]
|
|
|
|
# run <autoreconf> before <configure>
|
2008-09-19 15:37:14 +02:00
|
|
|
# FOO_LIBTOOL_PATCH [YES/NO, default YES]
|
|
|
|
# Do you want the standard buildroot patch applied to ltmain.sh? (libtool)
|
2007-08-10 21:07:51 +02:00
|
|
|
# FOO_CONF_ENV [default empty]
|
|
|
|
# environment passed to the <configure> script
|
|
|
|
# FOO_CONF_OPT [default empty]
|
|
|
|
# arguments passed to the <configure> script
|
|
|
|
# FOO_MAKE_ENV [default empty]
|
2007-09-30 14:46:02 +02:00
|
|
|
# environment passed to all calls to <make> in the package source
|
2007-08-10 21:07:51 +02:00
|
|
|
# directory
|
|
|
|
# FOO_MAKE_OPT [default empty]
|
|
|
|
# arguments passed to <make> while building
|
|
|
|
# FOO_INSTALL_STAGING [YES/NO, default NO]
|
|
|
|
# install the package to the staging directory
|
|
|
|
# FOO_INSTALL_TARGET [YES/NO, default YES]
|
|
|
|
# install the package to the target directory
|
2008-09-14 21:19:10 +02:00
|
|
|
# FOO_INSTALL_STAGING_OPT [default DESTDIR=$(STAGING_DIR) install]
|
2007-08-10 21:07:51 +02:00
|
|
|
# arguments passed to <make> while installing to the staging directory
|
2008-10-20 13:32:22 +02:00
|
|
|
# FOO_INSTALL_TARGET_OPT [default DESTDIR=$(TARGET_DIR) install-exec/install-strip]
|
2007-08-10 21:07:51 +02:00
|
|
|
# arguments passed to <make> while installing to the target directory
|
|
|
|
# FOO_CLEAN_OPT [default clean]
|
|
|
|
# arguments passed to <make> while installing to the staging directory
|
2008-09-14 21:19:10 +02:00
|
|
|
# FOO_UNINSTALL_STAGING_OPT [default DESTDIR=$(STAGING_DIR) uninstall]
|
2007-09-30 14:46:02 +02:00
|
|
|
# arguments passed to <make> while uninstalling from the staging
|
2007-08-10 21:07:51 +02:00
|
|
|
# directory
|
2008-09-14 21:19:10 +02:00
|
|
|
# FOO_UNINSTALL_TARGET_OPT [default DESTDIR=$(TARGET_DIR) uninstall]
|
2007-09-30 14:46:02 +02:00
|
|
|
# arguments passed to <make> while uninstalling from the target
|
2007-08-10 21:07:51 +02:00
|
|
|
# directory
|
|
|
|
# FOO_SUBDIR [default empty]
|
|
|
|
# relative path in the package source from which to run configure and
|
|
|
|
# make
|
2007-09-29 11:58:13 +02:00
|
|
|
# FOO_DIR_PREFIX [default empty]
|
|
|
|
# toplevel relative path to package *.mk file and corresponding patches
|
2007-08-10 21:07:51 +02:00
|
|
|
#
|
2007-08-21 21:20:18 +02:00
|
|
|
## The following variables contain hook target names
|
2007-08-10 21:07:51 +02:00
|
|
|
## by default they do nothing, they can be overriden in package makefiles
|
|
|
|
#
|
2008-08-29 14:04:26 +02:00
|
|
|
# FOO_HOOK_POST_EXTRACT, FOO_HOOK_POST_CONFIGURE,
|
2007-08-10 21:07:51 +02:00
|
|
|
# FOO_HOOK_POST_BUILD, FOO_HOOK_POST_INSTALL
|
|
|
|
#
|
|
|
|
## The following variables contain targets that can be overriden
|
|
|
|
#
|
|
|
|
# FOO_TARGET_INSTALL_TARGET FOO_TARGET_INSTALL_STAGING FOO_TARGET_BUILD
|
|
|
|
# FOO_TARGET_CONFIGURE FOO_TARGET_PATCH FOO_TARGET_EXTRACT FOO_TARGET_SOURCE
|
|
|
|
# FOO_TARGET_UNINSTALL FOO_TARGET_CLEAN FOO_TARGET_DIRCLEAN
|
|
|
|
#
|
2007-09-30 14:46:02 +02:00
|
|
|
# E.g. if your package has a no <configure> script you can place the following
|
2007-08-10 21:07:51 +02:00
|
|
|
# in your package makefile:
|
|
|
|
#
|
|
|
|
# | $(FOO_TARGET_INSTALL):
|
2007-09-30 14:46:02 +02:00
|
|
|
# | touch $@
|
|
|
|
#
|
2007-08-10 21:07:51 +02:00
|
|
|
## The following variables are defined automatically and can be used in
|
|
|
|
## overriden targets:
|
|
|
|
#
|
|
|
|
# PKG
|
|
|
|
# is always the current package name ("foo" in the example)
|
|
|
|
# FOO_DIR
|
|
|
|
# the directory in which the package source is extracted.
|
|
|
|
# the base name will always be foo-$(FOO_VERSION), no matter what the
|
|
|
|
# archive name or the directory-in-archive name are.
|
|
|
|
# MESSAGE
|
|
|
|
# macro that outputs a pretty message to stdout, e.g. use
|
|
|
|
# $(call MESSAGE,"Hello World")
|
2007-09-30 14:46:02 +02:00
|
|
|
# in a target.
|
2007-08-10 21:07:51 +02:00
|
|
|
#
|
|
|
|
# Caveats:
|
|
|
|
# - the 'eval' line (final line in the example) must be placed
|
|
|
|
# after all variable settings, but before all target re-definition
|
|
|
|
# (including hooks)
|
|
|
|
################################################################################
|
|
|
|
|
2007-09-30 14:46:02 +02:00
|
|
|
# UPPERCASE Macro -- transform its argument to uppercase and replace dots and
|
2007-08-10 21:07:51 +02:00
|
|
|
# hyphens to underscores
|
2007-08-22 18:21:13 +02:00
|
|
|
UPPERCASE = $(shell echo $(1) | tr "a-z.-" "A-Z__")
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Define extrators for different archive suffixes
|
|
|
|
INFLATE.bz2 = $(BZCAT)
|
|
|
|
INFLATE.gz = $(ZCAT)
|
|
|
|
INFLATE.tbz = $(BZCAT)
|
|
|
|
INFLATE.tgz = $(ZCAT)
|
|
|
|
INFLATE.tar = cat
|
|
|
|
|
|
|
|
# MESSAGE Macro -- display a message in bold type
|
2008-08-04 21:08:48 +02:00
|
|
|
MESSAGE = @echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
|
2007-08-22 17:52:01 +02:00
|
|
|
TERM_BOLD = #$(shell tput bold)
|
|
|
|
TERM_RESET = #$(shell tput rmso)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Utility programs used to build packages
|
|
|
|
TAR ?= tar
|
|
|
|
#ACLOCAL_STAGING_DIR ?= $(STAGING_DIR)/usr/share/aclocal
|
|
|
|
#ACLOCAL ?= aclocal -I $(ACLOCAL_STAGING_DIR)
|
|
|
|
#AUTORECONF ?= autoreconf -v -i -f -I $(ACLOCAL_STAGING_DIR)
|
2007-09-30 14:46:02 +02:00
|
|
|
# ACLOCAL="$(ACLOCAL)"
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2008-10-06 21:20:58 +02:00
|
|
|
# Automatically detect tar --strip-path/components option
|
2008-10-07 19:08:27 +02:00
|
|
|
TAR_STRIP_COMPONENTS := $(shell $(CONFIG_SHELL) -c '$(TAR) --help | grep strip-path > /dev/null ; if test $$? = 0 ; then echo '--strip-path' ; else echo '--strip-components' ; fi')
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Implicit targets -- produce a stamp file for each step of a package build
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Retrieve and unpack the archive
|
|
|
|
$(BUILD_DIR)/%/.stamp_downloaded:
|
2008-07-02 10:58:18 +02:00
|
|
|
# support make source-check/external-deps
|
2008-07-24 15:38:39 +02:00
|
|
|
ifneq ($(SPIDER),)
|
2008-07-07 07:08:39 +02:00
|
|
|
$(WGET) -P $(DL_DIR) $($(PKG)_SITE)/$($(PKG)_SOURCE)
|
2008-07-02 10:58:18 +02:00
|
|
|
$(if $($(PKG)_PATCH),$(WGET) -P $(DL_DIR) $($(PKG)_SITE)/$($(PKG)_PATCH))
|
2008-06-14 23:01:03 +02:00
|
|
|
else
|
2007-08-10 21:07:51 +02:00
|
|
|
$(call MESSAGE,"Downloading")
|
2008-06-26 13:43:02 +02:00
|
|
|
ifneq ($(strip $(subst ",,$(BR2_PRIMARY_SITE))),)
|
|
|
|
#"))
|
2008-06-01 19:58:48 +02:00
|
|
|
-$(Q)test -e $(DL_DIR)/$($(PKG)_SOURCE) || $(WGET) -P $(DL_DIR) $(BR2_PRIMARY_SITE)/$($(PKG)_SOURCE)
|
|
|
|
endif
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)test -e $(DL_DIR)/$($(PKG)_SOURCE) || $(WGET) -P $(DL_DIR) $($(PKG)_SITE)/$($(PKG)_SOURCE)
|
|
|
|
$(if $($(PKG)_PATCH),$(Q)test -e $(DL_DIR)/$($(PKG)_PATCH) || $(WGET) -P $(DL_DIR) $($(PKG)_SITE)/$($(PKG)_PATCH))
|
|
|
|
$(Q)mkdir -p $(@D)
|
|
|
|
$(Q)touch $@
|
2008-06-14 23:01:03 +02:00
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Retrieve and unpack the archive
|
|
|
|
$(BUILD_DIR)/%/.stamp_extracted:
|
|
|
|
$(call MESSAGE,"Extracting")
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)mkdir -p $(@D)
|
|
|
|
$(Q)$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
|
2008-10-06 21:20:58 +02:00
|
|
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -
|
2008-05-01 16:07:11 +02:00
|
|
|
# some packages have messed up permissions inside
|
|
|
|
$(Q)chmod -R ug+rw $(@D)
|
2008-09-19 15:37:14 +02:00
|
|
|
$(Q)touch $@
|
|
|
|
|
|
|
|
# Fix libtool support if required by the package
|
|
|
|
$(BUILD_DIR)/%/.stamp_libtool_patch:
|
|
|
|
$(call MESSAGE,"Patching libtool")
|
2008-05-01 16:07:11 +02:00
|
|
|
# if the package uses libtool, patch it for cross-compiling in buildroot
|
2008-09-19 15:37:14 +02:00
|
|
|
$(Q)if test "$($(PKG)_LIBTOOL_PATCH)" = "YES"; then \
|
2008-05-01 16:07:11 +02:00
|
|
|
for i in `find $(@D) -name ltmain.sh`; do \
|
|
|
|
toolchain/patch-kernel.sh $${i%/*} package buildroot-libtool.patch; \
|
2008-09-19 15:37:14 +02:00
|
|
|
done \
|
|
|
|
fi
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)touch $@
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Patch
|
2007-09-20 13:08:13 +02:00
|
|
|
# XXX: FIXME: This has to be done differently and path-independent, i.e. use
|
|
|
|
# XXX: FIXME: the dir-part of the stem as base-dir (instead of hardcoding
|
|
|
|
# XXX: FIXME: "package/".
|
2007-08-10 21:07:51 +02:00
|
|
|
$(BUILD_DIR)/%/.stamp_patched: NAMEVER = $($(PKG)_NAME)-$($(PKG)_VERSION)
|
|
|
|
$(BUILD_DIR)/%/.stamp_patched:
|
2008-03-06 19:39:42 +01:00
|
|
|
$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)")
|
2007-08-22 18:19:10 +02:00
|
|
|
$(if $($(PKG)_PATCH),toolchain/patch-kernel.sh $(@D) $(DL_DIR) $($(PKG)_PATCH))
|
2007-09-30 14:46:02 +02:00
|
|
|
$(Q)( \
|
|
|
|
if test -d $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME); then \
|
2008-03-28 11:39:55 +01:00
|
|
|
if test "$(wildcard $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER)*.patch*)"; then \
|
|
|
|
toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME) $(NAMEVER)\*.patch $(NAMEVER)\*.patch.$(ARCH) || exit 1; \
|
2007-08-10 21:07:51 +02:00
|
|
|
else \
|
2008-03-28 11:40:28 +01:00
|
|
|
toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME) $($(PKG)_NAME)\*.patch $($(PKG)_NAME)\*.patch.$(ARCH) || exit 1; \
|
2008-08-04 21:08:35 +02:00
|
|
|
if test -d $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER); then \
|
2008-03-28 11:40:28 +01:00
|
|
|
toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER) \*.patch \*.patch.$(ARCH) || exit 1; \
|
2007-09-12 06:37:31 +02:00
|
|
|
fi; \
|
|
|
|
fi; \
|
|
|
|
fi; \
|
|
|
|
)
|
2007-08-10 21:07:51 +02:00
|
|
|
ifeq ($(strip $(BR2_UPDATE_CONFIG)),y)
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)(for file in config.guess config.sub; do \
|
2007-08-10 21:07:51 +02:00
|
|
|
for i in $$(find $(@D) -name $$file); do \
|
|
|
|
cp package/gnuconfig/$$file $$i; \
|
2007-09-30 14:46:02 +02:00
|
|
|
done; \
|
2007-08-10 21:07:51 +02:00
|
|
|
done)
|
|
|
|
endif
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)touch $@
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Running autoreconf
|
|
|
|
$(BUILD_DIR)/%/.stamp_autoconfigured:
|
|
|
|
$(call MESSAGE,"Running autoreconf")
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)cd $(@D)/$($(PKG)_SUBDIR) && $(AUTORECONF)
|
2008-09-04 03:19:52 +02:00
|
|
|
# if the package uses libtool, patch it for cross-compiling in buildroot
|
2008-09-19 16:43:50 +02:00
|
|
|
$(Q)if test "$($(PKG)_LIBTOOL_PATCH)" = "YES"; then \
|
|
|
|
for i in `find $(@D)/$($(PKG)_SUBDIR) -name ltmain.sh`; do \
|
2008-09-04 03:19:52 +02:00
|
|
|
toolchain/patch-kernel.sh $${i%/*} package buildroot-libtool.patch; \
|
2008-09-19 15:37:14 +02:00
|
|
|
done \
|
|
|
|
fi
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)touch $@
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Configuring
|
|
|
|
$(BUILD_DIR)/%/.stamp_configured:
|
|
|
|
$(call MESSAGE,"Configuring")
|
2007-09-30 14:46:02 +02:00
|
|
|
cd $(@D)/$($(PKG)_SUBDIR) && rm -f config.cache && \
|
2007-08-10 21:07:51 +02:00
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2007-08-22 18:02:22 +02:00
|
|
|
$(TARGET_CONFIGURE_ARGS) \
|
|
|
|
$($(PKG)_CONF_ENV) \
|
2007-08-10 21:07:51 +02:00
|
|
|
./configure \
|
|
|
|
--target=$(GNU_TARGET_NAME) \
|
|
|
|
--host=$(GNU_TARGET_NAME) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--prefix=/usr \
|
|
|
|
--exec-prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
2008-08-16 13:59:56 +02:00
|
|
|
$(if $(findstring s,$(MAKEFLAGS)),--quiet,) \
|
2007-08-10 21:07:51 +02:00
|
|
|
$($(PKG)_CONF_OPT)
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)touch $@
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Build
|
|
|
|
$(BUILD_DIR)/%/.stamp_built:
|
|
|
|
$(call MESSAGE,"Building")
|
|
|
|
$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_MAKE_OPT) -C $(@D)/$($(PKG)_SUBDIR)
|
2007-08-22 18:28:31 +02:00
|
|
|
$(Q)touch $@
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# Install to staging dir
|
|
|
|
$(BUILD_DIR)/%/.stamp_staging_installed:
|
|
|
|
$(call MESSAGE,'Installing to host (staging directory)')
|
|
|
|
$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_INSTALL_STAGING_OPT) -C $(@D)/$($(PKG)_SUBDIR)
|
|
|
|
# toolchain/replace.sh $(STAGING_DIR)/usr/lib ".*\.la" "\(['= ]\)/usr" "\\1$(STAGING_DIR)/usr"
|
2007-09-30 14:46:02 +02:00
|
|
|
for i in $$(find $(STAGING_DIR)/usr/lib/ -name "*.la"); do \
|
|
|
|
cp $$i $$i~; \
|
2008-03-06 19:39:42 +01:00
|
|
|
$(SED) "s:\(['= ]\)/usr:\\1$(STAGING_DIR)/usr:g" $$i; \
|
2007-08-10 21:07:51 +02:00
|
|
|
done
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
# Install to target dir
|
2008-09-11 04:15:07 +02:00
|
|
|
$(PROJECT_BUILD_DIR)/autotools-stamps/%_target_installed:
|
2007-08-10 21:07:51 +02:00
|
|
|
$(call MESSAGE,"Installing to target")
|
2008-09-11 04:15:07 +02:00
|
|
|
$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_INSTALL_TARGET_OPT) -C $($(PKG)_DIR)/$($(PKG)_SUBDIR)
|
2008-07-01 14:04:18 +02:00
|
|
|
$(if $(BR2_HAVE_MANPAGES),,for d in man share/man; do \
|
2007-09-30 14:46:02 +02:00
|
|
|
rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d; \
|
2007-08-22 17:59:56 +02:00
|
|
|
done)
|
2007-09-30 14:46:02 +02:00
|
|
|
$(if $(BR2_HAVE_INFOPAGES),,for d in info share/info; do \
|
|
|
|
rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d; \
|
2007-08-22 17:59:56 +02:00
|
|
|
done)
|
2008-10-20 13:32:25 +02:00
|
|
|
$(if $(BR2_HAVE_DOCUMENTATION),,for d in doc share/doc; do \
|
|
|
|
rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d; \
|
|
|
|
done)
|
2008-09-11 04:15:07 +02:00
|
|
|
$(Q)mkdir -p $(@D)
|
2007-08-10 21:07:51 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%/.stamp_cleaned:
|
|
|
|
$(call MESSAGE,"Cleaning up")
|
|
|
|
-$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_CLEAN_OPT) -C $(@D)/$($(PKG)_SUBDIR)
|
2008-09-04 03:05:17 +02:00
|
|
|
rm -f $(@D)/.stamp_built
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
$(BUILD_DIR)/%/.stamp_uninstalled:
|
|
|
|
$(call MESSAGE,"Uninstalling")
|
|
|
|
$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_UNINSTALL_STAGING_OPT) -C $(@D)/$($(PKG)_SUBDIR)
|
2008-09-04 03:05:17 +02:00
|
|
|
rm -f $(@D)/.stamp_staging_installed
|
2007-08-10 21:07:51 +02:00
|
|
|
$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_UNINSTALL_TARGET_OPT) -C $(@D)/$($(PKG)_SUBDIR)
|
2008-09-11 04:15:07 +02:00
|
|
|
rm -f $($(PKG)_TARGET_INSTALL_TARGET) $($(PKG)_HOOK_POST_INSTALL)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
$(BUILD_DIR)/%/.stamp_dircleaned:
|
|
|
|
rm -Rf $(@D)
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
2007-09-30 14:46:02 +02:00
|
|
|
# AUTOTARGETS -- the target generator macro; define a set of human-readable
|
2007-08-10 21:07:51 +02:00
|
|
|
# make targets, stamps, and default per-package variables.
|
2007-09-29 11:58:13 +02:00
|
|
|
# Argument 1 is the package directory prefix.
|
|
|
|
# Argument 2 is the (lowercase) package name.
|
2007-08-10 21:07:51 +02:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
define AUTOTARGETS
|
2007-09-29 11:58:13 +02:00
|
|
|
$(call AUTOTARGETS_INNER,$(2),$(call UPPERCASE,$(2)),$(1))
|
2007-08-10 21:07:51 +02:00
|
|
|
endef
|
2007-09-30 14:46:02 +02:00
|
|
|
|
2007-08-10 21:07:51 +02:00
|
|
|
# AUTOTARGETS_INNER -- does the job for AUTOTARGETS; argument 1 is the
|
2007-09-29 11:58:13 +02:00
|
|
|
# lowercase package name, argument 2 the uppercase package name,
|
|
|
|
# argument 3 the package directory prefix
|
2007-08-10 21:07:51 +02:00
|
|
|
define AUTOTARGETS_INNER
|
|
|
|
|
|
|
|
# define package-specific variables to default values
|
|
|
|
$(2)_NAME = $(1)
|
|
|
|
$(2)_VERSION ?= undefined
|
|
|
|
$(2)_DIR = $$(BUILD_DIR)/$(1)-$$($(2)_VERSION)
|
|
|
|
$(2)_SOURCE ?= $(1)-$$($(2)_VERSION).tar.gz
|
|
|
|
$(2)_SITE ?= \
|
|
|
|
http://$$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/$(1)
|
2007-08-22 17:52:01 +02:00
|
|
|
$(2)_DEPENDENCIES ?=
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_AUTORECONF ?= NO
|
2008-09-19 15:37:14 +02:00
|
|
|
$(2)_LIBTOOL_PATCH ?= YES
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_CONF_ENV ?=
|
|
|
|
$(2)_CONF_OPT ?=
|
2007-09-30 14:46:02 +02:00
|
|
|
$(2)_MAKE_ENV ?=
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_MAKE_OPT ?=
|
|
|
|
$(2)_INSTALL_STAGING ?= NO
|
|
|
|
$(2)_INSTALL_TARGET ?= YES
|
|
|
|
$(2)_INSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) install
|
2008-10-20 13:32:22 +02:00
|
|
|
ifeq ($(BR2_ENABLE_DEBUG),y)
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install-exec
|
2008-10-20 13:32:22 +02:00
|
|
|
else
|
|
|
|
$(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install-strip
|
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_CLEAN_OPT ?= clean
|
|
|
|
$(2)_UNINSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) uninstall
|
|
|
|
$(2)_UNINSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) uninstall
|
|
|
|
$(2)_SUBDIR ?=
|
2007-09-29 11:58:13 +02:00
|
|
|
$(2)_DIR_PREFIX = $(if $(3),$(3),$(TOP_SRCDIR)/package)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
# define sub-target stamps
|
2008-09-11 04:15:07 +02:00
|
|
|
# targets which affect $(TARGET_DIR) must use a unique stamp for each $(PROJECT)
|
|
|
|
$(2)_TARGET_INSTALL_TARGET = $(PROJECT_BUILD_DIR)/autotools-stamps/$(1)_target_installed
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_TARGET_INSTALL_STAGING = $$($(2)_DIR)/.stamp_staging_installed
|
|
|
|
$(2)_TARGET_BUILD = $$($(2)_DIR)/.stamp_built
|
|
|
|
$(2)_TARGET_CONFIGURE = $$($(2)_DIR)/.stamp_configured
|
|
|
|
$(2)_TARGET_AUTORECONF = $$($(2)_DIR)/.stamp_autoconfigured
|
2008-09-19 15:37:14 +02:00
|
|
|
$(2)_TARGET_LIBTOOL_PATCH = $$($(2)_DIR)/.stamp_libtool_patch
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_TARGET_PATCH = $$($(2)_DIR)/.stamp_patched
|
|
|
|
$(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted
|
|
|
|
$(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded
|
|
|
|
$(2)_TARGET_UNINSTALL = $$($(2)_DIR)/.stamp_uninstalled
|
|
|
|
$(2)_TARGET_CLEAN = $$($(2)_DIR)/.stamp_cleaned
|
|
|
|
$(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned
|
|
|
|
|
2008-08-29 14:04:26 +02:00
|
|
|
$(2)_HOOK_POST_EXTRACT = $$($(2)_DIR)/.stamp_hook_post_extract
|
|
|
|
$(2)_HOOK_POST_CONFIGURE = $$($(2)_DIR)/.stamp_hook_post_configure
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_HOOK_POST_BUILD = $$($(2)_DIR)/.stamp_hook_post_build
|
2008-09-11 04:15:07 +02:00
|
|
|
$(2)_HOOK_POST_INSTALL = $(PROJECT_BUILD_DIR)/autotools-stamps/$(1)_hook_post_install
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
# human-friendly targets and target sequencing
|
2007-09-30 14:46:02 +02:00
|
|
|
$(1): $(1)-install
|
|
|
|
$(1)-install: $(1)-install-staging $(1)-install-target \
|
2007-08-10 21:07:51 +02:00
|
|
|
$$($(2)_HOOK_POST_INSTALL)
|
2007-09-30 14:46:02 +02:00
|
|
|
|
2007-08-10 21:07:51 +02:00
|
|
|
ifeq ($$($(2)_INSTALL_TARGET),YES)
|
|
|
|
$(1)-install-target: $(1)-build $$($(2)_TARGET_INSTALL_TARGET)
|
|
|
|
else
|
|
|
|
$(1)-install-target:
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($$($(2)_INSTALL_STAGING),YES)
|
|
|
|
$(1)-install-staging: $(1)-build $$($(2)_TARGET_INSTALL_STAGING)
|
|
|
|
else
|
|
|
|
$(1)-install-staging:
|
|
|
|
endif
|
|
|
|
|
2007-08-24 16:18:47 +02:00
|
|
|
$(1)-build: $(1)-configure \
|
2007-08-22 18:56:36 +02:00
|
|
|
$$($(2)_TARGET_BUILD) \
|
2007-08-10 21:07:51 +02:00
|
|
|
$$($(2)_HOOK_POST_BUILD)
|
|
|
|
|
2008-08-29 14:04:26 +02:00
|
|
|
$(1)-configure: $(1)-autoreconf \
|
|
|
|
$$($(2)_TARGET_CONFIGURE) \
|
|
|
|
$$($(2)_HOOK_POST_CONFIGURE)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
ifeq ($$($(2)_AUTORECONF),YES)
|
|
|
|
$(1)-autoreconf: $(1)-patch $$($(2)_TARGET_AUTORECONF)
|
2007-08-22 17:52:01 +02:00
|
|
|
$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
|
2007-08-10 21:07:51 +02:00
|
|
|
else
|
|
|
|
$(1)-autoreconf: $(1)-patch
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(1)-patch: $(1)-extract $$($(2)_TARGET_PATCH)
|
|
|
|
|
2008-08-29 14:04:26 +02:00
|
|
|
$(1)-extract: $(1)-depends \
|
|
|
|
$$($(2)_TARGET_EXTRACT) \
|
2008-09-19 15:37:14 +02:00
|
|
|
$$($(2)_HOOK_POST_EXTRACT) \
|
|
|
|
$$($(2)_TARGET_LIBTOOL_PATCH)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2007-08-22 17:52:01 +02:00
|
|
|
$(1)-depends: $(1)-source $$($(2)_DEPENDENCIES)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
$(1)-source: $$($(2)_TARGET_SOURCE)
|
|
|
|
|
|
|
|
# non-build targets
|
2007-09-30 14:46:02 +02:00
|
|
|
$(1)-uninstall: $(1)-configure $$($(2)_TARGET_UNINSTALL)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2008-09-04 04:34:42 +02:00
|
|
|
$(1)-clean: $(1)-uninstall \
|
|
|
|
$$($(2)_TARGET_CLEAN)
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
$(1)-dirclean: $$($(2)_TARGET_DIRCLEAN)
|
|
|
|
|
|
|
|
# define the PKG variable for all targets, containing the
|
|
|
|
# uppercase package variable prefix
|
|
|
|
$$($(2)_TARGET_INSTALL_TARGET): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_INSTALL_STAGING): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_BUILD): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_CONFIGURE): PKG=$(2)
|
2008-09-19 15:37:14 +02:00
|
|
|
$$($(2)_TARGET_LIBTOOL_PATCH): PKG=$(2)
|
2007-08-10 21:07:51 +02:00
|
|
|
$$($(2)_TARGET_AUTORECONF): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_PATCH): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_EXTRACT): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_SOURCE): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_UNINSTALL): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_CLEAN): PKG=$(2)
|
|
|
|
$$($(2)_TARGET_DIRCLEAN): PKG=$(2)
|
2008-08-29 14:04:26 +02:00
|
|
|
$$($(2)_HOOK_POST_EXTRACT): PKG=$(2)
|
2008-09-19 15:37:14 +02:00
|
|
|
$$($(2)_HOOK_POST_CONFIGURE): PKG=$(2)
|
2007-08-10 21:07:51 +02:00
|
|
|
$$($(2)_HOOK_POST_BUILD): PKG=$(2)
|
|
|
|
$$($(2)_HOOK_POST_INSTALL): PKG=$(2)
|
|
|
|
|
|
|
|
# define hook targets
|
|
|
|
# default hook behaviour: do nothing
|
2008-08-29 14:04:26 +02:00
|
|
|
$$($(2)_HOOK_POST_EXTRACT):
|
|
|
|
$$($(2)_HOOK_POST_CONFIGURE):
|
2007-08-10 21:07:51 +02:00
|
|
|
$$($(2)_HOOK_POST_BUILD):
|
|
|
|
$$($(2)_HOOK_POST_INSTALL):
|
|
|
|
|
2008-03-06 19:39:42 +01:00
|
|
|
# add package to the general list of targets if requested by the buildroot
|
2007-08-10 21:07:51 +02:00
|
|
|
# configuration
|
|
|
|
ifeq ($$(BR2_PACKAGE_$(2)),y)
|
|
|
|
TARGETS += $(1)
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
# :mode=makefile:
|