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