1cdf0e10cSrcweir#************************************************************************* 2cdf0e10cSrcweir# 3cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4cdf0e10cSrcweir# 5cdf0e10cSrcweir# Copyright 2008 by Sun Microsystems, Inc. 6cdf0e10cSrcweir# 7cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 8cdf0e10cSrcweir# 9cdf0e10cSrcweir# This file is part of OpenOffice.org. 10cdf0e10cSrcweir# 11cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 12cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 13cdf0e10cSrcweir# only, as published by the Free Software Foundation. 14cdf0e10cSrcweir# 15cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 16cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 17cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 19cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 20cdf0e10cSrcweir# 21cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 22cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 23cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 24cdf0e10cSrcweir# for a copy of the LGPLv3 License. 25cdf0e10cSrcweir# 26cdf0e10cSrcweir#************************************************************************* 27cdf0e10cSrcweir 28cdf0e10cSrcweirPRJ=.. 29cdf0e10cSrcweirPRJNAME=mysqlc 30cdf0e10cSrcweir 31cdf0e10cSrcweir.INCLUDE : $(PRJ)$/version.mk 32cdf0e10cSrcweir 33cdf0e10cSrcweirTARGET=mysqlc 34cdf0e10cSrcweirENABLE_EXCEPTIONS=TRUE 35cdf0e10cSrcweirLIBTARGET=NO 36cdf0e10cSrcweirEXTENSIONNAME:=mysql-connector-ooo 37cdf0e10cSrcweir 38cdf0e10cSrcweir.IF "$(SYSTEM_MYSQL)" == "YES" 39cdf0e10cSrcweirEXTERNAL_WARNINGS_NOT_ERRORS = TRUE 40cdf0e10cSrcweir.ENDIF 41cdf0e10cSrcweir 42cdf0e10cSrcweir# --- Settings ----------------------------------------------------- 43cdf0e10cSrcweir 44cdf0e10cSrcweir.INCLUDE : settings.mk 45cdf0e10cSrcweir 46cdf0e10cSrcweir#------------------------------------------------------------------- 47cdf0e10cSrcweir 48cdf0e10cSrcweir#---- extension version 49cdf0e10cSrcweirEXTENSION_VERSION_BASE=$(MYSQLC_VERSION_MAJOR).$(MYSQLC_VERSION_MINOR).$(MYSQLC_VERSION_MICRO) 50cdf0e10cSrcweir.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" ) 51cdf0e10cSrcweir EXTENSION_VERSION=$(EXTENSION_VERSION_BASE) 52cdf0e10cSrcweir.ELSE 53cdf0e10cSrcweir EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP) 54cdf0e10cSrcweir.ENDIF 55cdf0e10cSrcweir 56cdf0e10cSrcweir#---- extension title package name 57cdf0e10cSrcweir.IF "$(MYSQLC_STATUS)" == "final" 58cdf0e10cSrcweir EXTENSION_TITLE:=$(MYSQLC_TITLE) 59cdf0e10cSrcweir EXTENSION_ZIPNAME:=$(EXTENSIONNAME) 60cdf0e10cSrcweir.ELSE 61cdf0e10cSrcweir EXTENSION_TITLE:=$(MYSQLC_TITLE) ($(MYSQLC_STATUS)) 62cdf0e10cSrcweir EXTENSION_ZIPNAME:=$(EXTENSIONNAME) 63cdf0e10cSrcweir.ENDIF 64cdf0e10cSrcweir 65cdf0e10cSrcweir#------------------------------------------------------------------- 66cdf0e10cSrcweir 67cdf0e10cSrcweir# set default symbol visibility / scope to hidden 68cdf0e10cSrcweir.IF "$(COMNAME)" == "gcc3" 69cdf0e10cSrcweir.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" 70cdf0e10cSrcweir CFLAGS += -fvisibility=hidden 71cdf0e10cSrcweir.ENDIF # HAVE_GCC_VISIBILITY_FEATURE 72cdf0e10cSrcweir.ENDIF # gcc3 73cdf0e10cSrcweir 74cdf0e10cSrcweir.IF "$(COMNAME)" == "sunpro5" 75cdf0e10cSrcweir.IF "$(CCNUMVER)" >= "00050005" 76cdf0e10cSrcweir CFLAGS += -xldscope=hidden 77cdf0e10cSrcweir.ENDIF # 5.5 78cdf0e10cSrcweir.ENDIF # sunpro5 79cdf0e10cSrcweir 80cdf0e10cSrcweir#------------------------------------------------------------------- 81cdf0e10cSrcweir 82cdf0e10cSrcweir# The headers delivered from C/C++ have a habit of putting a ";" after the closing bracked of a namespace, which 83cdf0e10cSrcweir# yields a warning with Solaris' compiler. Until this is fixed in C/C++, silence this warning 84cdf0e10cSrcweir.IF "$(OS)" == "SOLARIS" 85cdf0e10cSrcweir CFLAGSWARNCXX+=,wemptydecl 86cdf0e10cSrcweir CFLAGSWARNCXX:=$(CFLAGSWARNCXX:s/ ,/,/) 87cdf0e10cSrcweir.ENDIF 88cdf0e10cSrcweir 89cdf0e10cSrcweir#------------------------------------------------------------------- 90cdf0e10cSrcweir.IF "$(ENABLE_MYSQLC)" != "YES" 91cdf0e10cSrcweir@all: 92cdf0e10cSrcweir @echo "Mysql native driver extension build disabled." 93cdf0e10cSrcweir.ENDIF 94cdf0e10cSrcweir 95cdf0e10cSrcweir# use the static version 96cdf0e10cSrcweir.IF "$(GUI)"=="WNT" 97cdf0e10cSrcweir MYSQL_LIBDIR=$(LIBMYSQL_PATH)$/lib 98cdf0e10cSrcweir MYSQL_INCDIR=$(LIBMYSQL_PATH)$/include 99cdf0e10cSrcweir.ELSE 100cdf0e10cSrcweir .IF "$(SYSTEM_MYSQL)" != "YES" 101cdf0e10cSrcweir MYSQL_LIBDIR=$(LIBMYSQL_PATH)$/lib 102cdf0e10cSrcweir MYSQL_INCDIR=$(LIBMYSQL_PATH)$/include 103cdf0e10cSrcweir .ENDIF 104cdf0e10cSrcweir.ENDIF 105cdf0e10cSrcweir 106cdf0e10cSrcweir.IF "$(SYSTEM_MYSQL)" == "YES" 107cdf0e10cSrcweirCFLAGS+=-DSYSTEM_MYSQL 108cdf0e10cSrcweir.ENDIF 109cdf0e10cSrcweir 110cdf0e10cSrcweir.IF "$(SYSTEM_MYSQL_CPPCONN)" == "YES" 111cdf0e10cSrcweirCFLAGS+=-DSYSTEM_MYSQL_CPPCONN 112cdf0e10cSrcweir.ENDIF 113cdf0e10cSrcweir 114cdf0e10cSrcweirCDEFS+=-DCPPDBC_EXPORTS -DCPPCONN_LIB_BUILD 115*24687b4cSJürgen Schmidt.IF "$(SYSTEM_MYSQL_CPPCONN)" == "YES" 116cdf0e10cSrcweirCDEFS += -DCPPCONN_LIB=\"$(shell readlink /usr/lib/libmysqlcppconn.so)\" 117cdf0e10cSrcweir.IF "$(USE_SYSTEM_STL)"!="YES" 118cdf0e10cSrcweirCDEFS += -DADAPT_EXT_STL 119cdf0e10cSrcweir.ENDIF 120cdf0e10cSrcweir.ENDIF 121cdf0e10cSrcweir 122cdf0e10cSrcweir# --------------- MySQL settings ------------------ 123*24687b4cSJürgen Schmidt.IF "$(GUI)"!="WNT" 124cdf0e10cSrcweir .IF "$(SYSTEM_MYSQL)" != "YES" 125cdf0e10cSrcweir MYSQL_INC+=-I$(MYSQL_INCDIR) 126cdf0e10cSrcweir .IF "$(OS)"=="MACOSX" 127cdf0e10cSrcweir MYSQL_LIBFILE=$(MYSQL_LIBDIR)$/$(DLLPRE)mysql.16$(DLLPOST) 128cdf0e10cSrcweir .ELSE 129cdf0e10cSrcweir MYSQL_LIBFILE=$(MYSQL_LIBDIR)$/$(DLLPRE)mysql$(DLLPOST).16 130cdf0e10cSrcweir .ENDIF 131cdf0e10cSrcweir 132cdf0e10cSrcweir # checkdll will complain if we do not point it to the libmysql lib 133cdf0e10cSrcweir EXTRALIBPATHS=-L$(MYSQL_LIBDIR) 134cdf0e10cSrcweir .ENDIF 135cdf0e10cSrcweir 136cdf0e10cSrcweir MYSQL_CPPCONN_LIB+=-lmysqlcppconn 137cdf0e10cSrcweir.ENDIF 138cdf0e10cSrcweir 139cdf0e10cSrcweirCFLAGS+=-I..$/..$/inc $(MYSQL_INC) \ 140cdf0e10cSrcweir -DMYSQLC_VERSION_MAJOR=$(MYSQLC_VERSION_MAJOR) \ 141cdf0e10cSrcweir -DMYSQLC_VERSION_MINOR=$(MYSQLC_VERSION_MINOR) \ 142cdf0e10cSrcweir -DMYSQLC_VERSION_MICRO=$(MYSQLC_VERSION_MICRO) \ 143cdf0e10cSrcweir $(MYSQL_DEFINES) 144cdf0e10cSrcweir 145cdf0e10cSrcweir# provide the name of the MySQL client lib to the C++ code 146cdf0e10cSrcweir.IF "$(SYSTEM_MYSQL)" != "YES" 147cdf0e10cSrcweirCDEFS += -DMYSQL_LIB=\"$(MYSQL_LIBFILE:f)\" 148cdf0e10cSrcweir.ENDIF 149cdf0e10cSrcweir 150cdf0e10cSrcweir#-------------------------------------------------- 151cdf0e10cSrcweir 152cdf0e10cSrcweirSHL1DLLPRE= 153cdf0e10cSrcweirSHL1TARGET=$(TARGET).uno 154cdf0e10cSrcweirLIB1TARGET=$(SLB)$/$(SHL1TARGET).lib 155cdf0e10cSrcweirLIB1OBJFILES= \ 156cdf0e10cSrcweir $(SLO)$/mysqlc_driver.obj \ 157cdf0e10cSrcweir $(SLO)$/mysqlc_services.obj \ 158cdf0e10cSrcweir $(SLO)$/mysqlc_connection.obj \ 159cdf0e10cSrcweir $(SLO)$/mysqlc_resultset.obj \ 160cdf0e10cSrcweir $(SLO)$/mysqlc_resultsetmetadata.obj \ 161cdf0e10cSrcweir $(SLO)$/mysqlc_statement.obj \ 162cdf0e10cSrcweir $(SLO)$/mysqlc_preparedstatement.obj \ 163cdf0e10cSrcweir $(SLO)$/mysqlc_databasemetadata.obj \ 164cdf0e10cSrcweir $(SLO)$/mysqlc_types.obj \ 165cdf0e10cSrcweir $(SLO)$/mysqlc_general.obj \ 166cdf0e10cSrcweir $(SLO)$/mysqlc_propertyids.obj 167cdf0e10cSrcweir 168cdf0e10cSrcweirSHL1STDLIBS= \ 169cdf0e10cSrcweir $(MYSQL_LIB) \ 170cdf0e10cSrcweir $(MYSQL_CPPCONN_LIB) \ 171cdf0e10cSrcweir $(CPPULIB) \ 172cdf0e10cSrcweir $(SALLIB) \ 173cdf0e10cSrcweir $(SALHELPERLIB) \ 174cdf0e10cSrcweir $(CPPUHELPERLIB) 175cdf0e10cSrcweir 176cdf0e10cSrcweirSHL1VERSIONMAP=$(TARGET).map 177cdf0e10cSrcweirSHL1LIBS= $(LIB1TARGET) 178cdf0e10cSrcweirSHL1DEF= $(MISC)$/$(SHL1TARGET).def 179cdf0e10cSrcweirSHL1RPATH=OXT 180cdf0e10cSrcweirDEF1NAME= $(SHL1TARGET) 181cdf0e10cSrcweir 182cdf0e10cSrcweir# create Extension ----------------------------- 183cdf0e10cSrcweir 184cdf0e10cSrcweir# DESCRIPTION_SRC is the source file which is copied into the extension 185cdf0e10cSrcweir# It is defaulted to "description.xml", but we want to pre-process it, so we use an intermediate 186cdf0e10cSrcweir# file 187cdf0e10cSrcweirDESCRIPTION_SRC = $(MISC)$/description.xml 188cdf0e10cSrcweir 189cdf0e10cSrcweirCOMPONENT_XCU=\ 190cdf0e10cSrcweir registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu 191cdf0e10cSrcweir 192cdf0e10cSrcweirCOMPONENT_MERGED_XCU= \ 193cdf0e10cSrcweir $(foreach,i,$(COMPONENT_XCU) $(EXTENSIONDIR)$/$i) 194cdf0e10cSrcweir 195cdf0e10cSrcweirCOMPONENT_LIBRARY = \ 196cdf0e10cSrcweir $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST) 197cdf0e10cSrcweir 198cdf0e10cSrcweirCOMPONENT_MYSQL_LIBFILE = \ 199cdf0e10cSrcweir $(EXTENSIONDIR)$/$(MYSQL_LIBFILE:f) 200cdf0e10cSrcweir 201cdf0e10cSrcweirCOMPONENT_MYSQL_CPPCONN_FILE=\ 202cdf0e10cSrcweir $(EXTENSIONDIR)$/$(MYSQL_CPPCONNFILE:f) 203cdf0e10cSrcweir 204cdf0e10cSrcweirCOMPONENT_LIBRARIES=\ 205cdf0e10cSrcweir $(COMPONENT_LIBRARY) 206cdf0e10cSrcweir 207cdf0e10cSrcweirCOMPONENT_IMAGES= \ 208cdf0e10cSrcweir $(EXTENSIONDIR)$/images$/extension_32.png \ 209cdf0e10cSrcweir $(EXTENSIONDIR)$/images$/extension_32_h.png 210cdf0e10cSrcweir 211cdf0e10cSrcweir 212cdf0e10cSrcweir# ........ component description ........ 213cdf0e10cSrcweir# one file for each WITH_LANG token 214cdf0e10cSrcweirDESC_LANGS=$(WITH_LANG) 215cdf0e10cSrcweir.IF "$(DESC_LANGS)" == "" 216cdf0e10cSrcweir DESC_LANGS=en-US 217cdf0e10cSrcweir.ENDIF 218cdf0e10cSrcweirCOMPONENT_DESCRIPTIONS=$/$(foreach,lang,$(DESC_LANGS) description$/description_$(lang).txt) 219cdf0e10cSrcweirCOMPONENT_DESCRIPTIONS_PACKDEP= \ 220cdf0e10cSrcweir $(foreach,i,$(COMPONENT_DESCRIPTIONS) $(EXTENSIONDIR)$/$i) 221cdf0e10cSrcweir 222cdf0e10cSrcweir# WITH_LANG might contain languages which we actually do not have a description for (yet) 223cdf0e10cSrcweir# Find those, and treat the specially 224cdf0e10cSrcweir 225cdf0e10cSrcweir# first, find those locales which we actually have a description file for 226cdf0e10cSrcweirEXISTING_DESCRIPTIONS=$(foreach,i,$(shell $(FIND) .$/description -name "description_*.txt") $(i:f)) 227cdf0e10cSrcweirEXISTING_LANGS=$(foreach,i,$(EXISTING_DESCRIPTIONS) $(i:s,description_,,:s,.txt,,)) 228cdf0e10cSrcweir 229cdf0e10cSrcweir# then, create a version of WITH_LANG where we stripped all those locales 230cdf0e10cSrcweirEXISTING_LANGS_NORMALIZED=$(strip $(EXISTING_LANGS)) 231cdf0e10cSrcweirEXISTING_LANGS_NORMALIZED:=+$(EXISTING_LANGS_NORMALIZED:s/ /+/)+ 232cdf0e10cSrcweirMISSING_LANGS=$(foreach,lang,$(WITH_LANG) $(eq,$(EXISTING_LANGS_NORMALIZED:s/+$(lang)+//),$(EXISTING_LANGS_NORMALIZED) $(lang) )) 233cdf0e10cSrcweir 234cdf0e10cSrcweir# ........ dependencies for packaging the extension ........ 235cdf0e10cSrcweirEXTENSION_PACKDEPS=makefile.mk $(COMPONENT_IMAGES) $(COMPONENT_DESCRIPTIONS_PACKDEP) $(COMPONENT_MERGED_XCU) 236cdf0e10cSrcweir 237cdf0e10cSrcweir.IF "$(SYSTEM_MYSQL)" != "YES" 238cdf0e10cSrcweirEXTENSION_PACKDEPS+=$(COMPONENT_MYSQL_LIBFILE) 239cdf0e10cSrcweir.ENDIF 240cdf0e10cSrcweir 241cdf0e10cSrcweir# --- Targets ------------------------------------------------------ 242cdf0e10cSrcweir.INCLUDE : extension_pre.mk 243cdf0e10cSrcweir.INCLUDE : target.mk 244cdf0e10cSrcweir.INCLUDE : extension_post.mk 245cdf0e10cSrcweir 246cdf0e10cSrcweir$(COMPONENT_IMAGES) : $(SOLARSRC)$/$(RSCDEFIMG)$/desktop$/res$/$$(@:f) 247cdf0e10cSrcweir @@-$(MKDIRHIER) $(@:d) 248cdf0e10cSrcweir $(COPY) $< $@ 249cdf0e10cSrcweir 250cdf0e10cSrcweir# existing descriptions: just copy 251cdf0e10cSrcweir$(EXTENSIONDIR)$/description$/%.txt: .$/description$/%.txt 252cdf0e10cSrcweir @@-$(MKDIRHIER) $(@:d) 253cdf0e10cSrcweir @$(COPY) $< $@ > $(NULLDEV) 254cdf0e10cSrcweir 255cdf0e10cSrcweir# xcu files: copy 256cdf0e10cSrcweir# the following is a hack for now - need to find out the generic mechanism later 257cdf0e10cSrcweir 258cdf0e10cSrcweir$(EXTENSIONDIR)$/registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu : .$/registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu 259cdf0e10cSrcweir @@-$(MKDIRHIER) $(EXTENSIONDIR)$/registry$/data$/org$/openoffice$/Office$/DataAccess 260cdf0e10cSrcweir @$(COPY) $< $(EXTENSIONDIR)$/registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu > $(NULLDEV) 261cdf0e10cSrcweir 262cdf0e10cSrcweir# The below doesn't work - it's completely beyond me .... $@ is some strange path when echoed, so the whole construct 263cdf0e10cSrcweir# doesn't work .... :( 264cdf0e10cSrcweir 265cdf0e10cSrcweir#$(foreach,i,$(COMPONENT_XCU) $(EXTENSIONDIR)$/$i : $i) 266cdf0e10cSrcweir# @echo ----------------- 267cdf0e10cSrcweir# @echo $@ 268cdf0e10cSrcweir# @echo $< 269cdf0e10cSrcweir# @echo ----------------- 270cdf0e10cSrcweir# -$(MKDIRHIER) $(@:d) 271cdf0e10cSrcweir# (COPY) $< $@ 272cdf0e10cSrcweir# @echo ----------------- 273cdf0e10cSrcweir 274cdf0e10cSrcweir# non-existing descriptions: copy from the English version 275cdf0e10cSrcweir.IF "$(strip $(MISSING_LANGS))" != "" 276cdf0e10cSrcweir$(foreach,i,$(MISSING_LANGS) $(EXTENSIONDIR)$/description$/description_$i.txt): .$/description$/description_en-US.txt 277cdf0e10cSrcweir @echo ------ WARNING: .$/description$/$(@:f) not found, falling back to English description 278cdf0e10cSrcweir @@-$(MKDIRHIER) $(@:d) 279cdf0e10cSrcweir @$(COPY) $< $@ > $(NULLDEV) 280cdf0e10cSrcweir.ENDIF 281cdf0e10cSrcweir 282cdf0e10cSrcweir$(DESCRIPTION_SRC): description.xml 283cdf0e10cSrcweir +-$(RM) $@ 284cdf0e10cSrcweir $(TYPE) description.xml | $(SED) "s/#VERSION#/$(EXTENSION_VERSION)/" | $(SED) "s,#TITLE#,$(EXTENSION_TITLE)," > $@ 285cdf0e10cSrcweir 286cdf0e10cSrcweir.IF "$(SYSTEM_MYSQL)" != "YES" 287cdf0e10cSrcweir# --- the MySQL client lib needs to be copied 288cdf0e10cSrcweir$(COMPONENT_MYSQL_LIBFILE): $(MYSQL_LIBFILE) 289cdf0e10cSrcweir @@-$(MKDIRHIER) $(@:d) 290cdf0e10cSrcweir @$(COPY) $< $@ > $(NULLDEV) 291cdf0e10cSrcweir .IF "$(OS)" == "MACOSX" 292cdf0e10cSrcweir install_name_tool -id @__________________________________________________OOO/$(MYSQL_LIBFILE:f) $@ 293cdf0e10cSrcweir .ENDIF 294cdf0e10cSrcweir.ENDIF 295cdf0e10cSrcweir 296cdf0e10cSrcweir.IF "$(OS)" == "MACOSX" 297cdf0e10cSrcweir$(EXTENSION_TARGET): adjust_libmysql_path 298cdf0e10cSrcweir 299cdf0e10cSrcweiradjust_libmysql_path: $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST) 300cdf0e10cSrcweir install_name_tool -change $(MYSQL_LIBFILE:f) @loader_path/$(MYSQL_LIBFILE:f) $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST) 301cdf0e10cSrcweir.ENDIF 302