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 #**************************************************************************
36 SETTINGS
=$(PRJ
)/settings
38 include $(SETTINGS
)/settings.mk
39 include $(SETTINGS
)/std.mk
41 # Define non-platform/compiler specific settings
43 # we use the sample directory name for separating this example
44 # from others in the output directory
45 SAMPLE_NAME
=EmbeddedObject
46 SAMPLE_CLASS_OUT
=$(OUT_CLASS
)/$(SAMPLE_NAME
)
47 SAMPLE_GEN_OUT
=$(OUT_MISC
)/$(SAMPLE_NAME
)
49 COMP_NAME
=OwnEmbeddedObject
50 COMP_CLASS_OUT
=$(SAMPLE_CLASS_OUT
)/$(COMP_NAME
)
51 COMP_GEN_OUT
=$(SAMPLE_GEN_OUT
)/$(COMP_NAME
)
52 COMP_PACKAGE
=$(OUT_BIN
)/$(COMP_NAME
).
$(UNOOXT_EXT
)
53 COMP_PACKAGE_URL
=$(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
54 COMP_JAR_NAME
=$(COMP_NAME
).uno.jar
55 COMP_JAR
=$(SAMPLE_CLASS_OUT
)/$(COMP_JAR_NAME
)
56 COMP_JAR_MANIFEST
=$(COMP_GEN_OUT
)/$(COMP_NAME
).Manifest
57 COMP_UNOPKG_MANIFEST
= $(COMP_GEN_OUT
)/META-INF
/manifest.xml
58 COMP_REGISTERFLAG
=$(COMP_GEN_OUT
)$(PS
)java_
$(COMP_NAME
)_register_component.flag
59 COMP_COMPONENTS
=$(COMP_NAME
).components
64 OwnEmbeddedObject.java\
65 OwnEmbeddedObjectFactory.java\
68 COMP_CLASSFILES
= $(patsubst %.java
,$(COMP_CLASS_OUT
)/%.class
,$(COMP_JAVAFILES
))
70 SDK_CLASSPATH
= $(subst $(EMPTYSTRING
) $(PATH_SEPARATOR
),$(PATH_SEPARATOR
),$(CLASSPATH
)\
71 $(PATH_SEPARATOR
)$(SAMPLE_CLASS_OUT
)\
72 $(PATH_SEPARATOR
)$(COMP_CLASS_OUT
))
79 include $(SETTINGS
)/stdtarget.mk
81 $(COMP_GEN_OUT
)/%.Manifest
:
82 -$(MKDIR
) $(subst \\,\
,$(subst /,$(PS
),$(@D
)))
83 @echo RegistrationClassName
: $(subst /,.
,$(PACKAGE
)).
$(COMP_NAME
)Factory
> $@
85 # component as well as application are dependent from the generated types
86 # rule for component class files
87 $(COMP_CLASS_OUT
)/%.class
: $(COMP_JAVAFILES
)
88 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
89 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(COMP_CLASS_OUT
) $(COMP_JAVAFILES
)
91 # rule for component jar file
92 $(COMP_JAR
) : $(COMP_JAR_MANIFEST
) $(COMP_CLASSFILES
)
93 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
94 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
95 $(SDK_JAR
) cvfm
$@
$< -C
$(COMP_CLASS_OUT
) .
97 # rule for component package manifest
98 $(COMP_GEN_OUT
)/%/manifest.xml
:
99 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
100 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
101 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
102 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
103 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(SAMPLE_NAME).xcu$(QM)"/$(CSEP
) >> $@
104 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
105 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP
)>> $@
106 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
108 # rule for component package file
109 $(COMP_PACKAGE
) : $(COMP_JAR
) $(COMP_UNOPKG_MANIFEST
) $(COMP_NAME
).components
110 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
111 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
112 $(SDK_ZIP
) $@
$(SAMPLE_NAME
).xcu
113 $(SDK_ZIP
) $@
-u
$(COMP_NAME
).components
114 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_ZIP
) -u
$@
$(COMP_JAR_NAME
)
115 cd
$(subst /,$(PS
),$(COMP_GEN_OUT
)) && $(SDK_ZIP
) -u
$@ META-INF
/manifest.xml
117 $(COMP_REGISTERFLAG
) : $(COMP_PACKAGE
)
118 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
119 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
120 -$(MKDIR
) $(subst \\,\
,$(subst /,$(PS
),$(@D
)))
121 $(DEPLOYTOOL
) $(COMP_PACKAGE_URL
)
122 @echo flagged
> $(subst /,$(PS
),$@
)
124 @echo
--------------------------------------------------------------------------------
125 @echo If you want to
install your component automatically
, please set the environment
126 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
127 @echo possible if no office instance is running.
128 @echo
--------------------------------------------------------------------------------
131 $(COMP_NAME
) : $(COMP_REGISTERFLAG
)
133 @echo The
$(COMP_NAME
) component was installed if SDK_AUTO_DEPLOYMENT
= YES.
134 @echo Load the
"$(QM)$(SAMPLE_NAME).odt$(QM)" document to see how this component works.
135 @echo You can use this component inside your office installation
, see the example
138 @echo
$(MAKE
) $(SAMPLE_NAME
).odt.load
139 @echo
--------------------------------------------------------------------------------
141 $(SAMPLE_NAME
).odt.load
: $(COMP_REGISTERFLAG
)
142 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@
)
146 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_CLASS_OUT
))
147 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_GEN_OUT
))
148 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_PACKAGE_URL
)))