github.com/stackdocker/rkt@v0.10.1-0.20151109095037-1aa827478248/stage1/net-plugins/net-plugins-install.mk (about)

     1  # This file puts all built plugins in the ACI rootfs for a given
     2  # flavor.
     3  #
     4  # Inputs:
     5  #
     6  # NPI_FLAVOR - flavor for which we will install net plugins
     7  #
     8  # NPI_BUILT_PLUGINS - list of built plugins
     9  #
    10  # NPI_BUILT_STAMPS - list of stamps for built plugins
    11  
    12  
    13  # stamp telling if all plugins for given flavor are installed
    14  $(call setup-stamp-file,NPI_STAMP,$(NPI_FLAVOR))
    15  
    16  # stamp and dep file for invalidating the directory-removing stamp
    17  $(call setup-stamp-file,NPI_BUILT_PLUGINS_KV_DEPMK_STAMP,$(NPI_FLAVOR)-built-plugins-kv-dep)
    18  $(call setup-dep-file,NPI_BUILT_PLUGINS_KV_DEPMK,$(NPI_FLAVOR)-built-plugins-kv-dep)
    19  
    20  # stamp for removing the directory with installed plugins in the ACI
    21  # rootfs
    22  $(call setup-stamp-file,NPI_RMDIR_STAMP,$(NPI_FLAVOR)-rmdir)
    23  
    24  # base and rest variables for dir-chain
    25  NPI_PLUGINSDIR_BASE := $(STAGE1_ACIROOTFSDIR_$(NPI_FLAVOR))/usr/lib
    26  NPI_PLUGINSDIR_REST := rkt/plugins/net
    27  # plugins directory inside the ACI rootfs
    28  NPI_PLUGINSDIR := $(NPI_PLUGINSDIR_BASE)/$(NPI_PLUGINSDIR_REST)
    29  # list of plugins in the ACI rootfs
    30  NPI_ACI_PLUGINS := $(addprefix $(NPI_PLUGINSDIR)/,$(notdir $(NPI_BUILT_PLUGINS)))
    31  # list of install files triplets (src:dest:mode) for plugins
    32  NPI_INSTALL_FILES_TRIPLETS := $(call install-file-triplets,$(NPI_BUILT_PLUGINS),$(NPI_ACI_PLUGINS),-)
    33  # list of install dir pairs (dir:mode) for plugins dir
    34  NPI_INSTALL_DIRS_PAIRS := $(foreach d,$(call dir-chain,$(NPI_PLUGINSDIR_BASE),$(NPI_PLUGINSDIR_REST)),$d:0755)
    35  
    36  # main stamp which makes sure that all the plugins are installed in
    37  # the plugins directory in the ACI rootfs
    38  $(call generate-stamp-rule,$(NPI_STAMP),$(NPI_ACI_PLUGINS))
    39  
    40  # this removes the plugins directory
    41  $(call generate-rm-dir-rule,$(NPI_RMDIR_STAMP),$(NPI_PLUGINSDIR))
    42  
    43  # invalidate the directory-removing stamp when a list of built plugins
    44  # changes
    45  $(call generate-kv-deps,$(NPI_BUILT_PLUGINS_KV_DEPMK_STAMP),$(NPI_RMDIR_STAMP),$(NPI_BUILT_PLUGINS_KV_DEPMK),NPI_BUILT_PLUGINS)
    46  
    47  STAGE1_INSTALL_FILES_$(NPI_FLAVOR) += $(NPI_INSTALL_FILES_TRIPLETS)
    48  STAGE1_INSTALL_DIRS_$(NPI_FLAVOR) += $(NPI_INSTALL_DIRS_PAIRS)
    49  STAGE1_SECONDARY_STAMPS_$(NPI_FLAVOR) += $(NPI_STAMP)
    50  
    51  # pairs of plugin in the ACI rootfs and the stamp used to build the
    52  # original
    53  NPI_PLUGIN_STAMP_PAIRS := $(join $(addsuffix :,$(NPI_ACI_PLUGINS)),$(NPI_BUILT_STAMPS))
    54  
    55  # make a plugin in the ACI rootfs to depend also on its build stamp
    56  $(foreach p,$(NPI_PLUGIN_STAMP_PAIRS), \
    57  	$(eval NPI_DEP_LIST := $(subst :, ,$p)) \
    58  	$(eval NPI_DEP_PLUGIN := $(word 1,$(NPI_DEP_LIST))) \
    59  	$(eval NPI_DEP_STAMP := $(word 2,$(NPI_DEP_LIST))) \
    60  	$(call add-dependency,$(NPI_DEP_PLUGIN),$(NPI_DEP_STAMP)))
    61  
    62  $(call undefine-namespaces,NPI)