# Copyright 2014-2020 VMware, Inc. All Rights Reserved. # # Things referenced in $(TOOLCHAIN) are effectively architecture- # independent, due to either being generic or having explicit # cross-architecture support. CURRENT_DIR := $(shell pwd) DEV_PROJECT = ExampleNasPlugin DEV_PROJECT_VERSION = 1.0 DEV_ESX_VERSION=7.0.1 DEV_PROJECT_MF_SCRIPT=exampleNas.mf DESC_TYPE=bootbank DESC_NAME=$(DEV_VIB_BASENAME) DESC_VENDOR_EMAIL=support@vmware.com DESC_VERSION=$(DEV_PROJECT_VERSION)-15 DESC_VENDOR=VMware DESC_SUMMARY=NAS VAAI Example DESC_DESCRIPTION=Sample NAS VAAI Module for ESX Server DESC_RELEASE_DATE=2019-11-11T01:23:45-07:00 # The next five variables name files, each of which contains # one or more tag+value phrases in legal XML snippets. The # exact details vary somewhat from file to file, so please # see descriptor-template.xml in the vib-suite distribution # for details. DESC_URLS= DESC_DEPENDS=descriptor-depends.xml DESC_CONFLICTS= DESC_REPLACES= DESC_PROVIDES= DESC_MAINT=0 DESC_LIVE_INSTALL_ALLOWED=true DESC_LIVE_REMOVE_ALLOWED=true DESC_STATELESS_READY=true # DESC_ACCEPTANCE_LEVEL is actually only needed when using an # acceptance level other than "accepted", because that's the default # level. KEYPATH and CERTPATH are needed for any level other than # "community". They should point to the keys you are signing the vib # with; the default is a test key that only works on development ESX # hosts. DESC_ACCEPTANCE_LEVEL=accepted KEYPATH=$(EPKPATH)/testcerts/accepted.key CERTPATH=$(EPKPATH)/testcerts/accepted.cert DESC_PAYLOAD_NAME=example-nas BULL_KBURL=http://kb.vmware.com/kb/example.html # The platforms file is not currently used. # BULL_PLATFORMS=bulletin-platforms.xml BULL_VENDOR_CODE=VMW BULL_CNS_NAME=$(BULL_VENDOR_CODE)-$(DEV_PROJECT) BULL_CNS_STRING=$(DESC_DESCRIPTION) BULL_CVS_VERSION=1.0-0.0.0001 BULL_CVS_STRING=1.0 - Build 0001 ################################################################ # Set build configuration options here. # # Variables starting with "DEV_" are reserved for communicating # build parameters into the core makefiles (in .../samples/common). # # Those starting with "VMW_" are reserved for VMware use, and should # be considered unsupported with no compatibility guarantees unless # explicitly documented otherwise. # # Note that many variables do not currently follow the above # patterns. This is to minimize changes required in existing # partner code. ################ # This variables selects between generating userworld binaries or vmkernel # binaries. Supported values are "uw" and "vmkernel". Since the NVDK is a # userworld-only devkit, it defaults to "uw". #DEV_TARGET_CONTEXT = uw # This controls which type of compiler options to use. Allowed # values are "beta" (for debugging) and "release". The default is # the type of the ESX build that produced this devkit. DEV_BUILDTYPE = beta ################ # These are the project-specific C files. RPCGEN_CFILES = mount_clnt.c mount_xdr.c nfs_prot_clnt.c nfs_prot_xdr.c\ rpcb_prot_clnt.c rpcb_prot_xdr.c DEV_UW_CFILES = exampleNas.c plugin.c $(RPCGEN_CFILES) ################ # Typically, it won't be necessary to modify these settings, but the # substitutions pattern may need to put the intermediate files in a # more convenient location. DEV_$(DEV_BUILDTYPE)_UW_OBJECTS = $(DEV_UW_CFILES:%.c=$(BUILD_DIR)/obj-$(ARCH)/%.o) ################ # The prefix should always start with $(BULL_VENDOR_CODE) to avoid name # collisions with other vendors. Everything after that is up to the # developer, but must be globally unique. DEV_VIB_BASENAME = $(BULL_VENDOR_CODE)-ESX-$(DEV_PROJECT) ################ # Bulletin ID is generated using name, version from # componentNameSpec and componentVersionSpec respectively. # Component version is the full version in the format # OEM. # e.g., 1.2.3.1-1OEM.700.1.0.15440197 VIB_BULLETIN_ID = $(BULL_CNS_NAME)_$(BULL_CVS_VERSION) ################ # If creating a standalone userworld application, as opposed to a # shared object that gets loaded by some other program, uncomment # the following assignment. The value needs to be empty or non- # empty. If the latter, any content may be used. # DEV_APP = 1 ################ # Extra compiler and preprocessor flags based on kind of build (release or # beta). Except as discussed below, the usual default is to "comment out" these # lines, thereby making the declarations empty. # # WARNING: Several sample RPC "stub" files for NFS, shipped in this SDK, were # automatically generated by "rpcgen(1)", which currently produces rather poor # code that triggers many GCC warning-severity messages about unused variables. # We probably don't want to see these warnings, since they often detract from # noticing more-serious problems, so until someone fixes "rpcgen(1)", we force # "-Wno-unused-variable". The risk is that this might hide coding errors in # other files, so if you don't need to compile the sample RPC "stub" files, you # should either remove the "-Wno-unused-variable option or "comment out" the # following lines. DEV_beta_COMPILEFLAGS = -Wno-unused-variable DEV_release_COMPILEFLAGS = -Wno-unused-variable ################ # Define here any additional userworld libraries required by # uncommenting the appropriate variable(s) and modifying as needed. # If the library is not included in the devkit distribution, include a # -L /some/path parameter before the -lname parameter so that the # linker can find it. The *PRE* variables are included as the first # library directives. The *POST* variables are included as the last # such directives. # # The default values are empty. # DEV_release_PRE_LIBS = # DEV_beta_PRE_LIBS = -L /acme/print/lib -lprintwatch # The third assignment below is semantically equivalent to the # preceding two assignments, since we only do one type of build at # a time. See the gnumake documentation for details. # DEV_release_POST_LIBS = -lm # DEV_beta_POST_LIBS = -lm # or # DEV_$(DEV_BUILDTYPE)_POST_LIBS = -lm ################################################################ # Nothing beyond this point should require modification. BUILD_DIR = $(CURRENT_DIR)/build SCRATCH_DIR = $(BUILD_DIR)/scratch VIB_DIR = $(BUILD_DIR)/vib BUNDLE_DIR = $(BUILD_DIR)/component # STAGE_DIR is the base directory that will be populated exactly as how # the delivered files are to be installed. It corresponds to the # target host's root (/) directory. STAGE_DIR = $(BUILD_DIR)/payloads/$(DESC_PAYLOAD_NAME) DEV_UW_BIN = $(BUILD_DIR)/obj-$(ARCH)/libnvdkExampleNasPlugin.so DEV_VIB_XML = $(CURRENT_DIR)/descriptor.xml DEV_BULLETIN_XML = $(CURRENT_DIR)/bulletin.xml # Each element of ARCHPAIRS is of the form a=$(arch):b=$(bitwidth), # where a and b are the obvious abbreviations. As shown below, it # is intended that an element can be split and eval'd to get the # two values in separate variables. This approach has the advantage # of working with any variant of make and sh. # # ARCH is being set to prevent unplanned-for scenarios. The only # time its value should matter is in the recursive invocations # below in the libs and package targets. ARCH ?= bad_arch ARCHPAIRS := a=x64:b=64 ARCHBITS := 64 include $(shell /bin/rpm -q --qf '%{INSTPREFIXES}\n' vmware-esx-nvdk-devtools-7.0.1-0.0.16850804)/samples/common/nvdk.inc VMW_$(VMW_TARGET)_COMPILEFLAGS += -D_GNU_SOURCE .PHONY: $(DEV_UW_BIN) clean CC := $(VMW_uw$(ARCHBITS)_$(DEV_BUILDTYPE)_CCBIN) DEVKITHDRDIRS += -I /opt/vmware/nvdk-7.0.1-16850804/include # Have to add -shared here, rather than in the common file, because # it's not appropriate when creating executables, but is needed for # shared objects/libraries (which is what we're doing in this Makefile). # The common file is trying to be relatively generic. CCFLAGS += $(VMW_uw$(ARCHBITS)_$(DEV_BUILDTYPE)_COMPILEFLAGS) $(DEVKITHDRDIRS) LDFLAGS += -shared $(VMW_uw_$(DEV_BUILDTYPE)_LDFLAGS) $(DEVKITLIBDIRS) all: vib build-prep: @echo "** Preparing $(DEV_PROJECT) build tree" $(MKDIR) -p $(BUILD_DIR)/obj-$(ARCH) libs: for ap in $(ARCHPAIRS); do \ eval `echo $$ap | tr : ' '`; \ if [ ! -d $(BUILD_DIR)/obj-$${a} ]; then \ $(MKDIR) -p $(BUILD_DIR)/obj-$${a}; \ fi; \ $(MAKE) ARCH=$${a} $(BUILD_DIR)/obj-$${a}/libnvdkExampleNasPlugin.so; \ done all-workbench: userworld libs xml-checks package vib: userworld libs minimal-descriptor fill-bulletin xml-checks package package: $(RM) -rf $(STAGE_DIR) $(MKDIR) -p $(STAGE_DIR)/etc/vmware/init/init.d $(MKDIR) -p $(STAGE_DIR)/etc/vmware/init/manifests $(MKDIR) -p $(STAGE_DIR)/etc/vmware/firewall $(CP) init-scripts/ExampleNasPlugin-firewall.xml $(STAGE_DIR)/etc/vmware/firewall for ap in $(ARCHPAIRS); do \ eval `echo $$ap | tr : ' '`; \ $(MKDIR) -p $(STAGE_DIR)/usr/lib/vmware/nas_plugins/lib$$b; \ $(CP) $(BUILD_DIR)/obj-$$a/libnvdkExampleNasPlugin.so $(STAGE_DIR)/usr/lib/vmware/nas_plugins/lib$$b; \ done $(MAKE) -f Makefile vib-bundle clean: $(RM) -rf $(BUILD_DIR) $(DEV_BULLETIN_XML) \ $(DEV_VIB_XML)