From 9955ac620069f4a6144dc77a818919564cb9a3d5 Mon Sep 17 00:00:00 2001 From: Abdoulaye Walsimou Gaye Date: Tue, 7 Jan 2014 21:01:44 +0100 Subject: Build system: create macros to access various internal .dotfile and use of them Signed-off-by: Abdoulaye Walsimou Gaye --- mk/bmake.mk | 2 +- mk/eglibc.mk | 5 ++--- mk/glibc.mk | 5 ++--- mk/linux.mk | 15 ++++++--------- mk/macros.packages.mk | 22 +++++++++++++++++----- mk/musl.mk | 10 +++++----- mk/toolchain.mk | 24 ++++++++++++------------ mk/uclibc.mk | 10 +++++----- mk/zlib_host.mk | 2 +- 9 files changed, 51 insertions(+), 44 deletions(-) diff --git a/mk/bmake.mk b/mk/bmake.mk index 3781ae2..6a370ea 100644 --- a/mk/bmake.mk +++ b/mk/bmake.mk @@ -37,7 +37,7 @@ define __embtk_install_bmake cd $(BMAKE_BUILD_DIR) && MAKEFLAGS="" \ $(BMAKE_SRC_DIR)/boot-strap \ --prefix=$(embtk_htools)/usr --install - touch $(call __embtk_pkg_dotinstalled_f,bmake) + $(call __embtk_setinstalled_pkg,bmake) $(call __embtk_pkg_gen_dotkconfig_f,bmake) endef diff --git a/mk/eglibc.mk b/mk/eglibc.mk index f9fa4eb..836c4a8 100644 --- a/mk/eglibc.mk +++ b/mk/eglibc.mk @@ -80,8 +80,7 @@ define embtk_configure_eglibc $(embtk_eglibc-sunrpc-y) \ --with-bugurl=$(EMBTK_BUGURL) \ --with-pkgversion="EGLIBC from embtoolkit-$(EMBTK_VERSION)" - touch $(EGLIBC_BUILD_DIR)/.eglibc.embtk.conifgured - touch $(call __embtk_pkg_dotconfigured_f,eglibc) + $(call __embtk_setconfigured_pkg,eglibc) endef define __embtk_install_eglibc @@ -97,7 +96,7 @@ define __embtk_install_eglibc BUILD_CFLAGS="$(embtk_eglibc_buildcflags)" \ BUILD_LDFLAGS="$(embtk_eglibc_buildldflags)" \ install_root=$(embtk_sysroot) install - touch $(call __embtk_pkg_dotinstalled_f,eglibc) + $(call __embtk_setinstalled_pkg,eglibc) $(call __embtk_pkg_gen_dotkconfig_f,eglibc) endef diff --git a/mk/glibc.mk b/mk/glibc.mk index c2a3c32..0add5cb 100644 --- a/mk/glibc.mk +++ b/mk/glibc.mk @@ -73,8 +73,7 @@ define embtk_configure_glibc --enable-obsolete-rpc --disable-build-nscd --disable-nscd \ --with-bugurl=$(EMBTK_BUGURL) \ --with-pkgversion="GLIBC from embtoolkit-$(EMBTK_VERSION)" - touch $(GLIBC_BUILD_DIR)/.glibc.embtk.conifgured - touch $(call __embtk_pkg_dotconfigured_f,glibc) + $(call __embtk_setconfigured_pkg,glibc) endef define __embtk_install_glibc @@ -90,7 +89,7 @@ define __embtk_install_glibc BUILD_CFLAGS="$(embtk_glibc_buildcflags)" \ BUILD_LDFLAGS="$(embtk_glibc_buildldflags)" \ install_root=$(embtk_sysroot) install - touch $(call __embtk_pkg_dotinstalled_f,glibc) + $(call __embtk_setinstalled_pkg,glibc) $(call __embtk_pkg_gen_dotkconfig_f,glibc) endef diff --git a/mk/linux.mk b/mk/linux.mk index 224a70c..7155437 100644 --- a/mk/linux.mk +++ b/mk/linux.mk @@ -57,12 +57,12 @@ define __embtk_install_linux_headers $(call embtk_decompress_pkg,linux) $(MAKE) -C $(LINUX_BUILD_DIR) $(LINUX_MAKE_OPTS) \ INSTALL_HDR_PATH=$(embtk_sysroot)/usr headers_install - touch $(call __embtk_pkg_dotinstalled_f,linux_headers) + $(call __embtk_setinstalled_pkg,linux_headers) $(call __embtk_pkg_gen_dotkconfig_f,linux_headers) endef define embtk_install_linux_headers - [ -e $(call __embtk_pkg_dotinstalled_f,linux_headers) ] || \ - $(__embtk_install_linux_headers) + $(if $(call __embtk_pkg_installed-y,linux_headers),, + $(__embtk_install_linux_headers)) endef # @@ -107,7 +107,7 @@ define __embtk_install_linux cp $(CONFIG_EMBTK_LINUX_DOTCONFIG) $(__embtk_linux_srcdir)/.config $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) silentoldconfig $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) $(J) - touch $(call __embtk_pkg_dotinstalled_f,linux) + $(call __embtk_setinstalled_pkg,linux) $(call __embtk_pkg_gen_dotkconfig_f,linux) endef @@ -126,12 +126,9 @@ endef # clean target and macros # define embtk_cleanup_linux - if [ -d $(LINUX_BUILD_DIR) ] && \ - [ -e $(call __embtk_pkg_dotinstalled_f,linux_headers) ]; then \ - rm -rf $(call __embtk_pkg_dotinstalled_f,linux_headers); \ - fi + [ -d $(LINUX_BUILD_DIR) ] && $(call __embtk_unsetinstalled_pkg,linux) endef define embtk_cleanup_linux_headers - $(embtk_cleanup_linux) + [ -d $(LINUX_BUILD_DIR) ] && $(call __embtk_unsetinstalled_pkg,linux_headers) endef diff --git a/mk/macros.packages.mk b/mk/macros.packages.mk index 654eb6c..4fa8b36 100644 --- a/mk/macros.packages.mk +++ b/mk/macros.packages.mk @@ -207,6 +207,18 @@ __embtk_pkg_dotconfigured_f = $(__embtk_pkg_builddir)/.$(__embtk_pkg_name).embtk __embtk_pkg_dotinstalled_f = $(__embtk_pkg_builddir)/.$(__embtk_pkg_name).embtk.installed __embtk_pkg_dotkconfig_f = $(__embtk_pkg_builddir)/.$(__embtk_pkg_name).embtk.kconfig + +__embtk_setdecompressed_pkg = touch $(__embtk_pkg_dotdecompressed_f) +__embtk_unsetdecompressed_pkg = rm -rf $(__embtk_pkg_dotdecompressed_f) +__embtk_setpatched_pkg = touch $(__embtk_pkg_dotpatched_f) +__embtk_unsetpatched_pkg = rm -rf $(__embtk_pkg_dotpatched_f) +__embtk_setconfigured_pkg = touch $(__embtk_pkg_dotconfigured_f) +__embtk_unsetconfigured_pkg = rm -rf $(__embtk_pkg_dotconfigured_f) +__embtk_setinstalled_pkg = touch $(__embtk_pkg_dotinstalled_f) +__embtk_unsetinstalled_pkg = rm -rf $(__embtk_pkg_dotinstalled_f) +__embtk_setkconfigured_pkg = touch $(__embtk_pkg_dotkconfig_f) +__embtk_unsetkconfigured_pkg = rm -rf $(__embtk_pkg_dotkconfig_f) + # Some useful macros about packages __embtk_rootfs_pkgs-y = $(patsubst %_install,%,$(ROOTFS_COMPONENTS-y)) __embtk_rootfs_nrpkgs-y = $(words $(__embtk_rootfs_pkgs-y)) @@ -456,7 +468,7 @@ define __embtk_install_pkg_make $(if $(__embtk_autotoolspkg-y)$(__embtk_pkg_pkgconfigs), $(call __embtk_fix_libtool_files) $(call __embtk_fix_pkgconfig_files)) - touch $(__embtk_pkg_dotinstalled_f) + $(call __embtk_setinstalled_pkg,$(1)) $(call __embtk_pkg_gen_dotkconfig_f,$(1)) endef define __embtk_install_hostpkg_make @@ -472,7 +484,7 @@ define __embtk_install_hostpkg_make $(if $(__embtk_pkg_makedirs), \ $(__embtk_multi_make_hostinstall), \ $(__embtk_single_make_hostinstall)) - touch $(__embtk_pkg_dotinstalled_f) + $(call __embtk_setinstalled_pkg,$(1)) $(call __embtk_pkg_gen_dotkconfig_f,$(1)) endef @@ -758,7 +770,7 @@ define embtk_decompress_pkg $(if $(EMBTK_BUILDSYS_DEBUG),$(__embtk_decompress_pkg_msg)) if [ ! -e $(__embtk_pkg_dotdecompressed_f) ]; then \ $(call __embtk_decompress_pkg,$(1)) && \ - touch $(__embtk_pkg_dotdecompressed_f) && \ + $(call __embtk_setdecompressed_pkg,$(1)) && \ $(call __embtk_applypatch_pkg,$(1)) \ fi) endef @@ -788,8 +800,8 @@ define __embtk_cleanup_pkg $(if $(__embtk_pkg_shares), rm -rf $(addprefix $(embtk_sysroot)/usr/share/,$(__embtk_pkg_shares))) $(if $(__embtk_pkg_usegit)$(__embtk_pkg_usesvn), - rm -rf $(__embtk_pkg_dotconfigured_f) - rm -rf $(__embtk_pkg_dotinstalled_f), + $(call __embtk_unsetconfigured_pkg,$(1)) + $(call __embtk_unsetinstalled_pkg,$(1)), $(if $(__embtk_pkg_builddir),rm -rf $(__embtk_pkg_builddir)*)) endef diff --git a/mk/musl.mk b/mk/musl.mk index 4133c49..354949e 100644 --- a/mk/musl.mk +++ b/mk/musl.mk @@ -43,7 +43,7 @@ define embtk_beforeinstall_musl --includedir=/usr/include echo "$(MUSL_VERSION) From EmbToolkit v$(EMBTK_VERSION)" \ > $(MUSL_SRC_DIR)/VERSION - touch $(call __embtk_pkg_dotconfigured_f,musl) + $(call __embtk_setconfigured_pkg,musl) endef define __embtk_install_musl @@ -55,7 +55,7 @@ define __embtk_install_musl $(Q)$(MAKE) -C $(MUSL_BUILD_DIR) \ DESTDIR=$(embtk_sysroot) install-libs install-headers cd $(embtk_sysroot)/$(LIBDIR); ln -sf libc.so ld-musl-$(LINUX_ARCH).so.1 - touch $(call __embtk_pkg_dotinstalled_f,musl) + $(call __embtk_setinstalled_pkg,musl) $(call __embtk_pkg_gen_dotkconfig_f,musl) endef @@ -66,8 +66,8 @@ endef define embtk_cleanup_musl if [ -d $(MUSL_BUILD_DIR) ]; then \ $(MAKE) -C $(MUSL_BUILD_DIR) distclean; \ - rm -rf $(call __embtk_pkg_dotconfigured_f,musl); \ - rm -rf $(call __embtk_pkg_dotinstalled_f,musl); \ - rm -rf $(call __embtk_pkg_dotkconfig_f,musl); \ + $(call __embtk_unsetconfigured_pkg,musl); \ + $(call __embtk_unsetinstalled_pkg,musl); \ + $(call __embtk_unsetkconfigured_pkg,musl); \ fi endef diff --git a/mk/toolchain.mk b/mk/toolchain.mk index 6161007..2d2dcd5 100644 --- a/mk/toolchain.mk +++ b/mk/toolchain.mk @@ -249,10 +249,10 @@ define ___embtk_toolchain_decompress endef define __embtk_toolchain_decompress - $(if $(call __embtk_mk_pathnotexist,$(call __embtk_pkg_dotdecompressed_f,toolchain)), + $(if $(call __embtk_pkg_notdecompressed-y,toolchain), $(call embtk_pinfo,"Decompressing cached $(GNU_TARGET)/$(EMBTK_MCU_FLAG) toolchain - please wait...") $(___embtk_toolchain_decompress) - touch $(call __embtk_pkg_dotdecompressed_f,toolchain)) + $(call __embtk_setdecompressed_pkg,toolchain)) endef __embtk_toolchain_deps-y = $(patsubst %_install,%,$(TOOLCHAIN_DEPS)) @@ -265,8 +265,8 @@ __embtk_toolsaddons_build_msg = $(call embtk_pinfo,"Building new $(GNU_TARGET)/$ define __embtk_toolchain_build_core $(__embtk_toolchain_building_msg) - rm -rf $(call __embtk_pkg_dotinstalled_f,toolchain) - rm -rf $(call __embtk_pkg_dotdecompressed_f,toolchain) + $(call __embtk_unsetinstalled_pkg,toolchain) + $(call __embtk_unsetdecompressed_pkg,toolchain) $(foreach dep,$(__embtk_toolchain_deps-y), $(call embtk_cleanup_pkg,$(dep))) $(foreach pkg,$(__embtk_rootfs_pkgs-y), @@ -279,14 +279,14 @@ define __embtk_toolchain_build_core $(call embtk_install_xpkg,$(pdep))) $(foreach dep,$(__embtk_toolchain_deps-y), $(call embtk_install_xpkg,$(dep))) - touch $(call __embtk_pkg_dotinstalled_f,toolchain) + $(call __embtk_setinstalled_pkg,toolchain) $(call __embtk_pkg_gen_dotkconfig_f,toolchain) endef define __embtk_toolchain_build_addons $(__embtk_toolsaddons_build_msg) - rm -rf $(call __embtk_pkg_dotinstalled_f,toolchain_addons) - rm -rf $(call __embtk_pkg_dotdecompressed_f,toolchain_addons) + $(call __embtk_unsetinstalled_pkg,toolchain_addons) + $(call __embtk_unsetdecompressed_pkg,toolchain_addons) $(__embtk_toolchain_mkinitdirs) $(if $(findstring core,$(1)),, $(foreach rootfspkg,$(__embtk_rootfs_pkgs-y), @@ -305,10 +305,10 @@ define __embtk_toolchain_build_addons $(call embtk_install_xpkg,$(pdep))) $(foreach addon,$(__embtk_toolchain_addons-y), $(call embtk_install_xpkg,$(addon)))) - touch $(call __embtk_pkg_dotinstalled_f,toolchain_addons) + $(call __embtk_setinstalled_pkg,toolchain_addons) $(if $(TOOLCHAIN_ADDONS-y), $(call __embtk_pkg_gen_dotkconfig_f,toolchain_addons), - touch $(call __embtk_pkg_dotkconfig_f,toolchain_addons)) + $(call __embtk_pkg_setkconfigured,toolchain_addons)) endef define __embtk_toolchain_build @@ -318,8 +318,8 @@ define __embtk_toolchain_build $(__embtk_toolchain_symlinktools) $(call embtk_pinfo,"Packaging new $(GNU_TARGET)/$(EMBTK_MCU_FLAG) toolchain - please wait...") $(__embtk_toolchain_compress) - touch $(call __embtk_pkg_dotdecompressed_f,toolchain) - touch $(call __embtk_pkg_dotdecompressed_f,toolchain_addons) + $(call __embtk_setdecompressed_pkg,toolchain) + $(call __embtk_setdecompressed_pkg,toolchain_addons) $(__embtk_toolchain_built_msg), $(__embtk_toolchain_decompress)) endef @@ -343,7 +343,7 @@ toolchain_install: $(Q)$(call __embtk_toolchain_build,$(__embtk_toolchain_buildargs)) define __embtk_toolchain_clean - rm -rf $(call __embtk_pkg_dotdecompressed_f,toolchain) + $(call __embtk_unsetdecompressed_pkg,toolchain) endef toolchain_clean: diff --git a/mk/uclibc.mk b/mk/uclibc.mk index 9f1a220..3e68412 100755 --- a/mk/uclibc.mk +++ b/mk/uclibc.mk @@ -104,12 +104,12 @@ define __embtk_install_uclibc_headers $(MAKE) -C $(UCLIBC_BUILD_DIR) $(UCLIBC_MAKE_OPTS) install_headers $(MAKE) -C $(UCLIBC_BUILD_DIR) $(UCLIBC_MAKE_OPTS) install_startfiles $(__embtk_install_uclibc_dummy) - touch $(call __embtk_pkg_dotinstalled_f,uclibc_headers) + $(call __embtk_setinstalled_pkg,uclibc_headers) endef define embtk_install_uclibc_headers - [ -e $(call __embtk_pkg_dotinstalled_f,uclibc_headers) ] || \ - $(__embtk_install_uclibc_headers) + $(if $(call __embtk_pkg_installed-y,uclubc_headers),, + $(__embtk_install_uclibc_headers)) endef # @@ -117,8 +117,8 @@ endef # define __embtk_cleanup_uclibc ($(MAKE) -C $(UCLIBC_BUILD_DIR) distclean && \ - rm -rf $(call __embtk_pkg_dotinstalled_f,uclibc) && \ - rm -rf $(call __embtk_pkg_dotinstalled_f,uclibc_headers)) + $(call __embtk_unsetinstalled_pkg,uclibc) && \ + $(call __embtk_unsetinstalled_pkg,uclibc_headers)) endef define embtk_cleanup_uclibc if [ -d $(UCLIBC_BUILD_DIR) ] \ diff --git a/mk/zlib_host.mk b/mk/zlib_host.mk index 61d5026..3b43a1b 100644 --- a/mk/zlib_host.mk +++ b/mk/zlib_host.mk @@ -43,7 +43,7 @@ define embtk_configure_zlib_host $(ZLIB_HOST_CONFIGURE_ENV) \ $(CONFIG_EMBTK_SHELL) $(ZLIB_HOST_SRC_DIR)/configure \ --prefix=$(embtk_htools)/usr $(ZLIB_HOST_CONFIGURE_OPTS) - touch $(call __embtk_pkg_dotconfigured_f,zlib_host) + $(call __embtk_setconfigured_pkg,zlib_host) endef define embtk_beforeinstall_zlib_host -- cgit v1.2.3