xref: /AOO41X/main/odk/examples/java/EmbedDocument/EmbeddedObject/Makefile (revision 122c3632cd029f095ff191137a08f3f2ec2c3238)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22PRJ=../../../..
23SETTINGS=$(PRJ)/settings
24
25include $(SETTINGS)/settings.mk
26include $(SETTINGS)/std.mk
27# include $(SETTINGS)/dk.mk
28
29# Define non-platform/compiler specific settings
30
31# we use the sample directory name for separating this example
32# from others in the output directory
33SAMPLE_NAME=EmbeddedObject
34SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
35SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
36
37COMP_NAME=OwnEmbeddedObject
38COMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME)
39COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
40COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
41COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
42COMP_JAR_NAME=$(COMP_NAME).uno.jar
43COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME)
44COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).Manifest
45COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
46COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag
47COMP_COMPONENTS=$(COMP_NAME).components
48
49PACKAGE = org/openoffice/examples/embedding
50
51COMP_JAVAFILES  =\
52                    OwnEmbeddedObject.java\
53                    OwnEmbeddedObjectFactory.java\
54                    EditorFrame.java
55
56COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
57
58SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
59        $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
60        $(PATH_SEPARATOR)$(COMP_CLASS_OUT))
61
62
63# Targets
64.PHONY: ALL
65ALL : $(COMP_NAME)
66
67include $(SETTINGS)/stdtarget.mk
68
69$(COMP_GEN_OUT)/%.Manifest :
70    -$(MKDIR) $(subst \\,\,$(subst /,$(PS),$(@D)))
71    @echo RegistrationClassName: $(subst /,.,$(PACKAGE)).$(COMP_NAME)Factory> $@
72
73# component as well as application are dependent from the generated types
74# rule for component class files
75$(COMP_CLASS_OUT)/%.class : $(COMP_JAVAFILES)
76    -$(MKDIR) $(subst /,$(PS),$(@D))
77    $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $(COMP_JAVAFILES)
78
79# rule for component jar file
80$(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
81    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
82    -$(MKDIR) $(subst /,$(PS),$(@D))
83    $(SDK_JAR) cvfm $@  $< -C $(COMP_CLASS_OUT) .
84
85# rule for component package manifest
86$(COMP_GEN_OUT)/%/manifest.xml :
87    -$(MKDIR) $(subst /,$(PS),$(@D))
88    @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
89    @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
90    @echo $(SQM)  $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
91    @echo $(SQM)                       $(SQM)manifest:full-path="$(QM)$(SAMPLE_NAME).xcu$(QM)"/$(CSEP) >> $@
92    @echo $(SQM)  $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
93    @echo $(SQM)                       $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@
94    @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
95
96# rule for component package file
97$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components
98    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
99    -$(MKDIR) $(subst /,$(PS),$(@D))
100    $(SDK_ZIP) $@ $(SAMPLE_NAME).xcu
101    $(SDK_ZIP) $@ -u $(COMP_NAME).components
102    cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u $@ $(COMP_JAR_NAME)
103    cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u $@ META-INF/manifest.xml
104
105$(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
106ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
107    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
108    -$(MKDIR) $(subst \\,\,$(subst /,$(PS),$(@D)))
109    $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
110    @echo flagged > $(subst /,$(PS),$@)
111else
112    @echo --------------------------------------------------------------------------------
113    @echo  If you want to install your component automatically, please set the environment
114    @echo  variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
115    @echo  possible if no office instance is running.
116    @echo --------------------------------------------------------------------------------
117endif
118
119$(COMP_NAME) : $(COMP_REGISTERFLAG)
120    @echo ------
121    @echo The $(COMP_NAME) component was installed if SDK_AUTO_DEPLOYMENT = YES.
122    @echo Load the "$(QM)$(SAMPLE_NAME).odt$(QM)" document to see how this component works.
123    @echo You can use this component inside your office installation, see the example
124    @echo description.
125    @echo -
126    @echo $(MAKE) $(SAMPLE_NAME).odt.load
127    @echo --------------------------------------------------------------------------------
128
129$(SAMPLE_NAME).odt.load : $(COMP_REGISTERFLAG)
130    "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
131
132.PHONY: clean
133clean :
134    -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
135    -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
136    -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
137