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