update dev300-m58
[ooovba.git] / odk / examples / DevelopersGuide / Database / DriverSkeleton / Makefile
blobc491eba8b436c82bf962ff1945dac0440a20845c
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.10 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:21:12 $
9 # The Contents of this file are made available subject to the terms of
10 # the BSD license.
12 # Copyright (c) 2003 by Sun Microsystems, Inc.
13 # All rights reserved.
15 # Redistribution and use in source and binary forms, with or without
16 # modification, are permitted provided that the following conditions
17 # are met:
18 # 1. Redistributions of source code must retain the above copyright
19 # notice, this list of conditions and the following disclaimer.
20 # 2. Redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in the
22 # documentation and/or other materials provided with the distribution.
23 # 3. Neither the name of Sun Microsystems, Inc. nor the names of its
24 # contributors may be used to endorse or promote products derived
25 # from this software without specific prior written permission.
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34 # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #**************************************************************************
41 # Builds the Databse SDBC driver skeleton example of the Developers Guide.
43 PRJ=../../../..
44 SETTINGS=$(PRJ)/settings
46 include $(SETTINGS)/settings.mk
47 include $(SETTINGS)/std.mk
48 include $(SETTINGS)/dk.mk
50 # Define non-platform/compiler specific settings
51 COMP_NAME=DatabaseSDBCDriverSkeleton
52 COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT)
53 COMP_LIBRARY=$(SHAREDLIB_OUT)/$(COMP_IMPL_NAME)
54 OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME)
55 OUT_COMP_MISC=$(OUT_MISC)/$(COMP_NAME)
56 OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME)
57 COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
58 COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
59 COMP_UNOPKG_MANIFEST = $(OUT_COMP_MISC)/$(COMP_NAME)/META-INF/manifest.xml
60 COMP_MAPFILE = $(OUT_COMP_MISC)/$(COMP_NAME).uno.map
62 REGISTERFLAG = $(OUT_COMP_MISC)/devguide_$(COMP_NAME)_register_component.flag
64 CXXFILES = SConnection.cxx \
65 SDatabaseMetaData.cxx \
66 propertyids.cxx \
67 SDriver.cxx \
68 SPreparedStatement.cxx \
69 SResultSet.cxx \
70 SResultSetMetaData.cxx \
71 SServices.cxx \
72 SStatement.cxx
74 SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
76 # Targets
77 .PHONY: ALL
78 ALL : \
79 DatabaseSDBCDriverSkeletonExample
81 include $(SETTINGS)/stdtarget.mk
83 $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
84 -$(MKDIR) $(subst /,$(PS),$(@D))
85 $(CC) $(CC_FLAGS) $(CC_INCLUDES) $(STL_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
87 $(COMP_MAPFILE) : $(SLOFILES)
88 -$(MKDIR) $(subst /,$(PS),$(@D))
89 cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE)
90 ifeq "$(OS)" "MACOSX"
91 nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE)
92 endif
94 ifeq "$(OS)" "WIN"
95 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
96 -$(MKDIR) $(subst /,$(PS),$(@D))
97 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_MISC))
98 $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \
99 /MAP:$(OUT_COMP_MISC)/$(COMP_NAME).map $(SLOFILES) \
100 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) msvcrt.lib kernel32.lib
101 $(LINK_MANIFEST_VC8_ONLY)
102 else
103 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE)
104 -$(MKDIR) $(subst /,$(PS),$(@D))
105 $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \
106 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB)
107 ifeq "$(OS)" "MACOSX"
108 $(INSTALL_NAME_URELIBS) $@
109 endif
110 endif
112 # rule for component package manifest
113 $(OUT_COMP_MISC)/%/manifest.xml :
114 -$(MKDIR) $(subst /,$(PS),$(@D))
115 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
116 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
117 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
118 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@
119 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_MISC)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@
120 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
122 $(COMP_PACKAGE) : $(COMP_LIBRARY) $(COMP_UNOPKG_MANIFEST)
123 -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@))
124 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_MISC)/$(UNOPKG_PLATFORM))
125 $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_MISC)/$(UNOPKG_PLATFORM))
126 cd $(subst /,$(PS),$(OUT_COMP_MISC)) && $(SDK_ZIP) ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F)
127 cd $(subst /,$(PS),$(OUT_COMP_MISC)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
129 $(REGISTERFLAG) : $(COMP_PACKAGE)
130 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
131 -$(MKDIR) $(subst /,$(PS),$(@D))
132 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
133 $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
134 @echo flagged > $(subst /,$(PS),$@)
135 else
136 @echo --------------------------------------------------------------------------------
137 @echo If you want to install your component automatically, please set the environment
138 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
139 @echo possible if no office instance is running.
140 @echo --------------------------------------------------------------------------------
141 endif
143 DatabaseSDBCDriverSkeletonExample : $(REGISTERFLAG)
144 @echo --------------------------------------------------------------------------------
145 @echo The Database SDBC skeleton driver component was installed if SDK_AUTO_DEPLOYMENT = YES.
146 @echo You can use this component inside your office installation, see the example
147 @echo description and the howto of implementing a sdbc driver.
148 @echo --------------------------------------------------------------------------------
150 .PHONY: clean
151 clean :
152 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
153 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC))
154 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
155 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_LIBRARY)))
156 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))