# Makefile builds a Sample Provider Namespace
# ATTN: Today this makefile is implementation dependent.
#       It assumes that the repository is a set of directories
#       that can be removed by removing the directories.
#       This must be updated to an implementation independent repository
#       remove function.

ROOT = $(PEGASUS_ROOT)
include $(ROOT)/mak/config.mak
include $(ROOT)/mak/configschema.mak

# Loads the sample MOF into a separate namespace.
# The following variable determine the version of the Schema to
# be loaded into the Sample Provider namespace.
# Update the following variable to change the version.

SAMPLEPROVIDERNS=root/SampleProvider
SAMPLEPROVIDERNSDIRECTORY=$(REPOSITORY_ROOT)/root\#SampleProvider

# Load the sample MOF with the local compiler. Cleans the existing repository
# before reloading.
# NOTE: I believe that the remove is duplicated for some reason.
repository:
	@ echo +++++ Removing existing repository named $(SAMPLEPROVIDERNS)
	@$(RMREPOSITORY) $(SAMPLEPROVIDERNSDIRECTORY)
	@ echo +++++ Loading CIM_Core$(CIM_SCHEMA_VER) into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmofl -R$(REPOSITORY_DIR) -I$(CIM_SCHEMA_DIR) -n$(SAMPLEPROVIDERNS) $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_Core$(CIM_SCHEMA_VER).mof
	@ echo +++++ Loading CIM_Core$(CIM_SCHEMA_VER) into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmofl -R$(REPOSITORY_DIR) -I$(CIM_SCHEMA_DIR) -n$(SAMPLEPROVIDERNS) $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_Core$(CIM_SCHEMA_VER).mof
	@ echo +++++ Loading CIM_Event$(CIM_SCHEMA_VER) into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmofl -R$(REPOSITORY_DIR) -I$(CIM_SCHEMA_DIR) -n$(SAMPLEPROVIDERNS) $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_Event$(CIM_SCHEMA_VER).mof
ifdef PEGASUS_PLATFORM_LINUX_GENERIC_GNU
	@ echo +++++ Loading CIM_System$(CIM_SCHEMA_VER) into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmofl -R$(REPOSITORY_DIR) -I$(CIM_SCHEMA_DIR) -n$(SAMPLEPROVIDERNS) $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_System$(CIM_SCHEMA_VER).mof
endif   
	@ echo +++++ Loading SampleProvider class definitions into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmofl -R$(REPOSITORY_DIR) -n$(SAMPLEPROVIDERNS) SampleProviderSchema.mof
	@ cimmofl -R$(REPOSITORY_DIR) -n$(SAMPLEPROVIDERNS) RT_Indication.mof
	@ cimmofl -R$(REPOSITORY_DIR) -n$(SAMPLEPROVIDERNS) ClientTest.mof
	@ echo +++++ Registering Sample Providers  ...
	@ cimmofl -R$(REPOSITORY_DIR) -n$(INTEROPNS) SampleProviderSchemaR.mof
	@ echo +++++ Installing the Family MOF file for the association provider
	@ cimmofl -R$(REPOSITORY_DIR) -n$(SAMPLEPROVIDERNS) TST_Family.mof
	@ echo +++++ Registering FamilyProvider schema Providers  ...
	@ cimmofl -R$(REPOSITORY_DIR) -n$(INTEROPNS) FamilyProviderSchemaR.mof

ifdef PEGASUS_PLATFORM_LINUX_GENERIC_GNU
	@ echo +++++ Installing the CWS_FilesAndDirectories for CMPI
	@ cimmofl -R$(REPOSITORY_DIR) -n$(SAMPLEPROVIDERNS) CWS_FilesAndDir.mof
	@ echo +++++ Registering CWS_FilesAndDirectories for CMPI ...
	@ cimmofl -R$(REPOSITORY_DIR) -n$(INTEROPNS) CWS_FilesAndDirR.mof
endif
   
# Load the sample mofe through the Client interface compiler but do not
# clean out the existing version.
repositoryServer:
	@ echo +++++ Loading CIM_Core$(CIM_SCHEMA_VER) into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmof -I$(CIM_SCHEMA_DIR) -n$(SAMPLEPROVIDERNS) $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_Core$(CIM_SCHEMA_VER).mof
	@ echo +++++ Loading CIM_Event$(CIM_SCHEMA_VER) into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmof -I$(CIM_SCHEMA_DIR) -n$(SAMPLEPROVIDERNS) $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_Event$(CIM_SCHEMA_VER).mof
ifdef PEGASUS_PLATFORM_LINUX_GENERIC_GNU
	@ echo +++++ Loading CIM_System$(CIM_SCHEMA_VER) into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmof -I$(CIM_SCHEMA_DIR) -n$(SAMPLEPROVIDERNS) $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_System$(CIM_SCHEMA_VER).mof
endif   
	@ echo +++++ Loading SampleProvider class definitions into $(SAMPLEPROVIDERNS) namespace ...
	@ cimmof -n$(SAMPLEPROVIDERNS) SampleProviderSchema.mof
	@ cimmof -n$(SAMPLEPROVIDERNS) RT_Indication.mof
	@ cimmof -n$(SAMPLEPROVIDERNS) ClientTest.mof
	@ echo +++++ Registering SampleProvider schema Providers  ...
	@ cimmof -n$(INTEROPNS) SampleProviderSchemaR.mof
	@ echo +++++ Installing the Family MOF file for the association provider
	@ cimmof -n$(SAMPLEPROVIDERNS) TST_Family.mof
	@ echo +++++ Registering FamilyProvider schema Providers  ...
	@ cimmof -n$(INTEROPNS) FamilyProviderSchemaR.mof
	
ifdef PEGASUS_PLATFORM_LINUX_GENERIC_GNU
	@ echo +++++ Installing the CWS_FilesAndDirectories for CMPI
	@ cimmof -n$(SAMPLEPROVIDERNS) CWS_FilesAndDir.mof
	@ echo +++++ Registering CWS_FilesAndDirectories for CMPI ...
	@ cimmof -n$(INTEROPNS) CWS_FilesAndDirR.mof
endif

removerepository:
	@ echo +++++ Removing existing repository named $(SAMPLEPROVIDERNS)
	@ $(RMREPOSITORY) $(SAMPLEPROVIDERNSDIRECTORY)

unregister:
	$(MAKE) -i unregisterproviders

unregisterproviders:
	cimprovider -r -m SampleIndicationProviderModule
	cimprovider -r -m SampleInstanceProviderModule
	cimprovider -r -m SampleMethodProviderModule
	cimprovider -r -m RT_IndicationProviderModule
	cimprovider -r -m SampleLocalizedProviderModule
	cimprovider -r -m SimpleDisplayConsumerModule
	cimprovider -r -m FilesAndDirectoriesModule

depend:

sub:

misc:

tests:

poststarttests:

general:

clean:
