cid#1607171 Data race condition
[LibreOffice.git] / odk / examples / java / ToDo / Makefile
blob4fdc8a31f36421b7faa02188b94e55687aac50a3
1 #*************************************************************************
3 # The Contents of this file are made available subject to the terms of
4 # the BSD license.
5 #
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
7 # All rights reserved.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
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 Calc Addin example of the SDK.
37 PRJ=../../..
38 SETTINGS=$(PRJ)/settings
40 include $(SETTINGS)/settings.mk
41 include $(SETTINGS)/std.mk
43 # Define non-platform/compiler specific settings
44 COMP_NAME=ToDo
45 COMP_CLASS_OUT=$(OUT_CLASS)/$(COMP_NAME)
46 COMP_GEN_OUT=$(OUT_MISC)/$(COMP_NAME)
47 COMP_RDB_NAME=$(COMP_NAME).uno.rdb
48 COMP_RDB=$(COMP_GEN_OUT)/$(COMP_RDB_NAME)
49 COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
50 COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
51 COMP_JAR_NAME=$(COMP_NAME).uno.jar
52 COMP_JAR=$(COMP_CLASS_OUT)/$(COMP_JAR_NAME)
53 COMP_JAR_MANIFEST=$(COMP_CLASS_OUT)/$(COMP_NAME).uno.Manifest
54 COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
55 COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag
56 COMP_COMPONENTS=$(COMP_NAME).components
58 IDLFILES = XToDo.idl \
59 ToDo.idl
61 PACKAGE = org/openoffice
63 COMP_JAVAFILES = ToDo.java
64 COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
66 GEN_CLASSFILES = $(patsubst %.idl,$(COMP_CLASS_OUT)/$(PACKAGE)/%.class,$(IDLFILES))
67 GEN_TYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES)))
70 $(COMP_NAME)_CLASSFILES = $(COMP_NAME).class \
71 $(COMP_NAME)$(QUOTE)$$$(COMP_NAME)Impl.class
73 $(COMP_NAME)_CLASSFILES += $(subst $(COMP_CLASS_OUT)/,,$(GEN_CLASSFILES))
75 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
76 $(PATH_SEPARATOR)$(COMP_CLASS_OUT))
79 # Targets
80 .PHONY: ALL
81 ALL : JavaToDoExample
83 include $(SETTINGS)/stdtarget.mk
85 $(COMP_CLASS_OUT)/%.Manifest :
86 -$(MKDIR) $(subst /,$(PS),$(@D))
87 @echo UNO-Type-Path: $(basename $*).uno.jar> $@
88 @echo RegistrationClassName: $(basename $(basename $(@F)))>> $@
90 $(COMP_GEN_OUT)/%.rdb : $(patsubst %,$(PACKAGE)/%,$(IDLFILES))
91 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
92 -$(MKDIR) $(subst /,$(PS),$(@D))
93 $(UNOIDLWRITE) $(URE_TYPES) $(OFFICE_TYPES) . $@
95 $(GEN_CLASSFILES) : $(COMP_RDB)
96 -$(MKDIR) $(subst /,$(PS),$(@D))
97 $(JAVAMAKER) -nD $(GEN_TYPELIST) -O$(COMP_CLASS_OUT) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
99 $(COMP_CLASSFILES) : $(COMP_JAVAFILES) $(GEN_CLASSFILES)
100 -$(MKDIR) $(subst /,$(PS),$(@D))
101 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $(COMP_JAVAFILES)
103 # rule for component jar file
104 $(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
105 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
106 -$(MKDIR) $(subst /,$(PS),$(@D))
107 cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES)
109 # rule for component package manifest
110 $(COMP_GEN_OUT)/%/manifest.xml :
111 -$(MKDIR) $(subst /,$(PS),$(@D))
112 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
113 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
114 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
115 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
116 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_MISC)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
117 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
118 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@
119 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
121 # rule for component package file
122 $(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components description.xml
123 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
124 -$(MKDIR) $(subst /,$(PS),$(@D))
125 $(SDK_ZIP) $@ $(COMP_NAME).components description.xml
126 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_RDB_NAME)
127 cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME)
128 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) META-INF/manifest.xml
130 $(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
131 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
132 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
133 -$(MKDIR) $(subst /,$(PS),$(@D))
134 $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
135 @echo flagged > $(subst /,$(PS),$@)
136 else
137 @echo --------------------------------------------------------------------------------
138 @echo If you want to install your component automatically, please set the environment
139 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
140 @echo possible if no office instance is running.
141 @echo --------------------------------------------------------------------------------
142 endif
144 JavaToDoExample : $(COMP_REGISTERFLAG)
145 @echo --------------------------------------------------------------------------------
146 @echo The $(COMP_NAME) Java component was installed if SDK_AUTO_DEPLOYMENT = YES.
147 @echo Please load the "$(QM)ToDo.ods$(QM)" document to see how this component works, see
148 @echo the example description.
149 @echo -
150 @echo $(MAKE) ToDo.ods.load
151 @echo --------------------------------------------------------------------------------
153 ToDo.ods.load : $(COMP_REGISTERFLAG)
154 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
156 .PHONY: clean
157 clean :
158 -$(DELRECURSIVE) $(subst /,$(PS),$(COMP_CLASS_OUT))
159 -$(DELRECURSIVE) $(subst /,$(PS),$(COMP_GEN_OUT))
160 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))