1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22# Builds the complextoolbarcontrols C++ component example of the SDK. 23 24PRJ=../../.. 25SETTINGS=$(PRJ)/settings 26 27include $(SETTINGS)/settings.mk 28include $(SETTINGS)/std.mk 29include $(SETTINGS)/dk.mk 30include $(SETTINGS)/platform.mk 31 32# Define non-platform/compiler specific settings 33COMP_NAME=complextoolbarcontrols 34COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) 35OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME) 36OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME) 37OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) 38COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) 39COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") 40COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml 41COMP_UNOPKG_DESCRIPTION = $(OUT_COMP_GEN)/$(COMPONENT_NAME)/description.xml 42COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map 43COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components 44COMP_REGISTERFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_register_component.flag 45COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag 46 47CXXFILES = \ 48 MyProtocolHandler.cxx \ 49 ListenerHelper.cxx \ 50 exports.cxx 51 52SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES)) 53 54# Targets 55.PHONY: ALL 56ALL : \ 57 Example 58 59include $(SETTINGS)/stdtarget.mk 60 61$(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) 62 -$(MKDIR) $(subst /,$(PS),$(@D)) 63 $(CC) $(CC_FLAGS) $(STL_INCLUDES) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< 64 65 66#$(COMP_MAPFILE) : $(SLOFILES) 67# -$(MKDIR) $(subst /,$(PS),$(@D)) 68# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) 69#ifeq "$(OS)" "MACOSX" 70# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) 71#endif 72 73ifeq "$(OS)" "WIN" 74$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) 75 -$(MKDIR) $(subst /,$(PS),$(@D)) 76 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)) 77 $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \ 78 /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \ 79 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcrt.lib msvcprt.lib kernel32.lib 80 $(LINK_MANIFEST) 81else 82#$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) 83$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) 84 -$(MKDIR) $(subst /,$(PS),$(@D)) 85 $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ 86 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) 87ifeq "$(OS)" "MACOSX" 88 $(INSTALL_NAME_URELIBS) $@ 89endif 90endif 91 92# rule for extension description.xml 93$(COMP_UNOPKG_DESCRIPTION) : description.xml 94 -$(MKDIR) $(subst /,$(PS),$(@D)) 95 $(SDK_CAT) $< | $(SDK_SED) -e "s/#EXTENSION_PLATFORM#/$(EXTENSION_PLATFORM)/" > $@ 96 97# rule for component package manifest 98$(OUT_COMP_GEN)/%/manifest.xml : 99 -$(MKDIR) $(subst /,$(PS),$(@D)) 100 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ 101 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@ 102 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@ 103 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 104 @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@ 105 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 106 @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@ 107 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ 108 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ 109 110# @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ 111# @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ 112 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ 113 114$(COMP_COMPONENTS) : 115 -$(MKDIR) $(subst /,$(PS),$(@D)) 116 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ 117 @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ 118 @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ 119 @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)vnd.demo.Impl.ProtocolHandler$(QM)"$(CSEP) >> $@ 120 @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)vnd.demo.ProtocolHandler$(QM)"/$(CSEP) >> $@ 121 @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ 122 @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ 123 @echo $(OSEP)/components$(CSEP) >> $@ 124 125# rule for component package file 126$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) $(COMP_UNOPKG_DESCRIPTION) 127 -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 128 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) 129 $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) 130 cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_NAME).components description.xml 131 cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) 132 $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu logo_small.png logo_big.png 133 cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml 134 135$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) 136ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" 137 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 138 $(DEPLOYTOOL) $(COMP_PACKAGE_URL) 139 @echo flagged > $(subst /,$(PS),$@) 140else 141 @echo -------------------------------------------------------------------------------- 142 @echo If you want to install your component automatically, please set the environment 143 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only 144 @echo possible if no office instance is running. 145 @echo -------------------------------------------------------------------------------- 146endif 147 148Example : $(COMP_REGISTERFLAG) 149 @echo -------------------------------------------------------------------------------- 150 @echo The "$(QM)Complext Toolbar Controls$(QM)" component was installed if SDK_AUTO_DEPLOYMENT = YES. 151 @echo You can use this component inside your office installation, see the example 152 @echo description. 153 @echo -------------------------------------------------------------------------------- 154 155run: $(COMP1_COMP_REGISTERFLAG) 156 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" -writer 157 158 159.PHONY: clean 160clean : 161 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC)) 162 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) 163 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) 164 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) 165 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_REGISTERFLAG))) 166 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG))) 167 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) 168