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 CreatingDialogs 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=BaDToolkitControls
33SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
34
35COMP_NAME=ToolkitControls
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	ToolkitControls/dialog.xlb\
44	ToolkitControls/FileDialog.xba\
45	ToolkitControls/FileDialogDlg.xdl\
46	ToolkitControls/MultiPage.xba\
47	ToolkitControls/MultiPageDlg.xdl\
48	ToolkitControls/ProgressBar.xba\
49	ToolkitControls/ProgressBarDlg.xdl\
50	ToolkitControls/script.xlb\
51	ToolkitControls/ScrollBar.xba\
52	ToolkitControls/ScrollBarDlg.xdl
53
54# Targets
55.PHONY: ALL
56ALL : $(SAMPLE_NAME)
57
58include $(SETTINGS)/stdtarget.mk
59
60# rule for component package manifest
61$(COMP_GEN_OUT)/%/manifest.xml :
62	-$(MKDIR) $(subst /,$(PS),$(@D))
63	@echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
64	@echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
65	@echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
66	@echo $(SQM)  $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.basic-library$(QM)" >> $@
67	@echo $(SQM)                       $(SQM)manifest:full-path="$(QM)$(COMP_NAME)$(QM)"/$(CSEP) >> $@
68	@echo $(OSEP)/manifest:manifest$(CSEP) >> $@
69
70# rule for component package file
71$(COMP_PACKAGE) : $(COMP_UNOPKG_MANIFEST) $(COMP_LIBRARY_FILES)
72	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
73	-$(MKDIR) $(subst /,$(PS),$(@D))
74	$(SDK_ZIP) $@ ToolkitControls/dialog.xlb \
75	ToolkitControls/FileDialog.xba ToolkitControls/FileDialogDlg.xdl \
76	ToolkitControls/MultiPage.xba ToolkitControls/MultiPageDlg.xdl \
77	ToolkitControls/ProgressBar.xba ToolkitControls/ProgressBarDlg.xdl \
78	ToolkitControls/script.xlb ToolkitControls/ScrollBar.xba \
79	ToolkitControls/ScrollBarDlg.xdl
80	cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
81
82$(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
83ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
84	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
85	-$(MKDIR) $(subst /,$(PS),$(@D))
86	$(DEPLOYTOOL) $(COMP_PACKAGE_URL)
87	@echo flagged > $(subst /,$(PS),$@)
88else
89	@echo --------------------------------------------------------------------------------
90	@echo  If you want to install your component automatically, please set the environment
91	@echo  variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
92	@echo  possible if no office instance is running.
93	@echo --------------------------------------------------------------------------------
94endif
95
96$(SAMPLE_NAME) : $(COMP_REGISTERFLAG)
97	@echo --------------------------------------------------------------------------------
98	@echo The "$(QM)ToolkitControls$(QM)" library was installed in your office installation
99	@echo if SDK_AUTO_DEPLOYMENT = YES. You can use it in the BASIC IDE as a normal
100	@echo Basic library.
101	@echo You can also load the document "$(QM)$(COMP_NAME).odt$(QM)" and press a button
102	@echo to run one of the example macros.
103	@echo -
104	@echo $(MAKE) $(COMP_NAME).odt.load
105	@echo --------------------------------------------------------------------------------
106
107$(COMP_NAME).odt.load : $(COMP_REGISTERFLAG)
108	"$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
109
110.PHONY: clean
111clean :
112	-$(DELRECURSIVE) $(subst /,$(PS),$(COMP_GEN_OUT))
113	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
114