2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 # Global settings file for the minimal build environment of the SDK
20 # This file have to updated/extended for other platforms.
22 include $(OO_SDK_HOME
)/settings
/dk.mk
24 # test for the platform
25 PLATFORM
:= $(shell $(PRJ
)/config.guess | cut
-d
"-" -f3
,4)
27 # config.guess is missing for windows. We rely on getting "" in this case.
32 # debug option, default is no debug
34 ifeq "$(MAKECMDGOALS)" "debug"
38 ###########################################################################
42 ###########################################################################
51 ###########################################################################
53 # Windows specific settings
55 ###########################################################################
56 ifeq "$(PLATFORM)" "windows"
57 # Settings for Windows using Microsoft compiler/linker
73 SHAREDLIB_OUT
=$(OUT_BIN
)
74 UNOPKG_PLATFORM
=Windows
90 CPPUHELPERLIB
=icppuhelper.lib
91 SALHELPERLIB
=isalhelper.lib
92 PURPENVHELPERLIB
=ipurpenvhelper.lib
98 ifeq "$(LIBO_SDK_ENABLE_DBGUTIL)" "TRUE"
99 LIBO_SDK_DETAIL_CFLAGS_MSVCRT
= -MDd
100 LIBO_SDK_DETAIL_LDFLAGS_MSVCRT
= msvcrtd.lib
102 LIBO_SDK_DETAIL_CFLAGS_MSVCRT
= -MD
103 LIBO_SDK_DETAIL_LDFLAGS_MSVCRT
= msvcrt.lib
106 # use this for release version
107 ifeq "$(DEBUG)" "yes"
110 CC_FLAGS_JNI
=-c
$(LIBO_SDK_DETAIL_CFLAGS_MSVCRT
) -Zm500
-Zc
:wchar_t-
-wd4251
-wd4275
-wd4290
-wd4675
-wd4786
-wd4800
-GR
-EHa
$(OPT_FLAGS
)
111 CC_FLAGS
=-c
$(LIBO_SDK_DETAIL_CFLAGS_MSVCRT
) -Zm500
-Zc
:wchar_t-
-wd4251
-wd4275
-wd4290
-wd4675
-wd4786
-wd4800
-GR
-EHa
$(OPT_FLAGS
)
112 ifeq "$(CPP_MANIFEST)" "true"
113 LINK_MANIFEST
=mt
-manifest
$@.manifest
"-outputresource:$@;2"
118 CC_INCLUDES
=-I.
-I
$(OUT
)/inc
-I
$(OUT
)/inc
/examples
-I
$(PRJ
)/include
119 SDK_JAVA_INCLUDES
= -I
"$(OO_SDK_JAVA_HOME)/include" -I
"$(OO_SDK_JAVA_HOME)/include/win32"
121 # define for used compiler necessary for UNO
122 # -DCPPU_ENV=msci -- windows msvc 4.x - 7.x
124 CC_DEFINES_JNI
=-DWIN32
-DWNT
-D_DLL
-DCPPU_ENV
=msci
125 CC_DEFINES
=-DWIN32
-DWNT
-D_DLL
-DCPPU_ENV
=msci
128 LIBO_SDK_LDFLAGS_STDLIBS
= $(LIBO_SDK_DETAIL_LDFLAGS_MSVCRT
) kernel32.lib
130 LIBRARY_LINK_FLAGS
=/DLL
/DEBUGTYPE
:cv
131 COMP_LINK_FLAGS
=$(LIBRARY_LINK_FLAGS
) /DEF
:$(PRJ
)/settings
/component.uno.def
132 EXE_LINK_FLAGS
=/MAP
/OPT
:NOREF
/SUBSYSTEM
:CONSOLE
/BASE
:0x1b000000 /DEBUGTYPE
:cv
$(LIBO_SDK_LDFLAGS_STDLIBS
)
133 ifeq "$(DEBUG)" "yes"
134 LIBRARY_LINK_FLAGS
+=/DEBUG
135 EXE_LINK_FLAGS
+=/DEBUG
138 LINK_JAVA_LIBS
=/LIBPATH
:"$(OO_SDK_JAVA_HOME)/lib"
140 ifneq "$(OO_SDK_URE_HOME)" ""
141 URE_MISC
=$(OO_SDK_URE_HOME
)\misc
144 # use this for release version
145 #EXE_LINK_FLAGS=/MAP /OPT:NOREF /SUBSYSTEM:CONSOLE /BASE:0x1100000
146 #LIBRARY_LINK_FLAGS=/DLL
151 ###########################################################################
153 # Solaris specific settings
155 ###########################################################################
156 ifneq (,$(findstring solaris
,$(PLATFORM
)))
157 # Settings for Solaris using Sun Workshop compiler
159 PROCTYPE
:= $(shell $(PRJ
)/config.guess | cut
-d
"-" -f1
)$(shell /usr
/ccs
/bin
/elfdump
-e
"$(OO_SDK_URE_HOME)/lib/libuno_sal.so.3" |
/usr
/xpg4
/bin
/grep
-q
-w ELFCLASS64
&& echo
64)
161 ifeq "$(PROCTYPE)" "sparc"
163 UNOPKG_PLATFORM
=Solaris_SPARC
166 ifeq "$(PROCTYPE)" "sparc64"
168 UNOPKG_PLATFORM
=Solaris_SPARC64
169 JAVA_PROC_TYPE
=sparcv9
172 UNOPKG_PLATFORM
=Solaris_x86
189 SHAREDLIB_OUT
=$(OUT_LIB
)
209 #CPPUHELPERLIB=-luno_cppuhelperC52
210 #SALHELPERLIB=-luno_salhelperC52
213 CPPUHELPERLIB=-luno_cppuhelper$(COMID)
214 SALHELPERLIB=-luno_salhelper$(COMID)
215 PURPENVHELPERLIB=-luno_purpenvhelper$(COMID)
220 ifeq "$(DEBUG)" "yes"
223 #CC_FLAGS_JNI=-c -KPIC $(OPT_FLAGS)
224 #CC_FLAGS=-c -KPIC -xldscope=hidden $(OPT_FLAGS)
225 CC_FLAGS_JNI=-c -fpic $(OPT_FLAGS)
226 CC_FLAGS=-c -fpic -fvisibility=hidden $(OPT_FLAGS)
227 CC_INCLUDES=-I. -I$(OUT)/inc -I$(OUT)/inc/examples -I$(PRJ)/include
228 SDK_JAVA_INCLUDES = -I"$(OO_SDK_JAVA_HOME)/include" -I"$(OO_SDK_JAVA_HOME)/include/solaris"
230 # define for used compiler necessary for UNO
231 # -DCPPU_ENV=sunpro5 -- sunpro cc 5.x solaris sparc/intel
233 #CC_DEFINES_JNI=-DUNX -DSOLARIS -DCPPU_ENV=sunpro5
234 CC_DEFINES_JNI=-DUNX -DSOLARIS -DCPPU_ENV=$(CPPU_ENV) -DGCC
235 #CC_DEFINES=-DUNX -DSOLARIS -DSPARC -DCPPU_ENV=sunpro5 -DHAVE_GCC_VISIBILITY_FEATURE
236 CC_DEFINES=-DUNX -DSOLARIS -DSPARC -DCPPU_ENV=$(CPPU_ENV) -DHAVE_GCC_VISIBILITY_FEATURE -DGCC
239 LIBO_SDK_LDFLAGS_STDLIBS =
241 #LIBRARY_LINK_FLAGS=-w -mt -z combreloc -PIC -temp=/tmp '-R
$$ORIGIN' -z text -norunpath -G -Bdirect -Bdynamic -lpthread -lCrun -lc -lm
242 LIBRARY_LINK_FLAGS=-w -mt -z combreloc -fPIC -PIC -temp=/tmp '-R
$$ORIGIN' -z text -norunpath -G -Bdirect -Bdynamic -lpthread -lCrun -lc -lm
243 # means if used CC is lower then version 5.5 use option -instance=static
244 ifeq ($(OO_SDK_CC_55_OR_HIGHER),)
245 LIBRARY_LINK_FLAGS+=-instances=static
247 COMP_LINK_FLAGS=$(LIBRARY_LINK_FLAGS)
249 EXE_LINK_FLAGS=-w -mt -z combreloc -PIC -temp=/tmp -norunpath -Bdirect -z defs
250 LINK_LIBS=-L"$(OUT)/lib" -L"$(OO_SDK_HOME)/lib" -L"$(OO_SDK_URE_LIB_DIR)"
251 LINK_JAVA_LIBS=-L"$(OO_SDK_JAVA_HOME)/jre/lib/$(JAVA_PROC_TYPE)"
253 ifeq "$(PROCTYPE)" "sparc64"
255 LIBRARY_LINK_FLAGS+=-m64
259 ifneq "$(OO_SDK_URE_HOME)" ""
260 URE_MISC=$(OO_SDK_URE_HOME)/share/misc
267 ###########################################################################
269 # Linux specific settings
271 ###########################################################################
272 ifneq (,$(findstring linux,$(PLATFORM)))
273 # Settings for Linux using gcc compiler
275 PROCTYPE := $(shell $(PRJ)/config.guess | cut -d "-" -f1 | sed -e 's
/^i
.86$$/i386
/')
278 UNOPKG_PLATFORM=Linux_$(PROCTYPE)
279 JAVA_PROC_TYPE=$(PROCTYPE)
281 ifeq "$(PROCTYPE)" "i386"
282 UNOPKG_PLATFORM=Linux_x86
286 ifeq "$(PROCTYPE)" "powerpc"
287 UNOPKG_PLATFORM=Linux_PowerPC
291 ifeq "$(PROCTYPE)" "sparc"
292 UNOPKG_PLATFORM=Linux_SPARC
296 ifeq "$(PROCTYPE)" "x86_64"
300 ifeq "$(PROCTYPE)" "powerpc64"
316 SHAREDLIB_OUT=$(OUT_LIB)
318 GCC_VERSION=$(shell $(CC) -dumpversion)
338 CPPUHELPERLIB
=-luno_cppuhelper
$(COMID
)
339 SALHELPERLIB
=-luno_salhelper
$(COMID
)
340 PURPENVHELPERLIB
=-luno_purpenvhelper
$(COMID
)
345 # -O is necessary for inlining (see gcc documentation)
346 ifeq "$(DEBUG)" "yes"
351 CC_FLAGS_JNI
=-c
-fpic
$(OPT_FLAGS
)
352 CC_FLAGS
=-c
-fpic
-fvisibility
=hidden
$(OPT_FLAGS
)
354 ifeq "$(PROCTYPE)" "ppc"
358 SDK_JAVA_INCLUDES
= -I
"$(OO_SDK_JAVA_HOME)/include" -I
"$(OO_SDK_JAVA_HOME)/include/linux"
359 CC_INCLUDES
=-I.
-I
$(OUT
)/inc
-I
$(OUT
)/inc
/examples
-I
$(PRJ
)/include
360 CC_DEFINES_JNI
=-DUNX
-DGCC
-DLINUX
-DCPPU_ENV
=$(CPPU_ENV
)
361 CC_DEFINES
=-DUNX
-DGCC
-DLINUX
-DCPPU_ENV
=$(CPPU_ENV
) -DHAVE_GCC_VISIBILITY_FEATURE
365 LIBO_SDK_LDFLAGS_STDLIBS
=
367 LIBRARY_LINK_FLAGS
=-shared
-Wl
,-z
,origin '-Wl,-rpath,$$ORIGIN'
369 ifeq "$(PROCTYPE)" "ppc"
370 LIBRARY_LINK_FLAGS
+=-fPIC
372 COMP_LINK_FLAGS
=$(LIBRARY_LINK_FLAGS
)
374 EXE_LINK_FLAGS
=-Wl
,--allow-shlib-undefined
-Wl
,-export-dynamic
-Wl
,-z
,defs
-Wl
,--no-whole-archive
375 LINK_LIBS
=-L
"$(OUT)/lib" -L
"$(OO_SDK_HOME)/lib" -L
"$(OO_SDK_URE_LIB_DIR)"
376 LINK_JAVA_LIBS
=-L
"$(OO_SDK_JAVA_HOME)/jre/lib/$(JAVA_PROC_TYPE)"
378 ifneq "$(OO_SDK_URE_HOME)" ""
379 URE_MISC
=$(OO_SDK_URE_HOME
)/share
/misc
384 ###########################################################################
386 # MacOSX/Darwin specific settings
388 ###########################################################################
389 ifneq (,$(findstring darwin
,$(PLATFORM
)))
390 # Settings for MacOSX using gcc 4.0.1 compiler
392 PROCTYPE
:= $(shell $(PRJ
)/config.guess | cut
-d
"-" -f1
)
394 # Default is MacOSX on a Intel machine
397 ifeq "$(PROCTYPE)" "i386"
398 UNOPKG_PLATFORM
=MacOSX_x86
401 ifeq "$(PROCTYPE)" "x86_64"
402 UNOPKG_PLATFORM
=MacOSX_x86
408 GCC_VERSION
=$(shell gcc
-dumpversion| cut
-d
"." -f1
,2)
409 ifeq "$(GCC_VERSION)" "4.2"
410 GCC_ARCH_OPTION
=-arch i386
416 CC
=gcc-
$(GCC_VERSION
)
417 LINK
=g
++-$(GCC_VERSION
)
418 LIB
=g
++-$(GCC_VERSION
)
425 SHAREDLIB_OUT
=$(OUT_LIB
)
445 CPPUHELPERLIB=-luno_cppuhelper$(COMID)
446 SALHELPERLIB=-luno_salhelper$(COMID)
447 PURPENVHELPERLIB=-luno_purpenvhelper$(COMID)
449 INSTALL_NAME_URELIBS=$(XCRUN) install_name_tool -change @__________________________________________________URELIB/libuno_sal.dylib.3 @executable_path/urelibs/libuno_sal.dylib.3 -change @__________________________________________________URELIB/libuno_cppu.dylib.3 @executable_path/urelibs/libuno_cppu.dylib.3 -change @__________________________________________________URELIB/libuno_cppuhelper$(COMID).dylib.3 @executable_path/urelibs/libuno_cppuhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libuno_salhelper$(COMID).dylib.3 @executable_path/urelibs/libuno_salhelper$(COMID).dylib.3
451 INSTALL_NAME_URELIBS_BIN=$(XCRUN) install_name_tool -change @__________________________________________________URELIB/libuno_sal.dylib.3 libuno_sal.dylib.3 -change @__________________________________________________URELIB/libuno_cppu.dylib.3 libuno_cppu.dylib.3 -change @__________________________________________________URELIB/libuno_cppuhelper$(COMID).dylib.3 libuno_cppuhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libuno_salhelper$(COMID).dylib.3 libuno_salhelper$(COMID).dylib.3
456 # -O is necessary for inlining (see gcc documentation)
457 ifeq "$(DEBUG)" "yes"
462 CC_FLAGS_JNI=-malign-natural -c -fPIC -fno-common $(GCC_ARCH_OPTION) $(OPT_FLAGS)
463 CC_FLAGS=-malign-natural -c -fPIC -fno-common $(GCC_ARCH_OPTION) -fvisibility=hidden $(OPT_FLAGS)
465 SDK_JAVA_INCLUDES = -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -I/System/Library/Frameworks/JavaVM.framework/Headers
466 CC_INCLUDES=-I. -I$(OUT)/inc -I$(OUT)/inc/examples -I$(PRJ)/include
467 CC_DEFINES_JNI=-DUNX -DGCC -DMACOSX -DCPPU_ENV=$(CPPU_ENV)
468 CC_DEFINES=-DUNX -DGCC -DMACOSX -DCPPU_ENV=$(CPPU_ENV) -DHAVE_GCC_VISIBILITY_FEATURE
472 LIBO_SDK_LDFLAGS_STDLIBS =
474 LIBRARY_LINK_FLAGS=-dynamiclib -single_module -Wl,-multiply_defined,suppress $(GCC_ARCH_OPTION)
476 # install_name '@executable_path
$/(@
:f
)'
477 COMP_LINK_FLAGS=$(LIBRARY_LINK_FLAGS)
479 EXE_LINK_FLAGS=$(GCC_ARCH_OPTION) -Wl,-multiply_defined,suppress
480 LINK_LIBS=-L$(OUT)/lib -L$(OO_SDK_OUT)/$(PLATFORM)/lib -L"$(OO_SDK_URE_LIB_DIR)"
481 LINK_JAVA_LIBS=-framework JavaVM
483 ifneq "$(OO_SDK_URE_HOME)" ""
484 URE_MISC=$(OO_SDK_URE_HOME)/share/misc
489 ###########################################################################
491 # FreeBSD specific settings
493 ###########################################################################
494 ifneq (,$(findstring freebsd,$(PLATFORM)))
495 # Settings for FreeBSD using gcc compiler
497 PROCTYPE := $(shell $(PRJ)/config.guess | cut -d"-" -f1)
499 ifeq (kfreebsd,$(findstring kfreebsd,$(PLATFORM)))
501 ifeq "$(PROCTYPE)" "x86_64"
502 UNOPKG_PLATFORM=kFreeBSD_x86_64
504 UNOPKG_PLATFORM=kFreeBSD_x86
508 ifeq "$(PROCTYPE)" "x86_64"
509 UNOPKG_PLATFORM=FreeBSD_x86_64
511 UNOPKG_PLATFORM=FreeBSD_x86
515 ifeq "$(PROCTYPE)" "x86_64"
521 ifeq (kfreebsd,$(findstring kfreebsd,$(PLATFORM)))
537 SHAREDLIB_OUT=$(OUT_LIB)
539 GCC_VERSION=$(shell $(CC) -dumpversion)
559 CPPUHELPERLIB
=-luno_cppuhelper
$(COMID
)
560 SALHELPERLIB
=-luno_salhelper
$(COMID
)
561 PURPENVHELPERLIB
=-luno_purpenvhelper
$(COMID
)
566 # -O is necessary for inlining (see gcc documentation)
567 ifeq "$(DEBUG)" "yes"
572 CC_FLAGS_JNI
=-c
-g
-fPIC
-DPIC
$(PTHREAD_CFLAGS
) $(OPT_FLAGS
)
573 CC_FLAGS
=-c
-g
-fPIC
-DPIC
$(PTHREAD_CFLAGS
) -fvisibility
=hidden
$(OPT_FLAGS
)
575 SDK_JAVA_INCLUDES
= -I
"$(OO_SDK_JAVA_HOME)/include" -I
"$(OO_SDK_JAVA_HOME)/include/freebsd"
576 CC_INCLUDES
=-I.
-I
$(OUT
)/inc
-I
$(OUT
)/inc
/examples
-I
$(PRJ
)/include
577 CC_DEFINES_JNI
=-DUNX
-DGCC
-DFREEBSD
-DCPPU_ENV
=$(CPPU_ENV
)
578 CC_DEFINES
=-DUNX
-DGCC
-DFREEBSD
-DCPPU_ENV
=$(CPPU_ENV
) -DHAVE_GCC_VISIBILITY_FEATURE
582 LIBO_SDK_LDFLAGS_STDLIBS
=
584 LIBRARY_LINK_FLAGS
=-shared
-Wl
,-z
,origin '-Wl,-rpath,$$ORIGIN'
585 COMP_LINK_FLAGS
=$(LIBRARY_LINK_FLAGS
)
587 EXE_LINK_FLAGS
=-Wl
,--allow-shlib-undefined
588 LINK_LIBS
=-L
"$(OUT)/lib" -L
"$(OO_SDK_HOME)/lib" -L
"$(OO_SDK_URE_LIB_DIR)" $(PTHREAD_LIBS
)
589 LINK_JAVA_LIBS
=-L
"$(OO_SDK_JAVA_HOME)/jre/lib/$(JAVA_PROC_TYPE)"
591 ifneq "$(OO_SDK_URE_HOME)" ""
592 URE_MISC
=$(OO_SDK_URE_HOME
)/share
/misc