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