xref: /trunk/main/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile (revision 4437c02e18a852c4a5e7d7e7c198180f06b2b9fc)
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
22# Builds the SpreadSheet examples of the Developers Guide.
23
24PRJ=../../../../../../../..
25SETTINGS=$(PRJ)/settings
26
27include $(SETTINGS)/settings.mk
28include $(SETTINGS)/std.mk
29include $(SETTINGS)/dk.mk
30
31include ../../../../thumbs.mk
32
33# Define non-platform/compiler specific settings
34PACKAGE = org/openoffice/comp/test
35
36SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
37        $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
38
39
40# Targets
41.PHONY: ALL
42ALL : $(REGISTERFLAG) \
43    $(APP1_JAR)
44
45include $(SETTINGS)/stdtarget.mk
46
47$(OUT_COMP_CLASS)/%.Manifest :
48    -$(MKDIR) $(subst /,$(PS),$(@D))
49    @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
50    @echo RegistrationClassName: $(subst /,.,$(PACKAGE)).$(basename $(basename $(@F)))>> $@
51
52$(OUT_COMP_CLASS)/$(PACKAGE)/%.class : %.java
53    -$(MKDIR) $(subst /,$(PS),$(@D))
54    $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $<
55
56$(OUT_COMP_CLASS)/%.mf :
57    -$(MKDIR) $(subst /,$(PS),$(@D))
58    @echo Main-Class: com.sun.star.lib.loader.Loader> $@
59    $(ECHOLINE)>> $@
60    @echo Name: com/sun/star/lib/loader/Loader.class>> $@
61    @echo Application-Class: $(subst /,.,$(PACKAGE)).$*>> $@
62
63# rule for component jar file
64$(COMP_JAR) : $(COMP_MANIFESTFILE) $(OUT_COMP_CLASS)/$(PACKAGE)/$(COMP_NAME).class
65    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
66    -$(MKDIR) $(subst /,$(PS),$(@D))
67    $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) $(PACKAGE)/$(basename $(basename $(@F))).class $(patsubst %.class,-C $(OUT_COMP_CLASS) %.class,$(GENCLASSNAMES))
68
69# rule for component package manifest
70$(OUT_COMP_CLASS)/%/manifest.xml :
71    -$(MKDIR) $(subst /,$(PS),$(@D))
72    @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
73    @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
74    @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
75    @echo $(SQM)  $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
76    @echo $(SQM)                       $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
77    @echo $(SQM)  $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
78    @echo $(SQM)                       $(SQM)manifest:full-path="$(QM)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@
79    @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
80
81# rule for component package file
82$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS)
83    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
84    -$(MKDIR) $(subst /,$(PS),$(@D))
85    $(COPY) $(subst /,$(PS),$(COMP_RDB)) $(subst /,$(PS),$(OUT_COMP_CLASS))
86    $(SDK_ZIP) $@ $(COMP_COMPONENTS)
87    cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_RDB_NAME) $(COMP_JAR_NAME)
88    cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
89    $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_CLASS)/$(COMP_RDB_NAME)))
90
91$(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(PACKAGE)/$(APP1_NAME).class
92    -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@))
93    $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) $(PACKAGE)/$(basename $(@F)).class $(patsubst %.class,-C $(OUT_COMP_CLASS) %.class,$(GENCLASSNAMES))
94    +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
95
96
97$(REGISTERFLAG) : $(COMP_PACKAGE)
98ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
99    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
100    -$(MKDIR) $(subst /,$(PS),$(@D))
101    $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
102    @echo flagged > $(subst /,$(PS),$@)
103else
104    @echo --------------------------------------------------------------------------------
105    @echo  If you want to install your component automatically, please set the environment
106    @echo  variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
107    @echo  possible if no office instance is running.
108    @echo --------------------------------------------------------------------------------
109endif
110
111.PHONY: clean
112clean :
113    -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
114    -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_JAR)))
115    -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG)))
116    -$(DEL) $(subst \\,\,$(subst /,$(PS),$(APP1_JAR)))
117