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
31CSC_FLAGS = -warnaserror+ -noconfig
32VBC_FLAGS = -warnaserror+
33ifeq "$(DEBUG)" "yes"
34CC_FLAGS+=-Zi -MT
35CSC_FLAGS += -debug+ -checked+ -define:DEBUG -define:TRACE
36VBC_FLAGS += -debug+ -define:DEBUG=1 -define:TRACE=1
37else
38CSC_FLAGS += -o
39VBC_FLAGS += -o
40endif
41
42THIS_OUT_MISC = $(OUT_MISC)/csharp_SpreadsheetExamples
43
44SPREADSHEET_OUT:= $(OUT_BIN)/CSharp_SpreadsheetExamples
45CLI_LIB_LOCATION = $(PRJ)\cli
46
47# Targets
48.PHONY : ALL
49ALL : Info
50
51include $(SETTINGS)/stdtarget.mk
52
53
54# build executables
55#csc -lib:"d:\StarOffice 8" does not work. csc does not understand the quotes.
56#but they are needed if the path contains a space. Therefore we use full path
57#with the -reference switch
58$(SPREADSHEET_OUT)/%.exe : %.cs SpreadsheetDocHelper.cs
59	-$(MKDIR) $(subst /,$(PS),$(@D))
60	csc $(CSC_FLAGS) \
61		-target:exe \
62		-out:$@ \
63		-reference:"$(CLI_LIB_LOCATION)"\cli_basetypes.dll \
64		-reference:"$(CLI_LIB_LOCATION)"\cli_uretypes.dll \
65		-reference:"$(CLI_LIB_LOCATION)"\cli_oootypes.dll \
66		-reference:"$(CLI_LIB_LOCATION)"\cli_ure.dll \
67		-reference:"$(CLI_LIB_LOCATION)"\cli_cppuhelper.dll \
68		$^
69
70SpreadsheetSample : $(SPREADSHEET_OUT)/SpreadsheetSample.exe
71
72GeneralTableSample : $(SPREADSHEET_OUT)/GeneralTableSample.exe
73
74ViewSample : $(SPREADSHEET_OUT)/ViewSample.exe
75
76.PHONY : Info
77ifeq "$(OS)" "WIN"
78Info : SpreadsheetSample GenerateTableSample ViewSample
79	@echo -------------------------------------------------------------------------------
80	@echo Please use one of the following commands to execute the examples!
81	@echo -
82	@echo $(MAKE) GeneralTableSample.run
83	@echo $(MAKE) SpreadsheetSample.run
84	@echo $(MAKE) ViewSample.run
85	@echo -------------------------------------------------------------------------------
86else
87Info :
88	@echo --------------------------------------------------------------------------------
89	@echo This example works only under Windows!
90	@echo --------------------------------------------------------------------------------
91endif
92
93%.run : $(SPREADSHEET_OUT)/%.exe
94	@echo -------------------------------------------------------------------------------
95	@echo Executing sample $@ $(UNORC) $(CONNECT_STRING)...
96	@echo -------------------------------------------------------------------------------
97	cd $(subst /,\\,$(SPREADSHEET_OUT)) && $(basename $@).exe
98
99.PHONY: clean
100clean :
101	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_BIN)/CSharp_SpreadsheetExamples)
102
103
104