1*122c3632SJürgen Schmidt#************************************************************** 2*122c3632SJürgen Schmidt# 3*122c3632SJürgen Schmidt# Licensed to the Apache Software Foundation (ASF) under one 4*122c3632SJürgen Schmidt# or more contributor license agreements. See the NOTICE file 5*122c3632SJürgen Schmidt# distributed with this work for additional information 6*122c3632SJürgen Schmidt# regarding copyright ownership. The ASF licenses this file 7*122c3632SJürgen Schmidt# to you under the Apache License, Version 2.0 (the 8*122c3632SJürgen Schmidt# "License"); you may not use this file except in compliance 9*122c3632SJürgen Schmidt# with the License. You may obtain a copy of the License at 10*122c3632SJürgen Schmidt# 11*122c3632SJürgen Schmidt# http://www.apache.org/licenses/LICENSE-2.0 12*122c3632SJürgen Schmidt# 13*122c3632SJürgen Schmidt# Unless required by applicable law or agreed to in writing, 14*122c3632SJürgen Schmidt# software distributed under the License is distributed on an 15*122c3632SJürgen Schmidt# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*122c3632SJürgen Schmidt# KIND, either express or implied. See the License for the 17*122c3632SJürgen Schmidt# specific language governing permissions and limitations 18*122c3632SJürgen Schmidt# under the License. 19cdf0e10cSrcweir# 20*122c3632SJürgen Schmidt#************************************************************** 21cdf0e10cSrcweir 22cdf0e10cSrcweir# Builds the Java DocumentHandling examples of the SDK. 23cdf0e10cSrcweir 24cdf0e10cSrcweirPRJ=../../.. 25cdf0e10cSrcweirSETTINGS=$(PRJ)/settings 26cdf0e10cSrcweir 27cdf0e10cSrcweirinclude $(SETTINGS)/settings.mk 28cdf0e10cSrcweirinclude $(SETTINGS)/std.mk 29cdf0e10cSrcweirinclude $(SETTINGS)/dk.mk 30cdf0e10cSrcweir 31cdf0e10cSrcweir# Define non-platform/compiler specific settings 32cdf0e10cSrcweirSAMPLE_NAME=JavaDocumentHandlingExamples 33cdf0e10cSrcweirSAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME) 34cdf0e10cSrcweirSAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME) 35cdf0e10cSrcweir 36cdf0e10cSrcweirDIRFLAG=$(OUT_MISC)/$(SAMPLE_NAME)_directory.flag 37cdf0e10cSrcweir 38cdf0e10cSrcweirAPP1_NAME=DocumentConverter 39cdf0e10cSrcweirAPP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar 40cdf0e10cSrcweirAPP2_NAME=DocumentLoader 41cdf0e10cSrcweirAPP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar 42cdf0e10cSrcweirAPP3_NAME=DocumentPrinter 43cdf0e10cSrcweirAPP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar 44cdf0e10cSrcweirAPP4_NAME=DocumentSaver 45cdf0e10cSrcweirAPP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar 46cdf0e10cSrcweir 47cdf0e10cSrcweirSDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ 48cdf0e10cSrcweir $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)) 49cdf0e10cSrcweir 50cdf0e10cSrcweir 51cdf0e10cSrcweir# Targets 52cdf0e10cSrcweir.PHONY: ALL 53cdf0e10cSrcweirALL : \ 54cdf0e10cSrcweir $(SAMPLE_NAME) 55cdf0e10cSrcweir 56cdf0e10cSrcweirinclude $(SETTINGS)/stdtarget.mk 57cdf0e10cSrcweir 58cdf0e10cSrcweir$(SAMPLE_CLASS_OUT)/%.class : %.java 59cdf0e10cSrcweir -$(MKDIR) $(subst /,$(PS),$(@D)) 60cdf0e10cSrcweir $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $< 61cdf0e10cSrcweir 62cdf0e10cSrcweir$(SAMPLE_CLASS_OUT)/%.mf : 63cdf0e10cSrcweir -$(MKDIR) $(subst /,$(PS),$(@D)) 64cdf0e10cSrcweir @echo Main-Class: com.sun.star.lib.loader.Loader> $@ 65cdf0e10cSrcweir $(ECHOLINE)>> $@ 66cdf0e10cSrcweir @echo Name: com/sun/star/lib/loader/Loader.class>> $@ 67cdf0e10cSrcweir @echo Application-Class: $*>> $@ 68cdf0e10cSrcweir 69cdf0e10cSrcweir$(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class 70cdf0e10cSrcweir -$(MKDIR) $(subst /,$(PS),$(@D)) 71cdf0e10cSrcweir +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class 72cdf0e10cSrcweir +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 73cdf0e10cSrcweir 74cdf0e10cSrcweir$(APP1_JAR) : $(SAMPLE_CLASS_OUT)/$(APP1_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP1_NAME).class 75cdf0e10cSrcweir$(APP2_JAR) : $(SAMPLE_CLASS_OUT)/$(APP2_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP2_NAME).class 76cdf0e10cSrcweir$(APP3_JAR) : $(SAMPLE_CLASS_OUT)/$(APP3_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP3_NAME).class 77cdf0e10cSrcweir$(APP4_JAR) : $(SAMPLE_CLASS_OUT)/$(APP4_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP4_NAME).class 78cdf0e10cSrcweir 79cdf0e10cSrcweir$(SAMPLE_NAME) : $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) $(APP4_JAR) 80cdf0e10cSrcweir @echo -------------------------------------------------------------------------------- 81cdf0e10cSrcweir @echo The $(APP1_NAME) search the "$(QM)./test$(QM)" directory for documents, convert 82cdf0e10cSrcweir @echo them using using the "$(QM)MS Word 97$(QM)" filter and the extension "$(QM).doc$(QM)". 83cdf0e10cSrcweir @echo The converted files are store in "$(QM)$(SAMPLE_GEN_OUT)/converted_files$(QM)". 84cdf0e10cSrcweir @echo The list of possible filter names can change. Normally an updated list can be found 85cdf0e10cSrcweir @echo on "$(QM)http://www.openoffice.org/files/documents/25/111/filter_description.html$(QM)". 86cdf0e10cSrcweir @echo - 87cdf0e10cSrcweir @echo The $(APP2_NAME) loads the document "$(QM)./test/test1.odt$(QM)". 88cdf0e10cSrcweir @echo - 89cdf0e10cSrcweir @echo The $(APP3_NAME) prints the document "$(QM)./test/test1.odt$(QM)" using the 90cdf0e10cSrcweir @echo the specified printer. If the printer is unknown, the default printer is used. 91cdf0e10cSrcweir @echo - 92cdf0e10cSrcweir @echo The $(APP5_NAME) loads the document "$(QM)./test/test1.odt$(QM)" and saves it 93cdf0e10cSrcweir @echo under "$(QM)$(SAMPLE_GEN_OUT)/savetest/testsave.odt$(QM)". 94cdf0e10cSrcweir @echo - 95cdf0e10cSrcweir @echo Please use one of the following commands to execute the examples! 96cdf0e10cSrcweir @echo - 97cdf0e10cSrcweir @echo $(MAKE) $(APP1_NAME).run 98cdf0e10cSrcweir @echo $(MAKE) $(APP2_NAME).run 99cdf0e10cSrcweir @echo $(MAKE) $(APP3_NAME).run 100cdf0e10cSrcweir @echo $(MAKE) $(APP4_NAME).run 101cdf0e10cSrcweir @echo -------- 102cdf0e10cSrcweir @echo The examples need parameters. Please use one the following commands to 103cdf0e10cSrcweir @echo start the demo if you do not want the default parameters specified in the 104cdf0e10cSrcweir @echo this makefile. Starting without parameters print a command line help: 105cdf0e10cSrcweir @echo --- $(APP1_NAME) --- 106cdf0e10cSrcweir @echo java -jar $(APP1_NAME).jar "$(QM)directory$(QM)" "$(QM)filter name$(QM)" "$(QM)extension$(QM)" "$(QM)output_directory$(QM)" 107cdf0e10cSrcweir @echo --- $(APP2_NAME) --- 108cdf0e10cSrcweir @echo java -jar $(APP2_NAME).jar "$(QM)Url|path$(QM)" 109cdf0e10cSrcweir @echo --- $(APP3_NAME) --- 110cdf0e10cSrcweir @echo java -jar $(APP3_NAME).jar "$(QM)printername$(QM)" "$(QM)filename$(QM)" "$(QM)pages$(QM)" 111cdf0e10cSrcweir @echo --- $(APP4_NAME) --- 112cdf0e10cSrcweir @echo java -jar $(APP4_NAME).jar "$(QM)load Url|path$(QM)" "$(QM)save Url|path$(QM)" 113cdf0e10cSrcweir @echo -------------------------------------------------------------------------------- 114cdf0e10cSrcweir 115cdf0e10cSrcweir$(APP1_NAME).run: $(APP1_JAR) 116cdf0e10cSrcweir -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/converted_files) 117cdf0e10cSrcweir $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< "./test" "MS Word 97" "doc" "$(SAMPLE_GEN_OUT)/converted_files" 118cdf0e10cSrcweir 119cdf0e10cSrcweir$(APP2_NAME).run: $(APP2_JAR) 120cdf0e10cSrcweir $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< "./test/test1.odt" 121cdf0e10cSrcweir 122cdf0e10cSrcweir$(APP3_NAME).run: $(APP3_JAR) 123cdf0e10cSrcweir $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< "my_printer" "./test/test1.odt" 1 124cdf0e10cSrcweir 125cdf0e10cSrcweir$(APP4_NAME).run: $(APP4_JAR) 126cdf0e10cSrcweir -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/savetest) 127cdf0e10cSrcweir $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< "./test/test1.odt" "$(SAMPLE_GEN_OUT)/savetest/testsave.odt" 128cdf0e10cSrcweir 129cdf0e10cSrcweir.PHONY: clean 130cdf0e10cSrcweirclean : 131cdf0e10cSrcweir -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) 132cdf0e10cSrcweir -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT)) 133