1*34dd1e25SAndrew Rist/**************************************************************
2*34dd1e25SAndrew Rist *
3*34dd1e25SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*34dd1e25SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*34dd1e25SAndrew Rist * distributed with this work for additional information
6*34dd1e25SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*34dd1e25SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*34dd1e25SAndrew Rist * "License"); you may not use this file except in compliance
9*34dd1e25SAndrew Rist * with the License.  You may obtain a copy of the License at
10*34dd1e25SAndrew Rist *
11*34dd1e25SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*34dd1e25SAndrew Rist *
13*34dd1e25SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*34dd1e25SAndrew Rist * software distributed under the License is distributed on an
15*34dd1e25SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*34dd1e25SAndrew Rist * KIND, either express or implied.  See the License for the
17*34dd1e25SAndrew Rist * specific language governing permissions and limitations
18*34dd1e25SAndrew Rist * under the License.
19*34dd1e25SAndrew Rist *
20*34dd1e25SAndrew Rist *************************************************************/
21*34dd1e25SAndrew Rist
22cdf0e10cSrcweir# Builds the SpreadSheet examples of the Developers Guide.
23cdf0e10cSrcweir
24cdf0e10cSrcweirPRJ = ../../../..
25cdf0e10cSrcweirSETTINGS = $(PRJ)/settings
26cdf0e10cSrcweir
27cdf0e10cSrcweirinclude $(SETTINGS)/settings.mk
28cdf0e10cSrcweirinclude $(SETTINGS)/std.mk
29cdf0e10cSrcweirinclude $(SETTINGS)/dk.mk
30cdf0e10cSrcweir
31cdf0e10cSrcweirCSC_FLAGS = -warnaserror+ -noconfig
32cdf0e10cSrcweirVBC_FLAGS = -warnaserror+
33cdf0e10cSrcweirifeq "$(DEBUG)" "yes"
34cdf0e10cSrcweirCC_FLAGS+=-Zi -MT
35cdf0e10cSrcweirCSC_FLAGS += -debug+ -checked+ -define:DEBUG -define:TRACE
36cdf0e10cSrcweirVBC_FLAGS += -debug+ -define:DEBUG=1 -define:TRACE=1
37cdf0e10cSrcweirelse
38cdf0e10cSrcweirCSC_FLAGS += -o
39cdf0e10cSrcweirVBC_FLAGS += -o
40cdf0e10cSrcweirendif
41cdf0e10cSrcweir
42cdf0e10cSrcweirTHIS_OUT_MISC = $(OUT_MISC)/csharp_SpreadsheetExamples
43cdf0e10cSrcweir
44cdf0e10cSrcweirSPREADSHEET_OUT:= $(OUT_BIN)/CSharp_SpreadsheetExamples
45cdf0e10cSrcweirCLI_LIB_LOCATION = $(PRJ)\cli
46cdf0e10cSrcweir
47cdf0e10cSrcweir# Targets
48cdf0e10cSrcweir.PHONY : ALL
49cdf0e10cSrcweirALL : Info
50cdf0e10cSrcweir
51cdf0e10cSrcweirinclude $(SETTINGS)/stdtarget.mk
52cdf0e10cSrcweir
53cdf0e10cSrcweir
54cdf0e10cSrcweir# build executables
55cdf0e10cSrcweir#csc -lib:"d:\StarOffice 8" does not work. csc does not understand the quotes.
56cdf0e10cSrcweir#but they are needed if the path contains a space. Therefore we use full path
57cdf0e10cSrcweir#with the -reference switch
58cdf0e10cSrcweir$(SPREADSHEET_OUT)/%.exe : %.cs SpreadsheetDocHelper.cs
59cdf0e10cSrcweir	-$(MKDIR) $(subst /,$(PS),$(@D))
60cdf0e10cSrcweir	csc $(CSC_FLAGS) \
61cdf0e10cSrcweir		-target:exe \
62cdf0e10cSrcweir		-out:$@ \
63cdf0e10cSrcweir		-reference:"$(CLI_LIB_LOCATION)"\cli_basetypes.dll \
64cdf0e10cSrcweir		-reference:"$(CLI_LIB_LOCATION)"\cli_uretypes.dll \
65cdf0e10cSrcweir		-reference:"$(CLI_LIB_LOCATION)"\cli_oootypes.dll \
66cdf0e10cSrcweir		-reference:"$(CLI_LIB_LOCATION)"\cli_ure.dll \
67cdf0e10cSrcweir		-reference:"$(CLI_LIB_LOCATION)"\cli_cppuhelper.dll \
68cdf0e10cSrcweir		$^
69cdf0e10cSrcweir
70cdf0e10cSrcweirSpreadsheetSample : $(SPREADSHEET_OUT)/SpreadsheetSample.exe
71cdf0e10cSrcweir
72cdf0e10cSrcweirGeneralTableSample : $(SPREADSHEET_OUT)/GeneralTableSample.exe
73cdf0e10cSrcweir
74cdf0e10cSrcweirViewSample : $(SPREADSHEET_OUT)/ViewSample.exe
75cdf0e10cSrcweir
76cdf0e10cSrcweir.PHONY : Info
77cdf0e10cSrcweirifeq "$(OS)" "WIN"
78cdf0e10cSrcweirInfo : SpreadsheetSample GenerateTableSample ViewSample
79cdf0e10cSrcweir	@echo -------------------------------------------------------------------------------
80cdf0e10cSrcweir	@echo Please use one of the following commands to execute the examples!
81cdf0e10cSrcweir	@echo -
82cdf0e10cSrcweir	@echo $(MAKE) GeneralTableSample.run
83cdf0e10cSrcweir	@echo $(MAKE) SpreadsheetSample.run
84cdf0e10cSrcweir	@echo $(MAKE) ViewSample.run
85cdf0e10cSrcweir	@echo -------------------------------------------------------------------------------
86cdf0e10cSrcweirelse
87cdf0e10cSrcweirInfo :
88cdf0e10cSrcweir	@echo --------------------------------------------------------------------------------
89cdf0e10cSrcweir	@echo This example works only under Windows!
90cdf0e10cSrcweir	@echo --------------------------------------------------------------------------------
91cdf0e10cSrcweirendif
92cdf0e10cSrcweir
93cdf0e10cSrcweir%.run : $(SPREADSHEET_OUT)/%.exe
94cdf0e10cSrcweir	@echo -------------------------------------------------------------------------------
95cdf0e10cSrcweir	@echo Executing sample $@ $(UNORC) $(CONNECT_STRING)...
96cdf0e10cSrcweir	@echo -------------------------------------------------------------------------------
97cdf0e10cSrcweir	cd $(subst /,\\,$(SPREADSHEET_OUT)) && $(basename $@).exe
98cdf0e10cSrcweir
99cdf0e10cSrcweir.PHONY: clean
100cdf0e10cSrcweirclean :
101cdf0e10cSrcweir	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_BIN)/CSharp_SpreadsheetExamples)
102cdf0e10cSrcweir
103cdf0e10cSrcweir
104