1abfe7a5aSAriel Constenla-Haile#************************************************************** 2*b591cb74SAriel Constenla-Haile# 3abfe7a5aSAriel Constenla-Haile# Licensed to the Apache Software Foundation (ASF) under one 4abfe7a5aSAriel Constenla-Haile# or more contributor license agreements. See the NOTICE file 5abfe7a5aSAriel Constenla-Haile# distributed with this work for additional information 6abfe7a5aSAriel Constenla-Haile# regarding copyright ownership. The ASF licenses this file 7abfe7a5aSAriel Constenla-Haile# to you under the Apache License, Version 2.0 (the 8abfe7a5aSAriel Constenla-Haile# "License"); you may not use this file except in compliance 9abfe7a5aSAriel Constenla-Haile# with the License. You may obtain a copy of the License at 10*b591cb74SAriel Constenla-Haile# 11abfe7a5aSAriel Constenla-Haile# http://www.apache.org/licenses/LICENSE-2.0 12*b591cb74SAriel Constenla-Haile# 13abfe7a5aSAriel Constenla-Haile# Unless required by applicable law or agreed to in writing, 14abfe7a5aSAriel Constenla-Haile# software distributed under the License is distributed on an 15abfe7a5aSAriel Constenla-Haile# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16abfe7a5aSAriel Constenla-Haile# KIND, either express or implied. See the License for the 17abfe7a5aSAriel Constenla-Haile# specific language governing permissions and limitations 18abfe7a5aSAriel Constenla-Haile# under the License. 19*b591cb74SAriel Constenla-Haile# 20abfe7a5aSAriel Constenla-Haile#************************************************************** 21abfe7a5aSAriel Constenla-Haile 22abfe7a5aSAriel Constenla-Haile# Builds the custom-tool-panel C++ component example of the SDK. 23abfe7a5aSAriel Constenla-Haile 24abfe7a5aSAriel Constenla-HailePRJ=../../.. 25abfe7a5aSAriel Constenla-HaileSETTINGS=$(PRJ)/settings 26abfe7a5aSAriel Constenla-Haile 27abfe7a5aSAriel Constenla-Haileinclude $(SETTINGS)/settings.mk 28abfe7a5aSAriel Constenla-Haileinclude $(SETTINGS)/std.mk 29abfe7a5aSAriel Constenla-Haileinclude $(SETTINGS)/dk.mk 30abfe7a5aSAriel Constenla-Haile 31abfe7a5aSAriel Constenla-Haile# Define non-platform/compiler specific settings 32abfe7a5aSAriel Constenla-HaileCOMP_NAME=custom-tool-panel 33abfe7a5aSAriel Constenla-HaileCOMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) 34abfe7a5aSAriel Constenla-HaileOUT_COMP_INC=$(OUT_INC)/$(COMP_NAME) 35abfe7a5aSAriel Constenla-HaileOUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME) 36abfe7a5aSAriel Constenla-HaileOUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) 37abfe7a5aSAriel Constenla-HaileCOMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) 38abfe7a5aSAriel Constenla-HaileCOMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") 39abfe7a5aSAriel Constenla-HaileCOMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml 40abfe7a5aSAriel Constenla-HaileCOMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map 41abfe7a5aSAriel Constenla-HaileCOMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components 42abfe7a5aSAriel Constenla-HaileCOMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag 43abfe7a5aSAriel Constenla-Haile 44abfe7a5aSAriel Constenla-Haile# Allow deploying the extension when running it 45abfe7a5aSAriel Constenla-Haile 46abfe7a5aSAriel Constenla-Haile#this should be in odk/settings/std.mk 47abfe7a5aSAriel Constenla-HaileOUT_DEPLOY=$(OUT)/deploy 48abfe7a5aSAriel Constenla-Haile 49abfe7a5aSAriel Constenla-HaileOUT_COMP_DEPLOY=$(OUT_DEPLOY)/$(COMP_NAME) 50abfe7a5aSAriel Constenla-HaileOUT_DEPLOY_DIR=$(subst /,$(PS),$(OUT_COMP_DEPLOY)) 51*b591cb74SAriel Constenla-HaileOUT_DEPLOY_URL=$(URLPREFIX)$(OUT_COMP_DEPLOY) 52abfe7a5aSAriel Constenla-HaileENV_USER_INSTALL=-env:"UserInstallation=$(OUT_DEPLOY_URL)" 53abfe7a5aSAriel Constenla-HaileOFFICE_START_OPTIONS=-nologo -nofirststartwizard -norestore -writer 54abfe7a5aSAriel Constenla-HaileOXT_DEPLOYEDFLAG=$(OUT_MISC)/cpp_$(COMP_NAME)_deployed_oxt.flag 55abfe7a5aSAriel Constenla-Haile 56abfe7a5aSAriel Constenla-HaileCXXFILES = \ 57abfe7a5aSAriel Constenla-Haile ctp_factory.cxx \ 58abfe7a5aSAriel Constenla-Haile ctp_panel.cxx \ 59abfe7a5aSAriel Constenla-Haile ctp_services.cxx 60abfe7a5aSAriel Constenla-Haile 61abfe7a5aSAriel Constenla-HaileSLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES)) 62abfe7a5aSAriel Constenla-Haile 63abfe7a5aSAriel Constenla-Haile# Add OSL_DEBUG_LEVEL to compiler the flags (for OSL_TRACE et. al.) 64abfe7a5aSAriel Constenla-Haileifeq "$(DEBUG)" "yes" 65abfe7a5aSAriel Constenla-HaileCC_FLAGS += -DOSL_DEBUG_LEVEL=2 66abfe7a5aSAriel Constenla-Haileendif 67abfe7a5aSAriel Constenla-Haile 68abfe7a5aSAriel Constenla-Haile# Targets 69abfe7a5aSAriel Constenla-Haile.PHONY: ALL 70abfe7a5aSAriel Constenla-HaileALL : \ 71abfe7a5aSAriel Constenla-Haile CustomToolPanelExample 72abfe7a5aSAriel Constenla-Haile 73abfe7a5aSAriel Constenla-Haileinclude $(SETTINGS)/stdtarget.mk 74abfe7a5aSAriel Constenla-Haile 75abfe7a5aSAriel Constenla-Haile$(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) 76abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(@D)) 77abfe7a5aSAriel Constenla-Haile $(CC) $(CC_FLAGS) $(STL_INCLUDES) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< 78abfe7a5aSAriel Constenla-Haile 79abfe7a5aSAriel Constenla-Haile 80abfe7a5aSAriel Constenla-Haile#$(COMP_MAPFILE) : $(SLOFILES) 81abfe7a5aSAriel Constenla-Haile# -$(MKDIR) $(subst /,$(PS),$(@D)) 82abfe7a5aSAriel Constenla-Haile# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) 83abfe7a5aSAriel Constenla-Haile#ifeq "$(OS)" "MACOSX" 84abfe7a5aSAriel Constenla-Haile# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) 85abfe7a5aSAriel Constenla-Haile#endif 86abfe7a5aSAriel Constenla-Haile 87abfe7a5aSAriel Constenla-Haileifeq "$(OS)" "WIN" 88abfe7a5aSAriel Constenla-Haile$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) 89abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(@D)) 90abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)) 91abfe7a5aSAriel Constenla-Haile $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \ 92abfe7a5aSAriel Constenla-Haile /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \ 93abfe7a5aSAriel Constenla-Haile $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) msvcrt.lib kernel32.lib 94abfe7a5aSAriel Constenla-Haile $(LINK_MANIFEST) 95abfe7a5aSAriel Constenla-Haileelse 96abfe7a5aSAriel Constenla-Haile#$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) 97abfe7a5aSAriel Constenla-Haile$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) 98abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(@D)) 99abfe7a5aSAriel Constenla-Haile $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ 100abfe7a5aSAriel Constenla-Haile $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) 101abfe7a5aSAriel Constenla-Haileifeq "$(OS)" "MACOSX" 102abfe7a5aSAriel Constenla-Haile $(INSTALL_NAME_URELIBS) $@ 103abfe7a5aSAriel Constenla-Haileendif 104abfe7a5aSAriel Constenla-Haileendif 105abfe7a5aSAriel Constenla-Haile 106abfe7a5aSAriel Constenla-Haile# rule for component package manifest 107abfe7a5aSAriel Constenla-Haile$(OUT_COMP_GEN)/%/manifest.xml : 108abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(@D)) 109abfe7a5aSAriel Constenla-Haile @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ 110abfe7a5aSAriel Constenla-Haile @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@ 111abfe7a5aSAriel Constenla-Haile @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@ 112abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:meda-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 113abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)manifest:full-path="$(QM)CalcWindowState.xcu$(QM)"/$(CSEP) >> $@ 114abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 115abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)manifest:full-path="$(QM)DrawWindowState.xcu$(QM)"/$(CSEP) >> $@ 116abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 117abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)manifest:full-path="$(QM)ImpressWindowState.xcu$(QM)"/$(CSEP) >> $@ 118abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 119abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)manifest:full-path="$(QM)WriterWindowState.xcu$(QM)"/$(CSEP) >> $@ 120abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 121abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)manifest:full-path="$(QM)Factories.xcu$(QM)"/$(CSEP) >> $@ 122abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ 123abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ 124abfe7a5aSAriel Constenla-Haile @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ 125abfe7a5aSAriel Constenla-Haile 126abfe7a5aSAriel Constenla-Haile$(COMP_COMPONENTS) : 127abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(@D)) 128abfe7a5aSAriel Constenla-Haile @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ 129abfe7a5aSAriel Constenla-Haile @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ 130abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ 131abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)org.openoffice.comp.example.custompanel.ToolPanelFactory$(QM)"$(CSEP) >> $@ 132abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)org.openoffice.example.colorpanel.ToolPanelFactory$(QM)"/$(CSEP) >> $@ 133abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ 134abfe7a5aSAriel Constenla-Haile @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ 135abfe7a5aSAriel Constenla-Haile @echo $(OSEP)/components$(CSEP) >> $@ 136abfe7a5aSAriel Constenla-Haile 137abfe7a5aSAriel Constenla-Haile# rule for component package file 138abfe7a5aSAriel Constenla-Haile$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) WriterWindowState.xcu CalcWindowState.xcu DrawWindowState.xcu ImpressWindowState.xcu Factories.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) 139abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 140abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) 141abfe7a5aSAriel Constenla-Haile $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) 142abfe7a5aSAriel Constenla-Haile cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_NAME).components 143abfe7a5aSAriel Constenla-Haile cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) 144abfe7a5aSAriel Constenla-Haile $(SDK_ZIP) -u $@ WriterWindowState.xcu CalcWindowState.xcu DrawWindowState.xcu ImpressWindowState.xcu Factories.xcu panel.png 145abfe7a5aSAriel Constenla-Haile cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml 146abfe7a5aSAriel Constenla-Haile 147abfe7a5aSAriel Constenla-HaileCustomToolPanelExample : $(COMP_PACKAGE) 148abfe7a5aSAriel Constenla-Haile @echo -------------------------------------------------------------------------------- 149abfe7a5aSAriel Constenla-Haile @echo Please use the following command to deploy the example! 150abfe7a5aSAriel Constenla-Haile @echo - 151abfe7a5aSAriel Constenla-Haile @echo $(MAKE) CustomToolPanelExample.run 152abfe7a5aSAriel Constenla-Haile @echo - 153abfe7a5aSAriel Constenla-Haile @echo -------------------------------------------------------------------------------- 154abfe7a5aSAriel Constenla-Haile 155abfe7a5aSAriel Constenla-HaileCustomToolPanelExample.run: $(OXT_DEPLOYEDFLAG) 156abfe7a5aSAriel Constenla-Haile "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(OFFICE_START_OPTIONS) $(ENV_USER_INSTALL) 157abfe7a5aSAriel Constenla-Haile 158abfe7a5aSAriel Constenla-Haile$(OXT_DEPLOYEDFLAG) : $(COMP_PACKAGE) 159abfe7a5aSAriel Constenla-Haile -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 160abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(OUT_DEPLOY)) 161abfe7a5aSAriel Constenla-Haile -$(MKDIR) $(subst /,$(PS),$(OUT_DEPLOY_DIR)) 162abfe7a5aSAriel Constenla-Haile $(DEPLOYTOOL) $(COMP_PACKAGE_URL) $(ENV_USER_INSTALL) 163abfe7a5aSAriel Constenla-Haile @echo flagged > $(subst /,$(PS),$@) 164abfe7a5aSAriel Constenla-Haile 165abfe7a5aSAriel Constenla-Haile.PHONY: clean 166abfe7a5aSAriel Constenla-Haileclean : 167abfe7a5aSAriel Constenla-Haile -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC)) 168abfe7a5aSAriel Constenla-Haile -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) 169abfe7a5aSAriel Constenla-Haile -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) 170abfe7a5aSAriel Constenla-Haile -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_DEPLOY_DIR)) 171abfe7a5aSAriel Constenla-Haile -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) 172abfe7a5aSAriel Constenla-Haile -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG))) 173abfe7a5aSAriel Constenla-Haile -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OXT_DEPLOYEDFLAG))) 174abfe7a5aSAriel Constenla-Haile -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) 175