1 #*************************************************************************
3 # $RCSfile: Makefile,v $
7 # last change: $Author: obo $ $Date: 2007-01-25 11:09:34 $
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 PropertySet component example 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
52 COMP_CLASS_OUT
=$(OUT_CLASS
)/$(COMP_NAME
)
53 COMP_GEN_OUT
=$(OUT_MISC
)/$(COMP_NAME
)
54 COMP_PACKAGE
=$(OUT_BIN
)/$(COMP_NAME
).
$(UNOOXT_EXT
)
55 COMP_PACKAGE_URL
=$(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
56 COMP_JAR_NAME
=$(COMP_NAME
).uno.jar
57 COMP_JAR
=$(COMP_CLASS_OUT
)/$(COMP_JAR_NAME
)
58 COMP_JAR_MANIFEST
=$(COMP_CLASS_OUT
)/$(COMP_NAME
).uno.Manifest
59 COMP_UNOPKG_MANIFEST
= $(COMP_GEN_OUT
)/META-INF
/manifest.xml
60 COMP_REGISTERFLAG
=$(COMP_GEN_OUT
)$(PS
)java_
$(COMP_NAME
)_register_component.flag
62 COMP_JAVAFILES
= PropTest.java
64 COMP_CLASSFILES
= $(patsubst %.java
,$(COMP_CLASS_OUT
)/%.class
,$(COMP_JAVAFILES
))
66 $(COMP_NAME
)_CLASSFILES
= $(COMP_NAME
).class
68 SDK_CLASSPATH
= $(subst $(EMPTYSTRING
) $(PATH_SEPARATOR
),$(PATH_SEPARATOR
),$(CLASSPATH
)\
69 $(PATH_SEPARATOR
)$(COMP_CLASS_OUT
))
74 ALL
: JavaPropertySetExample
76 include $(SETTINGS
)/stdtarget.mk
78 $(COMP_CLASS_OUT
)/%.Manifest
:
79 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
80 @echo RegistrationClassName
: $(basename $(basename $(@F
)))> $@
82 $(COMP_CLASSFILES
) : $(COMP_JAVAFILES
)
83 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
84 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(COMP_CLASS_OUT
) $(COMP_JAVAFILES
)
86 # rule for component jar file
87 $(COMP_JAR
) : $(COMP_JAR_MANIFEST
) $(COMP_CLASSFILES
)
88 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
89 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
90 cd
$(subst /,$(PS
),$(COMP_CLASS_OUT
)) && $(SDK_JAR
) cvfm
$(@F
) $(<F
) $($(basename $(basename $(@F
)))_CLASSFILES
)
92 # rule for component package manifest
93 $(COMP_GEN_OUT
)/%/manifest.xml
:
94 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
95 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
96 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
97 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
98 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
99 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(subst /META-INF,,$(subst $(OUT_MISC)/,,$(@D))).uno.jar$(QM)"/$(CSEP
) >> $@
100 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
102 # rule for component package file
103 $(COMP_PACKAGE
) : $(COMP_JAR
) $(COMP_UNOPKG_MANIFEST
)
104 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
105 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
106 cd
$(subst /,$(PS
),$(COMP_CLASS_OUT
)) && $(SDK_ZIP
) ..
/..
/bin
/$(@F
) $(<F
)
107 cd
$(subst /,$(PS
),$(COMP_GEN_OUT
)) && $(SDK_ZIP
) -u ..
/..
/bin
/$(@F
) META-INF
/manifest.xml
110 $(COMP_REGISTERFLAG
) : $(COMP_PACKAGE
)
111 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
112 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
113 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
114 $(DEPLOYTOOL
) $(COMP_PACKAGE_URL
)
115 @echo flagged
> $(subst /,$(PS
),$@
)
117 @echo
--------------------------------------------------------------------------------
118 @echo If you want to
install your component automatically
, please set the environment
119 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
120 @echo possible if no office instance is running.
121 @echo
--------------------------------------------------------------------------------
124 JavaPropertySetExample
: $(COMP_REGISTERFLAG
)
125 @echo
--------------------------------------------------------------------------------
126 @echo The PropTest was installed if SDK_AUTO_DEPLOYMENT
= YES.
127 @echo Load the
"$(QM)PropertySet.odt$(QM)" document to see how this component works. You can
128 @echo use this component inside your office installation
, see the example description.
130 @echo
$(MAKE
) PropertySet.odt.load
131 @echo
--------------------------------------------------------------------------------
133 PropertySet.odt.load
: $(COMP_REGISTERFLAG
)
134 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@
)
138 -$(DELRECURSIVE
) $(subst /,$(PS
),$(COMP_CLASS_OUT
))
139 -$(DELRECURSIVE
) $(subst /,$(PS
),$(COMP_GEN_OUT
))
140 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_PACKAGE_URL
)))