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