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 C++ FlatXmlFilter component example of the Developers Guide. 23 24PRJ=../../../../.. 25SETTINGS=$(PRJ)/settings 26 27include $(SETTINGS)/settings.mk 28include $(SETTINGS)/std.mk 29include $(SETTINGS)/dk.mk 30 31# Define non-platform/compiler specific settings 32COMP_NAME=FlatXmlFilter_cpp 33COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) 34OUT_COMP_INC = $(OUT_INC)/$(COMP_NAME) 35OUT_COMP_GEN = $(OUT_MISC)/$(COMP_NAME) 36OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) 37COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) 38COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") 39COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml 40#COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map 41COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components 42 43COMP_REGISTERFLAG = $(OUT_MISC)/devguide_$(COMP_NAME)_register_component.flag 44 45CXXFILES = FlatXml.cxx 46 47SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES)) 48 49# Targets 50.PHONY: ALL 51ALL : \ 52 FlatXmlFilterCppExample 53 54include $(SETTINGS)/stdtarget.mk 55 56$(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) 57 -$(MKDIR) $(subst /,$(PS),$(@D)) 58 $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< 59 60#$(COMP_MAPFILE) : $(SLOFILES) 61# -$(MKDIR) $(subst /,$(PS),$(@D)) 62# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) 63#ifeq "$(OS)" "MACOSX" 64# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) 65#endif 66 67ifeq "$(OS)" "WIN" 68$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) 69 -$(MKDIR) $(subst /,$(PS),$(@D)) 70 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)) 71 $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \ 72 /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \ 73 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) msvcrt.lib kernel32.lib 74 $(LINK_MANIFEST) 75else 76$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) 77 -$(MKDIR) $(subst /,$(PS),$(@D)) 78 $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ 79 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) 80ifeq "$(OS)" "MACOSX" 81 $(INSTALL_NAME_URELIBS) $@ 82endif 83endif 84 85# rule for component package manifest 86$(OUT_COMP_GEN)/%/manifest.xml : 87 -$(MKDIR) $(subst /,$(PS),$(@D)) 88 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ 89 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@ 90 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@ 91 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 92 @echo $(SQM) $(SQM)manifest:full-path="$(QM)FlatXmlFilter_cpp.xcu$(QM)"/$(CSEP) >> $@ 93 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ 94 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ 95 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ 96 97$(COMP_COMPONENTS) : 98 -$(MKDIR) $(subst /,$(PS),$(@D)) 99 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ 100 @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ 101 @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ 102 @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)devguide.officedev.samples.filter.FlatXmlCpp$(QM)"$(CSEP) >> $@ 103 @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)devguide.officedev.samples.filter.FlatXmlCpp$(QM)"/$(CSEP) >> $@ 104 @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ 105 @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ 106 @echo $(OSEP)/components$(CSEP) >> $@ 107 108# rule for component package file 109$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) FlatXmlFilter_cpp.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) 110 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 111 -$(MKDIR) $(subst /,$(PS),$(@D)) 112 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) 113 $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) 114 $(SDK_ZIP) $@ FlatXmlFilter_cpp.xcu 115 cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_NAME).components 116 cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) 117 cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml 118 119$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) 120ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" 121 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 122 -$(MKDIR) $(subst /,$(PS),$(@D)) 123 $(DEPLOYTOOL) $(COMP_PACKAGE_URL) 124 @echo flagged > $(subst /,$(PS),$@) 125else 126 @echo -------------------------------------------------------------------------------- 127 @echo If you want to install your component automatically, please set the environment 128 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only 129 @echo possible if no office instance is running. 130 @echo -------------------------------------------------------------------------------- 131endif 132 133FlatXmlFilterCppExample : $(COMP_REGISTERFLAG) 134 @echo -------------------------------------------------------------------------------- 135 @echo The C++ FlatXmlFilter component is installed if SDK_AUTO_DEPLOYMENT = YES. 136 @echo You can use the filters "$(QM)DevGuide FlatXML ...$(QM)" inside your office installation 137 @echo after you have installed the "$(QM)FlatXmlTypeDetection.uno.pkg"$(QM) as well. 138 @echo -------------------------------------------------------------------------------- 139 140.PHONY: clean 141clean : 142 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC)) 143 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) 144 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) 145 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) 146 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_COMPONENTS))) 147 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_REGISTERFLAG))) 148 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG))) 149 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) 150