1 #*************************************************************************
3 # The Contents of this file are made available subject to the terms of
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. Neither the name of Sun Microsystems, Inc. nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #**************************************************************************
35 # Builds the Java DocumentHandling examples of the SDK.
38 SETTINGS
=$(PRJ
)/settings
40 include $(SETTINGS
)/settings.mk
41 include $(SETTINGS
)/std.mk
43 # Define non-platform/compiler specific settings
44 SAMPLE_NAME
=JavaDocumentHandlingExamples
45 SAMPLE_CLASS_OUT
= $(OUT_CLASS
)/$(SAMPLE_NAME
)
46 SAMPLE_GEN_OUT
= $(OUT_MISC
)/$(SAMPLE_NAME
)
48 DIRFLAG
=$(OUT_MISC
)/$(SAMPLE_NAME
)_directory.flag
50 APP1_NAME
=DocumentConverter
51 APP1_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).jar
52 APP2_NAME
=DocumentLoader
53 APP2_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).jar
54 APP3_NAME
=DocumentPrinter
55 APP3_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).jar
56 APP4_NAME
=DocumentSaver
57 APP4_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).jar
59 SDK_CLASSPATH
= $(subst $(EMPTYSTRING
) $(PATH_SEPARATOR
),$(PATH_SEPARATOR
),$(CLASSPATH
)\
60 $(PATH_SEPARATOR
)$(SAMPLE_CLASS_OUT
))
68 include $(SETTINGS
)/stdtarget.mk
70 $(SAMPLE_CLASS_OUT
)/%.class
: %.java
71 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
72 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(SAMPLE_CLASS_OUT
) $<
74 $(SAMPLE_CLASS_OUT
)/%.mf
:
75 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
76 @echo Main-Class
: com.sun.star.lib.loader.Loader
> $@
78 @echo Name
: com
/sun
/star
/lib
/loader
/Loader.class
>> $@
79 @echo Application-Class
: $*>> $@
81 $(SAMPLE_CLASS_OUT
)/%.jar
: $(SAMPLE_CLASS_OUT
)/%.mf
$(SAMPLE_CLASS_OUT
)/%.class
82 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
83 +cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) cvfm
$(@F
) $*.mf
$*.class
84 +$(SDK_JAR
) uvf
$@
$(SDK_JAVA_UNO_BOOTSTRAP_FILES
)
86 $(APP1_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).class
87 $(APP2_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).class
88 $(APP3_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).class
89 $(APP4_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).class
91 $(SAMPLE_NAME
) : $(APP1_JAR
) $(APP2_JAR
) $(APP3_JAR
) $(APP4_JAR
)
92 @echo
--------------------------------------------------------------------------------
93 @echo The
$(APP1_NAME
) search the
"$(QM)./test$(QM)" directory for documents
, convert
94 @echo them using the
"$(QM)MS Word 97$(QM)" filter and the extension
"$(QM).doc$(QM)".
95 @echo The converted files are store in
"$(QM)$(SAMPLE_GEN_OUT)/converted_files$(QM)".
96 @echo The list of possible
filter names can change. Normally an updated list can be found
97 @echo on
"$(QM)http://www.openoffice.org/files/documents/25/111/filter_description.html$(QM)".
99 @echo The
$(APP2_NAME
) loads the document
"$(QM)./test/test1.odt$(QM)".
101 @echo The
$(APP3_NAME
) prints the document
"$(QM)./test/test1.odt$(QM)" using the
102 @echo the specified printer. If the printer is unknown
, the default printer is used.
104 @echo The
$(APP5_NAME
) loads the document
"$(QM)./test/test1.odt$(QM)" and saves it
105 @echo under
"$(QM)$(SAMPLE_GEN_OUT)/savetest/testsave.odt$(QM)".
107 @echo Please use one of the following commands to execute the examples
!
109 @echo
$(MAKE
) $(APP1_NAME
).run
110 @echo
$(MAKE
) $(APP2_NAME
).run
111 @echo
$(MAKE
) $(APP3_NAME
).run
112 @echo
$(MAKE
) $(APP4_NAME
).run
114 @echo The examples need parameters. Please use one the following commands to
115 @echo start the demo if you do not want the default parameters specified in the
116 @echo this makefile. Starting without parameters
print a command line help
:
117 @echo
--- $(APP1_NAME
) ---
118 @echo java
-jar
$(APP1_NAME
).jar
"$(QM)directory$(QM)" "$(QM)filter name$(QM)" "$(QM)extension$(QM)" "$(QM)output_directory$(QM)"
119 @echo
--- $(APP2_NAME
) ---
120 @echo java
-jar
$(APP2_NAME
).jar
"$(QM)Url|path$(QM)"
121 @echo
--- $(APP3_NAME
) ---
122 @echo java
-jar
$(APP3_NAME
).jar
"$(QM)printername$(QM)" "$(QM)filename$(QM)" "$(QM)pages$(QM)"
123 @echo
--- $(APP4_NAME
) ---
124 @echo java
-jar
$(APP4_NAME
).jar
"$(QM)load Url|path$(QM)" "$(QM)save Url|path$(QM)"
125 @echo
--------------------------------------------------------------------------------
127 $(APP1_NAME
).run
: $(APP1_JAR
)
128 -$(MKDIR
) $(subst /,$(PS
),$(SAMPLE_GEN_OUT
)/converted_files
)
129 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$< "./test" "MS Word 97" "doc" "$(SAMPLE_GEN_OUT)/converted_files"
131 $(APP2_NAME
).run
: $(APP2_JAR
)
132 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$< "./test/test1.odt"
134 $(APP3_NAME
).run
: $(APP3_JAR
)
135 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$< "my_printer" "./test/test1.odt" 1
137 $(APP4_NAME
).run
: $(APP4_JAR
)
138 -$(MKDIR
) $(subst /,$(PS
),$(SAMPLE_GEN_OUT
)/savetest
)
139 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$< "./test/test1.odt" "$(SAMPLE_GEN_OUT)/savetest/testsave.odt"
143 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_CLASS_OUT
))
144 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_GEN_OUT
))