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