github.com/blixtra/rkt@v0.8.1-0.20160204105720-ab0d1add1a43/stage1/net-plugins/net-plugins.mk (about)

     1  # This file has two parts:
     2  #
     3  # 1. Build the plugins
     4  #
     5  # 2. Install plugins in the ACI rootfs for each flavor
     6  
     7  
     8  # 1.
     9  
    10  # plugin names - taken from github.com/appc/cni/plugins
    11  NPM_PLUGIN_NAMES := \
    12  	main/ptp \
    13  	main/bridge \
    14  	main/macvlan \
    15  	main/ipvlan \
    16  	ipam/host-local \
    17  	ipam/dhcp \
    18  	meta/flannel
    19  
    20  # both lists below have the same number of elements
    21  # array of path to built plugins
    22  NPM_BUILT_PLUGINS :=
    23  # array of stamps used to build the plugins
    24  NPM_BUILT_STAMPS :=
    25  
    26  # Generates a build rule for a given plugin name
    27  # 1 - plugin name (like main/ptp or ipam/dhcp)
    28  define NPM_GENERATE_BUILD_PLUGIN_RULE
    29  # base name of a plugin
    30  NPM_BASE := $$(notdir $1)
    31  # path to the built plugin
    32  NPM_PLUGIN := $$(TOOLSDIR)/$$(NPM_BASE)
    33  
    34  # stamp used to build a plugin
    35  $$(call setup-stamp-file,NPM_STAMP,$$(NPM_BASE))
    36  
    37  # variables for makelib/build_go_bin.mk
    38  BGB_STAMP := $$(NPM_STAMP)
    39  BGB_BINARY := $$(NPM_PLUGIN)
    40  BGB_PKG_IN_REPO := Godeps/_workspace/src/github.com/appc/cni/plugins/$1
    41  include makelib/build_go_bin.mk
    42  
    43  $$(NPM_PLUGIN): | $$(TOOLSDIR)
    44  
    45  $$(call generate-stamp-rule,$$(NPM_STAMP))
    46  
    47  CLEAN_FILES += $$(NPM_PLUGIN)
    48  NPM_BUILT_PLUGINS += $$(NPM_PLUGIN)
    49  NPM_BUILT_STAMPS += $$(NPM_STAMP)
    50  endef
    51  
    52  $(foreach p,$(NPM_PLUGIN_NAMES), \
    53          $(eval $(call NPM_GENERATE_BUILD_PLUGIN_RULE,$p)))
    54  
    55  
    56  # 2.
    57  
    58  $(foreach flavor,$(STAGE1_FLAVORS), \
    59  	$(eval NPI_FLAVOR := $(flavor)) \
    60  	$(eval NPI_BUILT_PLUGINS := $(NPM_BUILT_PLUGINS)) \
    61  	$(eval NPI_BUILT_STAMPS := $(NPM_BUILT_STAMPS)) \
    62  	$(call inc-one,net-plugins-install.mk))
    63  
    64  $(call undefine-namespaces,NPM)