xref: /trunk/main/solenv/inc/unxfbsd.mk (revision 5a812352)
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
23
24# Makefile for FreeBSD.
25
26ASM=
27AFLAGS=
28
29SOLAR_JAVA*=
30PICSWITCH*:=-fPIC
31JAVAFLAGSDEBUG=-g
32
33# Include arch specific makefile.
34.IF "$(CPUNAME)" == "INTEL"
35.INCLUDE : unxfbsdi.mk
36.ENDIF
37.IF "$(CPUNAME)" == "X86_64"
38.INCLUDE : unxfbsdx.mk
39.ENDIF
40.IF "$(CPUNAME)" == "POWERPC64"
41.INCLUDE : unxfbsdppc64.mk
42.ENDIF
43.IF "$(CPUNAME)" == "POWERPC"
44.INCLUDE : unxfbsdppc.mk
45.ENDIF
46.IF "$(CPUNAME)" == "ARM"
47.INCLUDE : unxfbsdr.mk
48.ENDIF
49
50# filter for suppressing verbose messages from linker
51#not needed at the moment
52#LINKOUTPUT_FILTER=" |& $(SOLARENV)/bin/msg_filter"
53
54# _PTHREADS is needed for the stl
55CDEFS+=$(PTHREAD_CFLAGS) -D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1 -DSTLPORT_VERSION=450
56.IF "$(COM)"=="CLANG"
57CDEFS+=-DHAVE_STL_INCLUDE_PATH
58.ELSE
59CDEFS+=-DBOOST_TR1_DISABLE_INCLUDE_NEXT -DBOOST_TR1_GCC_INCLUDE_PATH=c++
60.ENDIF
61
62# enable visibility define in "sal/types.h"
63.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
64CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
65.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
66
67# this is a platform with JAVA support
68.IF "$(SOLAR_JAVA)"!=""
69JAVADEF=-DSOLAR_JAVA
70.IF "$(debug)"==""
71JAVA_RUNTIME=-ljava
72.ELSE
73JAVA_RUNTIME=-ljava_g
74.ENDIF
75.ENDIF
76
77# name of C++ Compiler
78CXX*=c++
79# name of C Compiler
80CC*=cc
81.IF "$(SYSBASE)"!=""
82CFLAGS_SYSBASE:=--sysroot=$(SYSBASE)
83CXX+:=$(CFLAGS_SYSBASE)
84CC+:=$(CFLAGS_SYSBASE)
85.ENDIF          # "$(SYSBASE)"!=""
86CFLAGS+=-fmessage-length=0 -c
87
88# flags to enable build with symbols; required for crashdump feature
89.IF "$(ENABLE_SYMBOLS)"=="SMALL"
90CFLAGSENABLESYMBOLS=-g1
91.ELSE
92CFLAGSENABLESYMBOLS=-g # was temporarily commented out, reenabled before Beta
93
94.ENDIF
95
96# flags for the C++ Compiler
97CFLAGSCC= -pipe $(ARCH_FLAGS)
98# Flags for enabling exception handling
99.IF "$(COM)"=="CLANG"
100CFLAGSEXCEPTIONS=-fexceptions
101.ELSE
102CFLAGSEXCEPTIONS=-fexceptions -fno-enforce-eh-specs
103.ENDIF
104# Flags for disabling exception handling
105CFLAGS_NO_EXCEPTIONS=-fno-exceptions
106
107# -fpermissive should be removed as soon as possible
108CFLAGSCXX= -pipe $(ARCH_FLAGS)
109.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
110CFLAGSCXX += -fvisibility-inlines-hidden
111.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
112
113# Compiler flags for compiling static object in multi threaded environment with graphical user interface
114CFLAGSOBJGUIMT=
115# Compiler flags for compiling static object in multi threaded environment with character user interface
116CFLAGSOBJCUIMT=
117# Compiler flags for compiling shared object in multi threaded environment with graphical user interface
118CFLAGSSLOGUIMT=$(PICSWITCH)
119# Compiler flags for compiling shared object in multi threaded environment with character user interface
120CFLAGSSLOCUIMT=$(PICSWITCH)
121# Compiler flags for profiling
122CFLAGSPROF=
123# Compiler flags for debugging
124CFLAGSDEBUG=-g
125CFLAGSDBGUTIL=
126# Compiler flags for disabling optimizations
127CFLAGSNOOPT=-O0
128# Compiler flags for describing the output path
129CFLAGSOUTOBJ=-o
130
131# -Wshadow does not work for C with nested uses of pthread_cleanup_push:
132CFLAGSWARNCC=-Wall -Wextra -Wendif-labels
133CFLAGSWARNCXX=$(CFLAGSWARNCC) -Wshadow -Wno-ctor-dtor-privacy \
134    -Wno-non-virtual-dtor
135CFLAGSWALLCC=$(CFLAGSWARNCC)
136CFLAGSWALLCXX=$(CFLAGSWARNCXX)
137CFLAGSWERRCC=-Werror
138
139# Once all modules on this platform compile without warnings, set
140# COMPILER_WARN_ERRORS=TRUE here instead of setting MODULES_WITH_WARNINGS (see
141# settings.mk): Currently this is not tested on FreeBSD
142#MODULES_WITH_WARNINGS :=
143
144# switches for dynamic and static linking
145STATIC		= -Wl,-Bstatic
146DYNAMIC		= -Wl,-Bdynamic
147
148# name of linker
149LINK*=$(CXX)
150LINKC*=$(CC)
151
152# default linker flags
153.IF "$(SYSBASE)"!=""
154LINKFLAGS_SYSBASE:=-Wl,--sysroot=$(SYSBASE)
155.ENDIF          # "$(SYSBASE)"!=""
156LINKFLAGSDEFS*=-Wl,-z,defs
157LINKFLAGSRUNPATH_URELIB=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
158LINKFLAGSRUNPATH_UREBIN=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
159#LINKFLAGSRUNPATH_UREBIN=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN/../lib:$$ORIGIN'\'
160    #TODO: drop $ORIGIN once no URE executable is also shipped in OOo
161LINKFLAGSRUNPATH_OOO=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
162LINKFLAGSRUNPATH_SDK=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
163LINKFLAGSRUNPATH_BRAND=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
164#LINKFLAGSRUNPATH_OOO=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../ure-link/lib'\'
165#LINKFLAGSRUNPATH_SDK=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN/../../ure-link/lib'\'
166#LINKFLAGSRUNPATH_BRAND=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../basis-link/program:$$ORIGIN/../basis-link/ure-link/lib'\'
167LINKFLAGSRUNPATH_OXT=
168LINKFLAGSRUNPATH_BOXT=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
169#LINKFLAGSRUNPATH_BOXT=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN/../../../basis-link/program'\'
170LINKFLAGSRUNPATH_NONE=
171LINKFLAGS=-Wl,-z,combreloc $(LDFLAGS) $(LINKFLAGSDEFS) $(LINKFLAGS_SYSBASE)
172
173# linker flags for linking applications
174LINKFLAGSAPPGUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
175      -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
176LINKFLAGSAPPCUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
177      -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
178
179# linker flags for linking shared libraries
180LINKFLAGSSHLGUI= -shared
181LINKFLAGSSHLCUI= -shared
182
183LINKFLAGSTACK=
184LINKFLAGSPROF=
185LINKFLAGSDEBUG=-g
186LINKFLAGSOPT=
187
188# linker flags for optimization (symbol hashtable)
189# for now, applied to symbol scoped libraries, only
190LINKFLAGSOPTIMIZE*=-Wl,-O1
191LINKVERSIONMAPFLAG=$(LINKFLAGSOPTIMIZE) -Wl,--version-script
192
193SONAME_SWITCH=-Wl,-h
194
195# Sequence of libs does matter !
196
197STDLIBCPP=-lstdc++
198
199# default objectfilenames to link
200STDOBJVCL=$(L)$/salmain.o
201STDOBJGUI=
202STDSLOGUI=
203STDOBJCUI=
204STDSLOCUI=
205
206.IF "$(ALLOC)" == "TCMALLOC"
207STDLIBGUIMT+=-ltcmalloc
208STDLIBCUIMT+=-ltcmalloc
209STDSHLGUIMT+=-ltcmalloc
210STDSHLCUIMT+=-ltcmalloc
211.ENDIF
212
213# libraries for linking applications
214STDLIBGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
215STDLIBCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
216# libraries for linking shared libraries
217STDSHLGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
218STDSHLCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
219
220X11LINK_DYNAMIC = -Wl,--as-needed -lXext -lX11 -Wl,--no-as-needed
221
222LIBSALCPPRT*=-Wl,--whole-archive -lsalcpprt -Wl,--no-whole-archive
223
224.IF "$(USE_STLP_DEBUG)" != ""
225.IF "$(STLPORT_VER)" >= "500"
226LIBSTLPORT=$(DYNAMIC) -lstlportstlg
227LIBSTLPORTST=$(STATIC) -lstlportstlg $(DYNAMIC)
228.ELSE
229LIBSTLPORT=$(DYNAMIC) -lstlport_gcc_stldebug
230LIBSTLPORTST=$(STATIC) -lstlport_gcc_stldebug $(DYNAMIC)
231.ENDIF
232.ELSE # "$(USE_STLP_DEBUG)" != ""
233.IF "$(STLPORT_VER)" >= "500"
234LIBSTLPORT=$(DYNAMIC) -lstlport
235LIBSTLPORTST=$(STATIC) -lstlport $(DYNAMIC)
236.ELSE
237LIBSTLPORT=$(DYNAMIC) -lstlport_gcc
238LIBSTLPORTST=$(STATIC) -lstlport_gcc $(DYNAMIC)
239.ENDIF
240.ENDIF # "$(USE_STLP_DEBUG)" != ""
241
242#FILLUPARC=$(STATIC) -lsupc++ $(DYNAMIC)
243
244# name of library manager
245LIBMGR=ar
246LIBFLAGS=-r
247
248# tool for generating import libraries
249IMPLIB=
250IMPLIBFLAGS=
251
252MAPSYM=
253MAPSYMFLAGS=
254
255RC=irc
256RCFLAGS=-fo$@ $(RCFILES)
257RCLINK=
258RCLINKFLAGS=
259RCSETVERSION=
260
261# platform specific identifier for shared libs
262DLLPRE=lib
263DLLPOST=.so
264PCHPOST=.gch
265