1#*************************************************************************
2#
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.
8#
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.
20#
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.
32#
33#**************************************************************************
34
35# Builds the DialogWithHelp example of the Developers Guide.
36
37PRJ=../../../..
38SETTINGS=$(PRJ)/settings
39
40include $(SETTINGS)/settings.mk
41include $(SETTINGS)/std.mk
42include $(SETTINGS)/dk.mk
43
44# Define non-platform/compiler specific settings
45SAMPLE_NAME=ExtDialogWithHelp
46SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
47
48COMP_NAME=DialogWithHelp
49COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
50COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
51COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
52COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
53COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)devguide_basic_$(COMP_NAME)_register_component.flag
54
55COMP_LIBRARY_FILES=\
56	DialogWithHelp/dialog.xlb\
57	DialogWithHelp/script.xlb\
58	DialogWithHelp/Module1.xba\
59	DialogWithHelp/Dialog1.xdl
60
61COMP_MISC_FILES=\
62	META-INF/manifest.xml\
63	Addons.xcu\
64	description.xml
65
66COMP_HELP_FILES=\
67	help/de/com.foocorp.foo-ext/page1.xhp\
68	help/de/com.foocorp.foo-ext/page2.xhp\
69	help/de/com.foocorp.foo-ext/subfolder/anotherpage.xhp\
70	help/en/com.foocorp.foo-ext/page1.xhp\
71	help/en/com.foocorp.foo-ext/page2.xhp\
72	help/en/com.foocorp.foo-ext/subfolder/anotherpage.xhp\
73
74# Targets
75.PHONY: ALL
76ALL : $(SAMPLE_NAME)
77
78include $(SETTINGS)/stdtarget.mk
79
80# rule for component package file
81$(COMP_PACKAGE) : $(COMP_LIBRARY_FILES) $(COMP_MISC_FILES) $(COMP_HELP_FILES)
82	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
83	-$(MKDIR) $(subst /,$(PS),$(@D))
84	$(SDK_ZIP) $@ $(COMP_LIBRARY_FILES)
85	$(SDK_ZIP) $@ $(COMP_MISC_FILES)
86	$(SDK_ZIP) $@ $(COMP_HELP_FILES)
87
88$(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
89ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
90	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
91	-$(MKDIR) $(subst /,$(PS),$(@D))
92	$(DEPLOYTOOL) $(COMP_PACKAGE_URL)
93	@echo flagged > $(subst /,$(PS),$@)
94else
95	@echo --------------------------------------------------------------------------------
96	@echo  If you want to install your component automatically, please set the environment
97	@echo  variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
98	@echo  possible if no office instance is running.
99	@echo --------------------------------------------------------------------------------
100endif
101
102$(SAMPLE_NAME) : $(COMP_REGISTERFLAG)
103	@echo --------------------------------------------------------------------------------
104	@echo The "$(QM)DialogWithHelp$(QM)" library was installed in your office installation
105	@echo if SDK_AUTO_DEPLOYMENT = YES. You can use it in the BASIC IDE as a normal
106	@echo Basic library. You also will find a new top level menu "$(QM)Foo Extension$(QM)"
107	@echo with one menu entry "$(QM)Start Foo Dialog$(QM)" to start it directly. If a
108	@echo document is active there is also a "$(QM)Foo Toolbar Item$(QM)" doing the same.
109	@echo All help index entries provided by the help content start with Foo.
110	@echo --------------------------------------------------------------------------------
111
112$(COMP_NAME).odt.load : $(COMP_REGISTERFLAG)
113	"$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
114
115.PHONY: clean
116clean :
117	-$(DELRECURSIVE) $(subst /,$(PS),$(COMP_GEN_OUT))
118	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
119