#
# Makefile.autotools.in --
#
-# Implicit and Generated Rules for easily creating autotools-compatible
+# Implicit and Generated Rules for easily creating autotools-compatible
# buildroot packages
#
## Example minimal makefile for a package named 'foo'
-#
+#
# | FOO_VERSION = 1.0
# | FOO_SOURCE = foo-$(FOO_VERSION).tar.gz
# | FOO_SITE = http://www.libfoo.org/dist
# | $(eval $(call AUTOTARGETS,foo))
-#
+#
## The following targets can be called from the shell:
#
# foo, foo-source, foo-patch, foo-configure, foo-build, foo-install,
-# foo-install-target, foo-install-staging, foo-uninstall, foo-clean,
+# foo-install-target, foo-install-staging, foo-uninstall, foo-clean,
# foo-dirclean
#
## The following variables which can be (re)defined in the package makefile:
# FOO_CONF_OPT [default empty]
# arguments passed to the <configure> script
# FOO_MAKE_ENV [default empty]
-# environment passed to all calls to <make> in the package source
+# environment passed to all calls to <make> in the package source
# directory
# FOO_MAKE_OPT [default empty]
# arguments passed to <make> while building
# FOO_CLEAN_OPT [default clean]
# arguments passed to <make> while installing to the staging directory
# FOO_UNINSTALL_STAGING_OPT [default DESTDIR=$(STAGING_DIR)/usr uninstall]
-# arguments passed to <make> while uninstalling from the staging
+# arguments passed to <make> while uninstalling from the staging
# directory
# FOO_UNINSTALL_TARGET_OPT [default DESTDIR=$(STAGING_DIR)/usr uninstall]
-# arguments passed to <make> while uninstalling from the target
+# arguments passed to <make> while uninstalling from the target
# directory
# FOO_SUBDIR [default empty]
# relative path in the package source from which to run configure and
# FOO_TARGET_CONFIGURE FOO_TARGET_PATCH FOO_TARGET_EXTRACT FOO_TARGET_SOURCE
# FOO_TARGET_UNINSTALL FOO_TARGET_CLEAN FOO_TARGET_DIRCLEAN
#
-# E.g. if your package has a no <configure> script you can place the following
+# E.g. if your package has a no <configure> script you can place the following
# in your package makefile:
#
# | $(FOO_TARGET_INSTALL):
-# | touch $@
-#
+# | touch $@
+#
## The following variables are defined automatically and can be used in
## overriden targets:
#
# MESSAGE
# macro that outputs a pretty message to stdout, e.g. use
# $(call MESSAGE,"Hello World")
-# in a target.
+# in a target.
#
# Caveats:
# - the 'eval' line (final line in the example) must be placed
# (including hooks)
################################################################################
-# UPPERCASE Macro -- transform its argument to uppercase and replace dots and
+# UPPERCASE Macro -- transform its argument to uppercase and replace dots and
# hyphens to underscores
UPPERCASE = $(shell echo $(1) | tr "a-z.-" "A-Z__")
INFLATE.tar = cat
# MESSAGE Macro -- display a message in bold type
-MESSAGE = @echo $(TERM_BOLD) ; \
+MESSAGE = @echo $(TERM_BOLD); \
echo ">>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)"; \
echo $(TERM_RESET)
TERM_BOLD = #$(shell tput bold)
#ACLOCAL_STAGING_DIR ?= $(STAGING_DIR)/usr/share/aclocal
#ACLOCAL ?= aclocal -I $(ACLOCAL_STAGING_DIR)
#AUTORECONF ?= autoreconf -v -i -f -I $(ACLOCAL_STAGING_DIR)
-# ACLOCAL="$(ACLOCAL)"
+# ACLOCAL="$(ACLOCAL)"
################################################################################
$(BUILD_DIR)/%/.stamp_patched:
$(call MESSAGE,"Patching")
$(if $($(PKG)_PATCH),toolchain/patch-kernel.sh $(@D) $(DL_DIR) $($(PKG)_PATCH))
- $(Q)(\
- if test -d $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME) ; then \
- if test "$(wildcard $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER)*.patch)" ; then \
- toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME) $(NAMEVER)\*.patch || exit 1 ; \
+ $(Q)( \
+ if test -d $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME); then \
+ if test "$(wildcard $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER)*.patch)"; then \
+ toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME) $(NAMEVER)\*.patch || exit 1; \
else \
- toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME) $($(PKG)_NAME)\*.patch || exit 1 ; \
- if test -d package/$($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER) ; then \
- toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER) \*.patch || exit 1 ; \
+ toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME) $($(PKG)_NAME)\*.patch || exit 1; \
+ if test -d package/$($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER); then \
+ toolchain/patch-kernel.sh $(@D) $($(PKG)_DIR_PREFIX)/$($(PKG)_NAME)/$(NAMEVER) \*.patch || exit 1; \
fi; \
fi; \
fi; \
$(Q)(for file in config.guess config.sub; do \
for i in $$(find $(@D) -name $$file); do \
cp package/gnuconfig/$$file $$i; \
- done;\
+ done; \
done)
endif
$(Q)touch $@
# Configuring
$(BUILD_DIR)/%/.stamp_configured:
$(call MESSAGE,"Configuring")
- $(Q)if test "$($(PKG)_AUTORECONF)" = "YES" ; then \
- cd $(@D)/$($(PKG)_SUBDIR) && \
- $(AUTORECONF) ; \
+ $(Q)if test "$($(PKG)_AUTORECONF)" = "YES"; then \
+ cd $(@D)/$($(PKG)_SUBDIR) && $(AUTORECONF); \
fi
- cd $(@D)/$($(PKG)_SUBDIR) && \
- rm -f config.cache && \
+ cd $(@D)/$($(PKG)_SUBDIR) && rm -f config.cache && \
$(TARGET_CONFIGURE_OPTS) \
$(TARGET_CONFIGURE_ARGS) \
$($(PKG)_CONF_ENV) \
$(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"
- for i in $$(find $(STAGING_DIR)/usr/lib/ -name "*.la") ; do \
- cp $$i $$i~ ; \
- $(SED) "s:\(['= ]\)/usr:\\1$(STAGING_DIR)/usr:" $$i ; \
+ for i in $$(find $(STAGING_DIR)/usr/lib/ -name "*.la"); do \
+ cp $$i $$i~; \
+ $(SED) "s:\(['= ]\)/usr:\\1$(STAGING_DIR)/usr:" $$i; \
done
touch $@
$(BUILD_DIR)/%/.stamp_target_installed:
$(call MESSAGE,"Installing to target")
$($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_INSTALL_TARGET_OPT) -C $(@D)/$($(PKG)_SUBDIR)
- $(if $(BR2_HAVE_MANPAGES),,for d in man ; do \
- rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d ; \
+ $(if $(BR2_HAVE_MANPAGES),,for d in man; do \
+ rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d; \
done)
- $(if $(BR2_HAVE_INFOPAGES),,for d in info share/info ; do \
- rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d ; \
+ $(if $(BR2_HAVE_INFOPAGES),,for d in info share/info; do \
+ rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d; \
done)
- $(if $(BR2_HAVE_INCLUDES),,for d in include ; do \
- rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d ; \
+ $(if $(BR2_HAVE_INCLUDES),,for d in include; do \
+ rm -rf $(TARGET_DIR)/$$d $(TARGET_DIR)/usr/$$d; \
done)
find $(TARGET_DIR) -name '*.la' -delete
touch $@
################################################################################
-# AUTOTARGETS -- the target generator macro; define a set of human-readable
+# AUTOTARGETS -- the target generator macro; define a set of human-readable
# make targets, stamps, and default per-package variables.
# Argument 1 is the package directory prefix.
# Argument 2 is the (lowercase) package name.
define AUTOTARGETS
$(call AUTOTARGETS_INNER,$(2),$(call UPPERCASE,$(2)),$(1))
endef
-
+
# AUTOTARGETS_INNER -- does the job for AUTOTARGETS; argument 1 is the
# lowercase package name, argument 2 the uppercase package name,
# argument 3 the package directory prefix
$(2)_AUTORECONF ?= NO
$(2)_CONF_ENV ?=
$(2)_CONF_OPT ?=
-$(2)_MAKE_ENV ?=
+$(2)_MAKE_ENV ?=
$(2)_MAKE_OPT ?=
$(2)_INSTALL_STAGING ?= NO
$(2)_INSTALL_TARGET ?= YES
$(2)_HOOK_POST_INSTALL = $$($(2)_DIR)/.stamp_hook_post_install
# human-friendly targets and target sequencing
-$(1): $(1)-install
-$(1)-install: $(1)-install-staging $(1)-install-target \
+$(1): $(1)-install
+$(1)-install: $(1)-install-staging $(1)-install-target \
$$($(2)_HOOK_POST_INSTALL)
-
+
ifeq ($$($(2)_INSTALL_TARGET),YES)
$(1)-install-target: $(1)-build $$($(2)_TARGET_INSTALL_TARGET)
else
$(1)-source: $$($(2)_TARGET_SOURCE)
# non-build targets
-$(1)-uninstall: $(1)-configure $$($(2)_TARGET_UNINSTALL)
+$(1)-uninstall: $(1)-configure $$($(2)_TARGET_UNINSTALL)
$(1)-clean: $$($(2)_TARGET_CLEAN)
endef
# :mode=makefile:
-