#//%LICENSE////////////////////////////////////////////////////////////////
#//
#// Licensed to The Open Group (TOG) under one or more contributor license
#// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
#// this work for additional information regarding copyright ownership.
#// Each contributor licenses this file to you under the OpenPegasus Open
#// Source License; you may not use this file except in compliance with the
#// License.
#//
#// Permission is hereby granted, free of charge, to any person obtaining a
#// copy of this software and associated documentation files (the "Software"),
#// to deal in the Software without restriction, including without limitation
#// the rights to use, copy, modify, merge, publish, distribute, sublicense,
#// and/or sell copies of the Software, and to permit persons to whom the
#// Software is furnished to do so, subject to the following conditions:
#//
#// The above copyright notice and this permission notice shall be included
#// in all copies or substantial portions of the Software.
#//
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#//
#//////////////////////////////////////////////////////////////////////////
ifndef ROOT
 ifdef PEGASUS_ROOT
    ROOT =  $(subst \,/,$(PEGASUS_ROOT))
 else
    ROOT = .
 endif
endif

PEGASUS_RPM_SPEC_FILE_PATH=$(PEGASUS_ROOT)/rpm/tog-pegasus.spec

include $(ROOT)/mak/config.mak

DIRS = src

include $(ROOT)/mak/recurse.mak

FORCE:

rebuild: FORCE
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release -i cimstop
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release clean
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release create_ProductVersionFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release create_CommonProductDirectoriesInclude
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release create_ConfigProductDirectoriesInclude
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release depend
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release all
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release repository
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release stage
	@$(ECHO) "build completed successfully"

repository: FORCE
	$(CHMOD) $(Prwxrwxrwx) $(PEGASUS_HOME)
	$(MAKE) "-SC" Schemas/Pegasus repository

stage: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release prestage_verifyInstallEnabled
	$(MAKE) --directory=$(ROOT) -f Makefile.Release prestage_cleanup
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusDirectories
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusEmptyFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_genOpenPegasusSSLCertsFile
	$(MAKE) --directory=$(ROOT) -f mak/SDKMakefile stageSDK
ifdef PEGASUS_BUILD_TEST_RPM
	$(MAKE) --directory=$(ROOT) -f Makefile.ReleaseTest stageTEST
endif

preinstall: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release prestage_verifyInstallEnabled
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusDirectories
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusFiles

PEGASUS_PROVIDER_MANAGERS =

PEGASUS_LIBRARIES = \
   libCIMxmlIndicationHandler \
   libConfigSettingProvider \
   libNamespaceProvider \
   libProviderRegistrationProvider \
   libUserAuthProvider \
   libpegauthentication \
   libpegclient \
   libpegcliutils \
   libpeggeneral \
   libpegcommon \
   libpegcompiler \
   libpegconfig \
   libpegexportclient \
   libpegexportserver \
   libpeggetoopt \
   libpeghandlerservice \
   libpegindicationservice \
   libpeglistener \
   libpegpmrouter \
   libpegpmservice \
   libpegprm \
   libpegprovider \
   libpegprovidermanager \
   libpegrepository \
   libpegserver \
   libpeguser \
   libpegwql \
   libDefaultProviderManager \
   libCertificateProvider \
   libpegqueryexpression \
   libpegquerycommon \
   libpegservice

ifeq ($(PEGASUS_ENABLE_CQL),true)
   PEGASUS_LIBRARIES += \
      libpegcql \
      libCIMQueryCapabilitiesProvider
endif

ifeq ($(PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER),true)
PEGASUS_LIBRARIES += \
   libcmpiCppImpl
PEGASUS_PROVIDER_MANAGERS += \
   libCMPIProviderManager
endif

PEGASUS_JARS =
JAR_SUFFIX = .jar

ifeq ($(PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER), true)
PEGASUS_LIBRARIES += \
   libJMPIProviderManager
PEGASUS_JARS += \
   JMPIImpl
endif

ifeq ($(PEGASUS_ENABLE_INTEROP_PROVIDER),true)
PEGASUS_LIBRARIES += \
   libInteropProvider
endif

ifdef PEGASUS_USE_NET_SNMP
   PEGASUS_LIBRARIES += \
      libsnmpIndicationHandler
endif

ifeq ($(PEGASUS_ENABLE_PROTOCOL_WSMAN),true)
PEGASUS_LIBRARIES += \
    libpegwsmserver
endif

ifeq ($(PEGASUS_ENABLE_SLP), true)
PEGASUS_LIBRARIES += \
    libpegslp \
    libpegslp_client
endif

ifeq ($(OS),HPUX)
PEGASUS_LIBRARIES += \
   libNTPProviderSecurity
endif

PEGASUS_LIBRARY_LINKS = \
   libpegclient \
   libpegcommon \
   libpegprovider \
   libDefaultProviderManager \
   libCIMxmlIndicationHandler

ifeq ($(PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER), true)
   PEGASUS_LIBRARY_LINKS += \
       libJMPIProviderManager
endif

ifdef PEGASUS_USE_NET_SNMP
PEGASUS_LIBRARY_LINKS += \
   libsnmpIndicationHandler
endif

PEGASUS_PROVIDERS = \
   libComputerSystemProvider \
   libOSProvider \
   libProcessProvider

ifeq ($(OS),HPUX)
PEGASUS_PROVIDERS += \
   libNTPProvider \
   libNISProvider \
   libDNSProvider \
   libIPProviderModule
endif

PEGASUS_ADMIN_CMDS = \
   cimauth \
   cimconfig \
   cimserver \
   cimprovagt \
   cimservera \
   cimreparchive \
   cimtrust \
   repupgrade

ifeq ($(PEGASUS_ENABLE_PRIVILEGE_SEPARATION),true)
   PEGASUS_ADMIN_CMDS += \
      cimservermain \
      cimshutdown
endif

PEGASUS_USER_CMDS = \
   cimmof \
   cimmofl \
   cimprovider \
   cimsub \
   osinfo \
   wbemexec

PEGASUS_GENERATED_SCRIPTS = \
   genOpenPegasusSSLCerts

#############################################################################
## If needed, you can use the PEGASUS_CVS_SCRIPTS variable to include
## one or more script files in an OpenPegasus release.  Scripts should be
## placed in the CVS directory pegasus/installs/scripts.
#############################################################################

PEGASUS_SCRIPT_FILES = \
   $(PEGASUS_GENERATED_SCRIPTS) \
   $(PEGASUS_CVS_SCRIPTS)

PEGASUS_UNIX_MAN_USER_PAGES = \
   cimmof.1 \
   cimprovider.1 \
   cimsub.1 \
   osinfo.1 \
   wbemexec.1

PEGASUS_UNIX_MAN_ADMIN_PAGES = \
   cimauth.8 \
   cimconfig.8 \
   cimreparchive.8 \
   cimtrust.8 \
   cimserver.8

PEGASUS_DOC_FILES = \
   Admin_Guide_Release.pdf \
   PegasusSSLGuidelines.htm \
   license.txt

INTERNAL_MOF_FILES = \
   PG_Authorization20.mof \
   PG_ConfigSetting20.mof \
   PG_InternalSchema20.mof \
   PG_SSLCertificate20.mof \
   PG_SSLCertificateRevocationList20.mof \
   PG_ShutdownService20.mof \
   PG_User20.mof

INTEROP_MOF_FILES = \
   PG_Events20.mof \
   PG_InterOpSchema20.mof \
   PG_ProviderModule20.mof

ifeq ($(PEGASUS_ENABLE_INTEROP_PROVIDER),true)
   INTEROP_MOF_FILES += \
      PG_CIMXMLCommunicationMechanism20.mof \
      PG_Namespace20.mof\
      PG_ServerProfile20.mof
endif

MANAGEDSYSTEM_MOF_FILES = \
   PG_ComputerSystem20.mof \
   PG_ComputerSystem20R.mof \
   PG_ManagedSystemSchema20.mof \
   PG_ManagedSystemSchema20R.mof \
   PG_OperatingSystem20.mof \
   PG_OperatingSystem20R.mof \
   PG_UnixProcess20.mof \
   PG_UnixProcess20R.mof

ifeq ($(PEGASUS_ENABLE_SLP), true)
   MANAGEDSYSTEM_MOF_FILES += \
      PG_SLPProvider20R.mof
endif

prestage_verifyInstallEnabled: FORCE
ifndef PEGASUS_ENABLE_MAKE_INSTALL
	@$(ECHO) "Makefile.Release is not enabled."
	@exit 1
endif

prestage_cleanup: FORCE
	$(foreach i, $(PEGASUS_DIRECTORIES_TO_BE_REMOVED), $(RMDIRHIER) $(PEGASUS_STAGING_DIR)$(i);)
	$(RMDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_LOCAL_DOMAIN_SOCKET_DIR)
	$(RMDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_LOCAL_AUTH_DIR)

stage_PegasusProductDirectories: FORCE
	$(foreach i, $(PEGASUS_SYSTEM_DIRECTORIES), $(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(i);)
	$(foreach i, $(PEGASUS_SPECIFIC_DIRECTORIES), $(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(i);)
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_DIR)
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_MANAGER_LIB_DIR)

setpermissions_PegasusProductDirectories: FORCE
	$(foreach i, $(PEGASUS_SPECIFIC_DIRECTORIES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(i);)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_DIR)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_MANAGER_LIB_DIR)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_SBIN_DIR)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_BIN_DIR)

stage_PegasusSocketDirectory: FORCE
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_LOCAL_DOMAIN_SOCKET_DIR)
	
setpermissions_PegasusSocketDirectory: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(CIMSERVERMAIN_USR)" GROUP="$(CIMSERVERMAIN_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_LOCAL_DOMAIN_SOCKET_DIR)

stage_PegasusVarRunDirectory: FORCE
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_VARRUN_DIR)

setpermissions_PegasusVarRunDirectory: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(CIMSERVERMAIN_USR)" GROUP="$(CIMSERVERMAIN_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_VARRUN_DIR)
	
stage_PegasusLocalAuthDirectory: FORCE
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_LOCAL_AUTH_DIR)
	
setpermissions_PegasusLocalAuthDirectory: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_LOCAL_AUTH_DIR)

stage_PegasusJarFiles: FORCE
	$(foreach i, $(PEGASUS_JARS), $(COPY) $(PEGASUS_HOME)/lib/$(i)$(JAR_SUFFIX) $(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)/$(i)$(JAR_SUFFIX);)

setpermissions_PegasusJarFiles: FORCE
	$(foreach i, $(PEGASUS_JARS), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)/$(i)$(JAR_SUFFIX);)

	
stage_PegasusLibraryDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_LIBRARIES), $(COPY) $(PEGASUS_HOME)/lib/$(i)$(LIB_SUFFIX) $(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)/$(i)$(LIB_SUFFIX);)
	$(foreach i, $(PEGASUS_LIBRARY_LINKS), $(MAKE) --directory=$(ROOT) -f Makefile.Release createlink OBJECT=$(i)$(LIB_SUFFIX) LINKNAME=$(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)/$(i)$(LIB_LINK_SUFFIX);)
ifeq ($(PEGASUS_ENABLE_SLP), true)
	$(COPY) $(PEGASUS_HOME)/lib/libpegslp_client$(LIB_SUFFIX) $(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)/libpegslp_client$(LIB_SUFFIX)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release createlink OBJECT=libpegslp_client$(LIB_SUFFIX) LINKNAME=$(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)/libpegslp_client$(LIB_LINK_SUFFIX)
endif

setpermissions_PegasusLibraryDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_LIBRARIES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_DEST_LIB_DIR)/$(i)$(LIB_SUFFIX);)

stage_PegasusProviderLibraryDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_PROVIDERS), $(COPY) $(PEGASUS_HOME)/lib/$(i)$(LIB_SUFFIX) $(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)/$(i)$(LIB_SUFFIX);)
	$(foreach i, $(PEGASUS_PROVIDERS), $(MAKE) --directory=$(ROOT) -f Makefile.Release createlink OBJECT=$(i)$(LIB_SUFFIX) LINKNAME=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)/$(i)$(LIB_LINK_SUFFIX);)
ifeq ($(PEGASUS_ENABLE_SLP), true)
	$(COPY) $(PEGASUS_HOME)/lib/libSLPProvider$(LIB_SUFFIX) $(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)/libSLPProvider$(LIB_SUFFIX)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release createlink OBJECT=libSLPProvider$(LIB_SUFFIX) LINKNAME=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)/libSLPProvider$(LIB_LINK_SUFFIX)
endif

setpermissions_PegasusProviderLibraryDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_PROVIDERS), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)/$(i)$(LIB_SUFFIX);)
ifeq ($(PEGASUS_ENABLE_SLP), true)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_LIB_DIR)/libSLPProvider$(LIB_SUFFIX)
endif

stage_PegasusProviderManagerLibraryDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_PROVIDER_MANAGERS), $(COPY) $(PEGASUS_HOME)/lib/$(i)$(LIB_SUFFIX) $(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_MANAGER_LIB_DIR)/$(i)$(LIB_SUFFIX);)
	$(foreach i, $(PEGASUS_PROVIDER_MANAGERS), $(MAKE) --directory=${ROOT} -f Makefile.Release createlink OBJECT=$(i)$(LIB_SUFFIX) LINKNAME=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_MANAGER_LIB_DIR)/$(i)$(LIB_LINK_SUFFIX);)

setpermissions_PegasusProviderManagerLibraryDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_PROVIDER_MANAGERS), $(MAKE) --directory=${ROOT} -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_PROVIDER_MANAGER_LIB_DIR)/$(i)$(LIB_SUFFIX);)

stage_PegasusAdminCmdsDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_ADMIN_CMDS), $(COPY) $(PEGASUS_HOME)/bin/$(i)$(EXE) $(PEGASUS_STAGING_DIR)$(PEGASUS_SBIN_DIR)/$(i)$(EXE);)
	$(foreach i, $(PEGASUS_CVS_SCRIPTS), $(COPY) $(PEGASUS_ROOT)/installs/scripts/$(i) $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/$(i);)

setpermissions_PegasusAdminCmdsDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_ADMIN_CMDS), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_SBIN_DIR)/$(i)$(EXE);)
	$(foreach i, $(PEGASUS_SCRIPT_FILES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/$(i);)

stage_PegasusUserCmdsDirectoryFiles: FORCE
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_BIN_DIR)
	$(foreach i, $(PEGASUS_USER_CMDS), $(COPY) $(PEGASUS_HOME)/bin/$(i)$(EXE) $(PEGASUS_STAGING_DIR)$(PEGASUS_BIN_DIR)/$(i)$(EXE);)

setpermissions_PegasusUserCmdsDirectoryFiles: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_BIN_DIR)
	$(foreach i, $(PEGASUS_USER_CMDS), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_BIN_DIR)/$(i)$(EXE);)

stage_PegasusRepository: FORCE
	$(RMDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_REPOSITORY_DIR)
	$(CPDIRHIER) $(PEGASUS_HOME)/repository $(PEGASUS_STAGING_DIR)$(PEGASUS_REPOSITORY_PARENT_DIR)

setpermissions_PegasusRepository: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release sethierpermissions PERMISSIONS="$(Prwx______)" OWNER="$(CIMSERVERMAIN_USR)" GROUP="$(CIMSERVERMAIN_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_REPOSITORY_DIR)

stage_PegasusUnixManPageDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_UNIX_MAN_USER_PAGES), $(COPY) $(ROOT)/rpm/manLinux/man1.Z/$(i) $(PEGASUS_STAGING_DIR)$(PEGASUS_MANUSER_DIR)/$(i);)
	$(foreach i, $(PEGASUS_UNIX_MAN_ADMIN_PAGES), $(COPY) $(ROOT)/rpm/manLinux/man8.Z/$(i) $(PEGASUS_STAGING_DIR)$(PEGASUS_MANADMIN_DIR)/$(i);)

setpermissions_PegasusUnixManPageDirectoryFiles: FORCE
	$(foreach i, $(PEGASUS_UNIX_MAN_USER_PAGES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr__r__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_MANUSER_DIR)/$(i);)
	$(foreach i, $(PEGASUS_UNIX_MAN_ADMIN_PAGES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr__r__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_MANADMIN_DIR)/$(i);)

stage_PegasusDocFiles: FORCE
	$(foreach i, $(PEGASUS_DOC_FILES), $(COPY) $(ROOT)/doc/$(i) $(PEGASUS_STAGING_DIR)$(PEGASUS_DOC_DIR)/$(i);)
	$(COPY) $(ROOT)/OpenPegasusNOTICE.txt \
            $(PEGASUS_STAGING_DIR)$(PEGASUS_DOC_DIR)/OpenPegasusNOTICE.txt

setpermissions_PegasusDocFiles: FORCE
	$(foreach i, $(PEGASUS_DOC_FILES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr__r__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_DOC_DIR)/$(i);)

stage_PegasusMOFDirectoryFiles: FORCE
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus
	$(foreach i, $(INTERNAL_MOF_FILES), $(COPY) $(ROOT)/Schemas/Pegasus/Internal/VER20/$(i) $(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus/$(i);)
	$(foreach i, $(INTEROP_MOF_FILES), $(COPY) $(ROOT)/Schemas/Pegasus/InterOp/VER20/$(i) $(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus/$(i);)
	$(foreach i, $(MANAGEDSYSTEM_MOF_FILES), $(COPY) $(ROOT)/Schemas/Pegasus/ManagedSystem/VER20/$(i) $(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus/$(i);)

setpermissions_PegasusMOFDirectoryFiles: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr_xr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus
	$(foreach i, $(INTERNAL_MOF_FILES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr__r__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus/$(i);)
	$(foreach i, $(INTEROP_MOF_FILES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr__r__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus/$(i);)
	$(foreach i, $(MANAGEDSYSTEM_MOF_FILES), $(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Pr__r__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_MOF_DIR)/Pegasus/$(i);)

stage_PegasusConfFiles: FORCE
	$(COPY) $(ROOT)/src/Server/cimserver_planned.conf $(PEGASUS_STAGING_DIR)$(PEGASUS_CONFIG_DIR)/$(PEGASUS_PLANNED_CONFIG_FILE)

setpermissions_PegasusConfFiles: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prw_r__r__)" OWNER="$(CIMSERVER_USR)" GROUP="$(CIMSERVER_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_CONFIG_DIR)/$(PEGASUS_PLANNED_CONFIG_FILE)

stage_genOpenPegasusSSLCertsFile: FORCE
	@$(RM) $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "#!/bin/bash" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "#" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "PEGASUS_PEM_DIR=$(PEGASUS_PEM_DIR)" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "PEGASUS_CONFIG_DIR=$(PEGASUS_CONFIG_DIR)" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "PEGASUS_INSTALL_LOG=$(PEGASUS_INSTALL_LOG)" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "PEGASUS_SSL_CERT_FILE=$(PEGASUS_SSL_CERT_FILE)" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "PEGASUS_SSL_KEY_FILE=$(PEGASUS_SSL_KEY_FILE)" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(ECHO-E) "PEGASUS_SSL_TRUSTSTORE=$(PEGASUS_SSL_TRUSTSTORE)" >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-genSSLCerts.spec >> \
             $(PEGASUS_STAGING_DIR)$(PEGASUS_SCRIPT_DIR)/genOpenPegasusSSLCerts

stage_PegasusDirectories: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusProductDirectories
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusSocketDirectory
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusLocalAuthDirectory

setpermissions_PegasusDirectories: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusProductDirectories
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusSocketDirectory
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusLocalAuthDirectory

stage_PegasusFiles: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusLibraryDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusProviderLibraryDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusProviderManagerLibraryDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusAdminCmdsDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusUserCmdsDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusConfFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusRepository
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusUnixManPageDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusDocFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusMOFDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusSystemFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release stage_PegasusJarFiles

setpermissions_PegasusFiles: FORCE
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusLibraryDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusProviderLibraryDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusProviderManagerLibraryDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusAdminCmdsDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusUserCmdsDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusConfFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusRepository
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusUnixManPageDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusDocFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusMOFDirectoryFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusSystemFiles
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions_PegasusJarFiles

stage_PegasusSystemFiles: FORCE
ifeq ($(OS),linux)
ifdef PEGASUS_PAM_AUTHENTICATION
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)$(PAM_CONFIG_DIR)
	$(COPY) $(ROOT)/rpm/wbem $(PEGASUS_STAGING_DIR)$(PAM_CONFIG_DIR)/$(PAM_CONFIG_FILE)
	$(COPY) $(ROOT)/rpm/access.conf $(PEGASUS_STAGING_DIR)$(PEGASUS_CONFIG_DIR)/access.conf
endif
	$(MKDIRHIER) $(PEGASUS_STAGING_DIR)/etc/init.d
	$(COPY) $(ROOT)/rpm/preamble-tog-pegasus.rc $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	@$(ECHO-E) "CIMSERVER_BIN=$(PEGASUS_SBIN_DIR)/cimserver" >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	@$(ECHO-E) "PEGASUS_SCRIPT_DIR=$(PEGASUS_SCRIPT_DIR)" >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	@$(ECHO-E) "PEGASUS_SSL_CONF_FILE=$(PEGASUS_PEM_DIR)/ssl.cnf" >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	@$(ECHO-E) "PEGASUS_SSL_CERT_FILE=$(PEGASUS_SSL_CERT_FILE_PATH)" >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	@$(ECHO-E) "PEGASUS_SSL_KEY_FILE=$(PEGASUS_SSL_KEY_FILE_PATH)" >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	@$(ECHO-E) "PEGASUS_SSL_TRUSTSTORE=$(PEGASUS_SSL_CLIENT_TRUSTSTORE)" >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	@$(ECHO-E) "PEGASUS_FLAVOR=$(PEGASUS_FLAVOR)" >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
	$(CAT) $(ROOT)/rpm/commands-tog-pegasus.rc >> $(PEGASUS_STAGING_DIR)/etc/init.d/$(PEGASUS_FLAVOR)-pegasus
endif

setpermissions_PegasusSystemFiles: FORCE
ifeq ($(OS),linux)
ifdef PEGASUS_PAM_AUTHENTICATION
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prw_r__r__)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PAM_CONFIG_DIR)/$(PAM_CONFIG_FILE)
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prw_______)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)$(PEGASUS_CONFIG_DIR)/access.conf
endif
	$(MAKE) --directory=$(ROOT) -f Makefile.Release setpermissions PERMISSIONS="$(Prwxr_xr_x)" OWNER="$(INSTALL_USR)" GROUP="$(INSTALL_GRP)" OBJECT=$(PEGASUS_STAGING_DIR)etc/init.d/$(PEGASUS_FLAVOR)-pegasus
endif

stage_PegasusEmptyFiles: FORCE
	$(TOUCH) $(PEGASUS_STAGING_DIR)$(PEGASUS_CONFIG_DIR)/ssl.cnf
	$(TOUCH) $(PEGASUS_STAGING_DIR)$(PEGASUS_PEM_DIR)/$(PEGASUS_SSL_CERT_FILE)
	$(TOUCH) $(PEGASUS_STAGING_DIR)$(PEGASUS_PEM_DIR)/$(PEGASUS_SSL_KEY_FILE)
	$(TOUCH) $(PEGASUS_STAGING_DIR)$(PEGASUS_PEM_DIR)/$(PEGASUS_SSL_TRUSTSTORE)
	$(TOUCH) $(PEGASUS_STAGING_DIR)$(PEGASUS_INSTALL_LOG)

create_ProductVersionFile: FORCE
ifdef PEGASUS_OVERRIDE_PRODUCT_ID
ifdef PEGASUS_PRODUCT_NAME
ifdef PEGASUS_PRODUCT_VERSION
ifdef PEGASUS_PRODUCT_STATUS
	@$(ECHO-E) "#ifndef Product_Version_h" > $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "#define Product_Version_h" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "#define PEGASUS_PRODUCT_NAME "\""$(PEGASUS_PRODUCT_NAME)"\""" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "#define PEGASUS_PRODUCT_VERSION "\""$(PEGASUS_PRODUCT_VERSION)"\""" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "#define PEGASUS_PRODUCT_STATUS "\""$(PEGASUS_PRODUCT_STATUS)"\""" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "#define PEGASUS_CIMOM_GENERIC_NAME \"Pegasus\"" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "#define PEGASUS_CIMOM_DESCRIPTION \"\"" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
	@$(ECHO-E) "#endif /* Product_Version_h */" >> $(ROOT)/src/Pegasus/Common/ProductVersion.h
endif
endif
endif
endif

create_CommonProductDirectoriesInclude: FORCE
ifdef PEGASUS_OVERRIDE_DEFAULT_RELEASE_DIRS
	@$(ECHO-E) "#ifndef Common_Product_Directory_Structure_h" \
             > $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "#define Common_Product_Directory_Structure_h" \
             >>  $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_CIMSERVER_START_FILE"  \
             "\""$(PEGASUS_CIMSERVER_START_FILE)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_CIMSERVER_START_LOCK_FILE"  \
             "\""$(PEGASUS_CIMSERVER_START_LOCK_FILE)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_REPOSITORY_DIR"  \
             "\""$(PEGASUS_REPOSITORY_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_CURRENT_CONFIG_FILE_PATH"  \
             "\""$(PEGASUS_CURRENT_CONFIG_FILE_PATH)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_PLANNED_CONFIG_FILE_PATH"  \
             "\""$(PEGASUS_PLANNED_CONFIG_FILE_PATH)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_SSLCLIENT_CERTIFICATEFILE"  \
             "\""$(PEGASUS_SSL_CLIENT_TRUSTSTORE)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_SSLCLIENT_RANDOMFILE"  \
             "\""$(PEGASUS_VARDATA_DIR)/ssl.rnd"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_SSLSERVER_RANDOMFILE"  \
             "\""$(PEGASUS_VARDATA_DIR)/cimserver.rnd"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_LOCAL_AUTH_DIR"  \
             "\""$(PEGASUS_LOCAL_AUTH_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_LOCAL_DOMAIN_SOCKET_PATH"  \
             "\""$(PEGASUS_LOCAL_DOMAIN_SOCKET_PATH)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_CORE_DIR"  \
             "\""$(PEGASUS_CORE_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_PAM_STANDALONE_PROC_NAME"  \
             "\""$(PEGASUS_SBIN_DIR)/cimservera"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_PROVIDER_AGENT_PROC_NAME"  \
             "\""$(PEGASUS_SBIN_DIR)/cimprovagt"\"" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "" \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
	@$(ECHO-E) "#endif /* Common_Product_Directory_Structure_h */ " \
             >> $(ROOT)/src/Pegasus/Common/ProductDirectoryStructure.h
endif

create_ConfigProductDirectoriesInclude: FORCE
ifdef PEGASUS_OVERRIDE_DEFAULT_RELEASE_DIRS
	@$(ECHO-E) "#ifndef Config_Product_Directory_Structure_h" \
             > $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "#define Config_Product_Directory_Structure_h" \
             >>  $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_LOG_DIR"  \
             "\""$(PEGASUS_LOG_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_TRACE_FILE_PATH"  \
             "\""$(PEGASUS_TRACE_FILE_PATH)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_CONFIG_DIR"  \
             "\""$(PEGASUS_CONFIG_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_SSL_CERT_FILE_PATH"  \
             "\""$(PEGASUS_SSL_CERT_FILE_PATH)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_SSL_KEY_FILE_PATH"  \
             "\""$(PEGASUS_SSL_KEY_FILE_PATH)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_SSL_SERVER_TRUSTSTORE"  \
             "\""$(PEGASUS_SSL_SERVER_TRUSTSTORE)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_SSL_SERVER_CRL"  \
             "\""$(PEGASUS_SSL_SERVER_CRL)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_PREV_REPOSITORY_DIR"  \
             "\""$(PEGASUS_PREV_REPOSITORY_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_PROVIDER_LIB_DIR"  \
             "\""$(PEGASUS_PROVIDER_LIB_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "# define PEGASUS_PROVIDER_MANAGER_LIB_DIR"  \
             "\""$(PEGASUS_PROVIDER_MANAGER_LIB_DIR)"\"" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "" \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
	@$(ECHO-E) "#endif /* Config_Product_Directory_Structure_h */ " \
             >> $(ROOT)/src/Pegasus/Config/ProductDirectoryStructure.h
endif

create_ProductInstallationVerificationScript: FORCE
	@$(RM) $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nSYSTEM DIRECTORIES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_SYSTEM_DIRECTORIES), \
             $(ECHO-E) "ls -ld $(i)" >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "ls -ld $(PEGASUS_DEST_LIB_DIR)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS-SPECIFIC DIRECTORIES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_SPECIFIC_DIRECTORIES), \
             $(ECHO-E) "ls -ld $(i)" >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "ls -ld $(PEGASUS_PROVIDER_DIR)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PEGASUS_PROVIDER_LIB_DIR)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PEGASUS_PROVIDER_MANAGER_LIB_DIR)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PEGASUS_LOCAL_DOMAIN_SOCKET_DIR)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS DOCUMENT FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_DOC_FILES), \
             $(ECHO-E) "ls -l $(PEGASUS_DOC_DIR)/$(i)" \
                 >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "ls -l $(PEGASUS_DOC_DIR)/OpenPegasusNOTICE.txt" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS LIBRARIES FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_LIBRARIES), $(ECHO-E) \
             "ls -l $(PEGASUS_DEST_LIB_DIR)/$(i)$(LIB_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(foreach i, $(PEGASUS_LIBRARY_LINKS), $(ECHO-E) \
             "ls -l $(PEGASUS_DEST_LIB_DIR)/$(i)$(LIB_LINK_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
ifeq ($(PEGASUS_ENABLE_SLP), true)
	@(ECHO-E) "ls -l $(PEGASUS_DEST_LIB_DIR)/libpegslp_client$(LIB_LINK_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
endif
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS PACKAGED PROVIDER MANAGER FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_PROVIDER_MANAGERS), $(ECHO-E) \
             "ls -l $(PEGASUS_PROVIDER_MANAGER_LIB_DIR)/$(i)$(LIB_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(foreach i, $(PEGASUS_PROVIDER_MANAGERS), $(ECHO-E) \
             "ls -l $(PEGASUS_PROVIDER_MANAGER_LIB_DIR)/$(i)$(LIB_LINK_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS PACKAGED PROVIDER FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_PROVIDERS), $(ECHO-E) \
             "ls -l $(PEGASUS_PROVIDER_LIB_DIR)/$(i)$(LIB_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(foreach i, $(PEGASUS_PROVIDERS), $(ECHO-E) \
             "ls -l $(PEGASUS_PROVIDER_LIB_DIR)/$(i)$(LIB_LINK_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
ifeq ($(PEGASUS_ENABLE_SLP), true)
	@(ECHO-E) "ls -l $(PEGASUS_PROVIDER_LIB_DIR)/libSLPProvider$(LIB_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@(ECHO-E) "ls -l $(PEGASUS_PROVIDER_LIB_DIR)/libSLPProvider$(LIB_LINK_SUFFIX)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
endif
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS ADMIN CMD FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_ADMIN_CMDS), $(ECHO-E) \
             "ls -l $(PEGASUS_SBIN_DIR)/$(i)$(EXE)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS SCRIPT FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_SCRIPT_FILES), $(ECHO-E) \
             "ls -l $(PEGASUS_SCRIPT_DIR)/$(i)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS USER CMD FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_USER_CMDS), $(ECHO-E) \
             "ls -l $(PEGASUS_BIN_DIR)/$(i)$(EXE)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS REPOSITORY FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -lR $(PEGASUS_REPOSITORY_DIR)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS MAN FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(foreach i, $(PEGASUS_UNIX_MAN_ADMIN_PAGES), $(ECHO-E) \
             "ls -ld $(PEGASUS_MANADMIN_DIR)/$(i)*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(foreach i, $(PEGASUS_UNIX_MAN_USER_PAGES), $(ECHO-E) \
             "ls -ld $(PEGASUS_MANUSER_DIR)/$(i)*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall;)
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS PEM FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -l $(PEGASUS_SSL_CERT_FILE_PATH)*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -l $(PEGASUS_SSL_KEY_FILE_PATH)*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -l $(PEGASUS_SSL_CLIENT_TRUSTSTORE)*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PEGASUS_SSL_SERVER_TRUSTSTORE)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS CONF FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PEGASUS_CONFIG_DIR)/ssl.cnf*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PEGASUS_CONFIG_DIR)/access.conf*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS PAM FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PAM_CONFIG_DIR)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -l $(PAM_CONFIG_DIR)/$(PAM_CONFIG_FILE)" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS TRACE FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -l $(PEGASUS_TRACE_DIR)/*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "$(ECHO-E) \"\nPEGASUS VARRUN FILES\"" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall
	@$(ECHO-E) "ls -ld $(PEGASUS_VARRUN_DIR)/*" \
             >> $(PEGASUS_HOME)/PegasusVerifyInstall


create_OpenPegasusRPMSpecFile: FORCE
	@$(RM) $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release \
            _append_OpenPegasusLicenseToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_PreambleToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_PackagesToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_prepSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_buildSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_installSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_cleanSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_preSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_postSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_preunSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f mak/SDKMakefile \
            PEGASUS_RPM_SPEC_FILE_PATH=$(PEGASUS_RPM_SPEC_FILE_PATH) \
            _append_preunSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.ReleaseTest \
            PEGASUS_RPM_SPEC_FILE_PATH=$(PEGASUS_RPM_SPEC_FILE_PATH) \
            _append_preunSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_postunSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release _append_filesSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f mak/SDKMakefile \
            PEGASUS_RPM_SPEC_FILE_PATH=$(PEGASUS_RPM_SPEC_FILE_PATH) \
            _append_filesSectionToSpecFile
	@$(MAKE) --directory=$(ROOT) -f Makefile.ReleaseTest \
            PEGASUS_RPM_SPEC_FILE_PATH=$(PEGASUS_RPM_SPEC_FILE_PATH) \
            _append_filesSectionToSpecFile

_append_OpenPegasusLicenseToSpecFile: FORCE
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-header.spec >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "#" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "# WARNING: This file is automatically generated by executing" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "#   make -f pegasus/Makefile.Release create_OpenPegasusRPMSpecFile" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "# Any changes made directly to this file in the OpenPegasus source will" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "# be lost the next time this file is regenerated and submitted to CVS." >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "#" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_PreambleToSpecFile: FORCE
	@$(ECHO-E) "%define Flavor  $(PEGASUS_FLAVOR)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%define packageVersion $(PEGASUS_PACKAGE_VERSION)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "Version: $(PEGASUS_PRODUCT_VERSION)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "Release:"\
            "%{packageVersion}%{?LINUX_VERSION:.%{LINUX_VERSION}}" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "Epoch:   1" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-intro.spec \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-buildRequires.spec \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
ifdef PEGASUS_USE_NET_SNMP
	@$(ECHO-E) "BuildRequires:      net-snmp-devel" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
endif
	@$(ECHO-E) "#" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "# End of section " \
            "pegasus/rpm/tog-specfiles/tog-pegasus-buildRequires.spec" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-requires.spec \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
ifdef PEGASUS_USE_NET_SNMP
	@$(ECHO-E) "Requires:           net-snmp" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
endif
	@$(ECHO-E) "#" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "# End of section " \
            "pegasus/rpm/tog-specfiles/tog-pegasus-requires.spec" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-desc.spec \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-arch.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-arch-for-32bit-provider-support.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_ARCH_LIB %{_lib}" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global OPENSSL_HOME $(OPENSSL_HOME)" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global OPENSSL_BIN $(OPENSSL_BIN)" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_PEM_DIR $(PEGASUS_PEM_DIR)" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_SSL_CERT_FILE $(PEGASUS_SSL_CERT_FILE)" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_SSL_KEY_FILE $(PEGASUS_SSL_KEY_FILE)" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_SSL_TRUSTSTORE $(PEGASUS_SSL_TRUSTSTORE)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PAM_CONFIG_DIR /etc/pam.d" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_CONFIG_DIR $(PEGASUS_CONFIG_DIR)" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_VARDATA_DIR $(PEGASUS_VARDATA_DIR)" >> \
            $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) \
            "%global PEGASUS_VARDATA_CACHE_DIR $(PEGASUS_VARDATA_CACHE_DIR)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_LOCAL_DOMAIN_SOCKET_PATH " \
             "$(PEGASUS_LOCAL_DOMAIN_SOCKET_PATH)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_CIMSERVER_START_FILE" \
             "$(PEGASUS_CIMSERVER_START_FILE)"  \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_TRACE_FILE_PATH" \
             "$(PEGASUS_TRACE_FILE_PATH)"  \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_CIMSERVER_START_LOCK_FILE" \
             "$(PEGASUS_CIMSERVER_START_LOCK_FILE)"  \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_REPOSITORY_DIR $(PEGASUS_REPOSITORY_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_PREV_REPOSITORY_DIR_NAME" \
             "$(PEGASUS_PREV_REPOSITORY_DIR_NAME)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_REPOSITORY_PARENT_DIR" \
             "$(PEGASUS_REPOSITORY_PARENT_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_PREV_REPOSITORY_DIR" \
             "$(PEGASUS_PREV_REPOSITORY_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_SBIN_DIR $(PEGASUS_SBIN_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_DOC_DIR $(PEGASUS_DOC_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_RPM_ROOT "\
             "\044RPM_BUILD_DIR/\044RPM_PACKAGE_NAME-\044RPM_PACKAGE_VERSION"\
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) \
             "%global PEGASUS_RPM_HOME %PEGASUS_RPM_ROOT/build"\
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%global PEGASUS_INSTALL_LOG $(PEGASUS_LOG_DIR)/install.log"\
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_PackagesToSpecFile: FORCE
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-packages.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_prepSectionToSpecFile: FORCE
	@$(ECHO-E) "%prep" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%setup -q -n %{name}-%{version}" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_buildSectionToSpecFile: FORCE
	@$(ECHO-E) "%build" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-build.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_installSectionToSpecFile: FORCE
	@$(ECHO-E) "%install" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-install.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_cleanSectionToSpecFile: FORCE
	@$(ECHO-E) "%clean" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-clean.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_preSectionToSpecFile: FORCE
	@$(ECHO-E) "%pre" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-pre.spec \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
ifeq ($(PEGASUS_ENABLE_PRIVILEGE_SEPARATION),true)
	@$(ECHO-E) "# When Privilege Separation is enabled, create the" \
            "'$(CIMSERVERMAIN_USR)' user and">> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "# '$(CIMSERVERMAIN_GRP)' group which are used" \
            "as the context of the cimservermain process" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "if [ \044\061 -gt 0 ]; then" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "    /usr/sbin/groupadd $(CIMSERVERMAIN_GRP) > /dev/null" \
            "2>&1 || :;" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "    /usr/sbin/useradd -c \"$(PEGASUS_FLAVOR)-pegasus OpenPegasus"\
            "WBEM/CIM services\" \\" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "        -g $(CIMSERVERMAIN_GRP) -s /sbin/nologin -r -d" \
            "%PEGASUS_VARDATA_DIR $(CIMSERVERMAIN_USR) \\" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "        > /dev/null 2>&1 || :;" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
endif

_append_postSectionToSpecFile: FORCE
	@$(ECHO-E) "%post" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "if [ \044\061 -eq 1 ]; then" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release \
            _append_postSectionToSpecFile_createLog
	@$(MAKE) --directory=$(ROOT) -f Makefile.Release \
            _append_postSectionToSpecFile_createSymbolicLinks
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-post.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "elif [ \044\061 -gt 1 ]; then" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   # Check if the cimserver is running" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   isRunning=\`ps -el | grep cimserver | grep -v" \
            "\"grep cimserver\"\`" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   if [ \"\044isRunning\" ]; then" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "       /etc/init.d/$(PEGASUS_FLAVOR)-pegasus stop" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   if [ -d %PEGASUS_PREV_REPOSITORY_DIR ]; then" \
                   >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "       # The old repository was moved to" \
                   "/var/lib/Pegasus/prev_repository. It should now be" \
                   "upgraded to the new repository /var/lib/Pegasus/repository." \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "       %PEGASUS_SBIN_DIR/repupgrade >> %PEGASUS_INSTALL_LOG 2>&1" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
ifeq ($(PEGASUS_ENABLE_PRIVILEGE_SEPARATION),true)
	@$(ECHO-E) "       chown -R $(CIMSERVERMAIN_USR) %PEGASUS_REPOSITORY_DIR" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "       chgrp -R $(CIMSERVERMAIN_GRP) %PEGASUS_REPOSITORY_DIR" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
endif
	@$(ECHO-E) "   fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
ifeq ($(PEGASUS_ENABLE_PRIVILEGE_SEPARATION),true)
	@$(ECHO-E) "   if [ -f %PEGASUS_TRACE_FILE_PATH ]; then" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "     /bin/mv %PEGASUS_TRACE_FILE_PATH" \
         "%PEGASUS_TRACE_FILE_PATH-\`date '+%Y-%m-%d-%R'\`" \
	    >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
endif
	@$(ECHO-E) "   if [ \"\044isRunning\" ]; then" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "       /etc/init.d/$(PEGASUS_FLAVOR)-pegasus start" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_postSectionToSpecFile_createSymbolicLinks: FORCE
	@$(ECHO-E) "   # Create Symbolic Links for SDK Libraries" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   #" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(foreach i, $(PEGASUS_LIBRARY_LINKS), \
            $(ECHO-E) "   ln -sf $(i)$(LIB_SUFFIX)\
            $(PEGASUS_DEST_LIB_DIR_2)/$(i)$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH);)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   # Create Symbolic Links for Packaged Provider Libraries"\
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   #" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(foreach i, $(PEGASUS_PROVIDERS), $(ECHO-E) \
            "   ln -sf $(i)$(LIB_SUFFIX)\
            $(PEGASUS_PROVIDER_LIB_DIR_2)/$(i)$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH);)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   # Create Symbolic Links for Packaged Provider Managers"\
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   #" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(foreach i, $(PEGASUS_PROVIDER_MANAGERS), $(ECHO-E) \
            "   ln -sf $(i)$(LIB_SUFFIX)\
            $(PEGASUS_PROVIDER_MANAGER_LIB_DIR_2)/$(i)$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH);)
	@$(ECHO-E) "   # Create Symbolic Links for SLP library and SLP Provider" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   #" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) " %if %{EXTERNAL_SLP_REQUESTED}" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   ln -sf    libpegslp_client$(LIB_SUFFIX)\
            $(PEGASUS_DEST_LIB_DIR_2)/libpegslp_client$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   ln -sf    libSLPProvider$(LIB_SUFFIX)\
            $(PEGASUS_PROVIDER_LIB_DIR_2)/libSLPProvider$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) " %endif " >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_postSectionToSpecFile_createLog: FORCE
	@$(ECHO-E) "   echo \`date\` > %PEGASUS_INSTALL_LOG 2>&1" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   %define PEGASUS_CONFIG_DIR $(PEGASUS_CONFIG_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   %define PEGASUS_PEM_DIR $(PEGASUS_PEM_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   %define PEGASUS_SSL_CERT_FILE $(PEGASUS_SSL_CERT_FILE)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   %define PEGASUS_SSL_KEY_FILE $(PEGASUS_SSL_KEY_FILE)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) \
             "   %define PEGASUS_SSL_TRUSTSTORE $(PEGASUS_SSL_TRUSTSTORE)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "" >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_preunSectionToSpecFile: FORCE
	@$(ECHO-E) "%preun" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-preun.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)

_append_postunSectionToSpecFile: FORCE
	@$(ECHO-E) "%postun" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "if [ \044\061 -eq 0 ]; then" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "   export LC_ALL=C">> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "fi"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(CAT) $(ROOT)/rpm/tog-specfiles/tog-pegasus-postun.spec \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
ifeq ($(PEGASUS_ENABLE_PRIVILEGE_SEPARATION),true)
	@$(ECHO-E) "# When Privilege Separation is enabled, delete the" \
            "'$(CIMSERVERMAIN_USR)' user and">> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "# '$(CIMSERVERMAIN_GRP)' group which are used" \
            "as the context of the cimservermain process" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "if [ \044\061 -eq 0 ]; then" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "    /usr/sbin/userdel $(CIMSERVERMAIN_USR) > /dev/null" \
            "2>&1 || :;" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "    /usr/sbin/groupdel $(CIMSERVERMAIN_GRP) > /dev/null" \
            "2>&1 || :;" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "fi"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
endif

# %defattr(file permissions, owner, group, directory permissions)
# The %ghost directive instructs RPM not to install the specified file(s).
#     They will be owned by that package and removed if they exists when
#     the package is removed. This can be useful for things like log files
#     and state files.

_append_filesSectionToSpecFile: FORCE
	@$(ECHO-E) "%files" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%defattr($(Prw_______),$(CIMSERVERMAIN_USR),$(CIMSERVERMAIN_GRP),$(Prwx______))" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "$(PEGASUS_REPOSITORY_DIR)" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%defattr($(Prw_r__r__),$(INSTALL_USR),$(INSTALL_GRP),$(Prwxr_xr_x))"\
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "$(PEGASUS_MOF_DIR)" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%defattr($(Prw_______),$(INSTALL_USR),$(INSTALL_GRP),$(Prwxr_xr_x))" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(foreach i, $(PEGASUS_SPECIFIC_DIRECTORIES), \
             if [ $(i) != $(PEGASUS_LOCAL_DOMAIN_SOCKET_DIR) ]; then \
             if [ $(i) != $(PEGASUS_REPOSITORY_DIR) ]; then \
             if [ $(i) != $(PEGASUS_TRACE_DIR) ]; then \
             if [ $(i) != $(PEGASUS_CONFIG_DIR) ]; then \
             if [ $(i) != $(PEGASUS_VARRUN_DIR) ]; then \
             if [ $(i) != $(PEGASUS_MOF_DIR) ]; then \
                   $(ECHO-E) "%dir $(i)" >> \
             $(PEGASUS_RPM_SPEC_FILE_PATH); fi; fi; fi; fi; fi;fi;)
	@$(ECHO-E) "%dir $(PEGASUS_PROVIDER_DIR_2)" \
              >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir $(PEGASUS_PROVIDER_LIB_DIR_2)" \
              >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir $(PEGASUS_PROVIDER_MANAGER_LIB_DIR_2)" \
              >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir %attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))"\
              "$(PEGASUS_CONFIG_DIR)" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir" \
              "%attr($(Prwxr_xr_x),$(CIMSERVERMAIN_USR),$(CIMSERVERMAIN_GRP))"\
              "$(PEGASUS_VARRUN_DIR)" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir %attr(1755,$(CIMSERVERMAIN_USR),$(CIMSERVERMAIN_GRP))"\
             "$(PEGASUS_LOCAL_DOMAIN_SOCKET_DIR)" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir %attr($(Prwxrwxrwt),$(CIMSERVERMAIN_USR),$(CIMSERVERMAIN_GRP))" \
             "$(PEGASUS_TRACE_DIR)" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%config %attr($(Prwxr_x___),$(INSTALL_USR),$(INSTALL_GRP))"\
            "/etc/init.d/$(PEGASUS_FLAVOR)-pegasus" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%config(noreplace)" \
            "%attr($(Prw_r__r__),$(CIMSERVER_USR),$(CIMSERVER_GRP))" \
            "$(PEGASUS_CONFIG_DIR)/$(PEGASUS_PLANNED_CONFIG_FILE)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%config(noreplace) $(PEGASUS_CONFIG_DIR)/access.conf" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%config(noreplace) $(PAM_CONFIG_DIR)/$(PAM_CONFIG_FILE)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%ghost %config(noreplace)" \
            "$(PEGASUS_CONFIG_DIR)/ssl.cnf" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%ghost %config(noreplace)" \
            "$(PEGASUS_PEM_DIR)/$(PEGASUS_SSL_TRUSTSTORE)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%ghost %config(noreplace)" \
            "$(PEGASUS_PEM_DIR)/$(PEGASUS_SSL_CERT_FILE)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%ghost %config(noreplace)" \
           "$(PEGASUS_PEM_DIR)/$(PEGASUS_SSL_KEY_FILE)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%ghost $(PEGASUS_INSTALL_LOG)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "$(PEGASUS_SBIN_DIR)/*" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "$(PEGASUS_BIN_DIR)/*" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "$(PEGASUS_DEST_LIB_DIR_2)/*$(LIB_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%if %{JMPI_PROVIDER_REQUESTED}"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "$(PEGASUS_DEST_LIB_DIR_2)/*$(JAR_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "$(PEGASUS_DEST_LIB_DIR_2)/libJMPIProviderManager$(LIB_LINK_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%endif"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "$(PEGASUS_PROVIDER_LIB_DIR_2)/*$(LIB_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "$(PEGASUS_PROVIDER_MANAGER_LIB_DIR_2)/*$(LIB_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%if %{PEGASUS_32BIT_PROVIDER_SUPPORT}"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir /usr/lib/Pegasus" \
              >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir /usr/lib/Pegasus/providers" \
              >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%dir /usr/lib/Pegasus/providerManagers" \
              >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "/usr/lib/*$(LIB_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_xr_x),$(INSTALL_USR),$(INSTALL_GRP))" \
           "/usr/lib/Pegasus/providerManagers/*$(LIB_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "/usr/lib/libpegclient.so"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "/usr/lib/libpegcommon.so"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "/usr/lib/libpegprovider.so"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "/usr/lib/libDefaultProviderManager.so" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "/usr/lib/Pegasus/providerManagers/libCMPIProviderManager.so" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%endif"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prwxr_x___),$(INSTALL_USR),$(INSTALL_GRP))" \
           "$(PEGASUS_SCRIPT_DIR)/*" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prw_r__r__),$(INSTALL_USR),$(INSTALL_GRP))" \
	   "$(PEGASUS_MANUSER_DIR)/*" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%attr($(Prw_r__r__),$(INSTALL_USR),$(INSTALL_GRP))" \
	   "$(PEGASUS_MANADMIN_DIR)/*" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(foreach i, $(PEGASUS_DOC_FILES), \
            $(ECHO-E) "%doc %attr($(Pr__r__r__),$(INSTALL_USR),$(INSTALL_GRP))"\
            "$(PEGASUS_DOC_DIR)/$(i)" >> $(PEGASUS_RPM_SPEC_FILE_PATH);)
	@$(ECHO-E) "%doc %attr($(Pr__r__r__),$(INSTALL_USR),$(INSTALL_GRP))" \
	   "$(PEGASUS_DOC_DIR)/OpenPegasusNOTICE.txt" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(foreach i, $(PEGASUS_LIBRARY_LINKS), \
            $(ECHO-E) "$(PEGASUS_DEST_LIB_DIR_2)/$(i)$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH);)
	@$(foreach i, $(PEGASUS_PROVIDERS), \
            $(ECHO-E) "$(PEGASUS_PROVIDER_LIB_DIR_2)/$(i)$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH);)
	@$(ECHO-E) " %if %{EXTERNAL_SLP_REQUESTED}"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "$(PEGASUS_DEST_LIB_DIR_2)/libpegslp_client$(LIB_LINK_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "$(PEGASUS_PROVIDER_LIB_DIR_2)/libSLPProvider$(LIB_LINK_SUFFIX)" \
           >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(ECHO-E) "%endif"  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
	@$(foreach i, $(PEGASUS_PROVIDER_MANAGERS), \
            $(ECHO-E) "$(PEGASUS_PROVIDER_MANAGER_LIB_DIR_2)/$(i)$(LIB_LINK_SUFFIX)" \
            >> $(PEGASUS_RPM_SPEC_FILE_PATH);)
	@$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)

include $(ROOT)/mak/commands.mak
