xref: /trunk/main/solenv/inc/unxfbsd.mk (revision 7dd1299384489e9e0f00010dd91111c7b5abae84)
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
108# C++11 is the lowest supported standard (matches the macOS floor).  Our old
109# code base still uses constructs deprecated in C++11 (notably std::auto_ptr and
110# dynamic exception specifications); those remain valid until C++17 and are kept
111# non-fatal via -Wno-error= below.
112CFLAGSCXX= -pipe $(ARCH_FLAGS) -std=gnu++11
113.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
114CFLAGSCXX += -fvisibility-inlines-hidden
115.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
116
117.IF "$(CPUNAME)" == "INTEL" || "$(CPUNAME)" == "X86_64"
118CFLAGSCC += -fstack-protector
119CFLAGSCXX += -fstack-protector
120.ENDIF
121
122# Compiler flags for compiling static object in multi threaded environment with graphical user interface
123CFLAGSOBJGUIMT=
124# Compiler flags for compiling static object in multi threaded environment with character user interface
125CFLAGSOBJCUIMT=
126# Compiler flags for compiling shared object in multi threaded environment with graphical user interface
127CFLAGSSLOGUIMT=$(PICSWITCH)
128# Compiler flags for compiling shared object in multi threaded environment with character user interface
129CFLAGSSLOCUIMT=$(PICSWITCH)
130# Compiler flags for profiling
131CFLAGSPROF=
132# Compiler flags for debugging
133CFLAGSDEBUG=-g
134CFLAGSDBGUTIL=
135# Compiler flags for disabling optimizations
136CFLAGSNOOPT=-O0
137# Compiler flags for describing the output path
138CFLAGSOUTOBJ=-o
139
140# -Wshadow does not work for C with nested uses of pthread_cleanup_push:
141CFLAGSWARNCC=-Wall -Wextra -Wendif-labels
142CFLAGSWARNCXX=$(CFLAGSWARNCC) -Wshadow -Wno-ctor-dtor-privacy \
143    -Wno-non-virtual-dtor
144CFLAGSWALLCC=$(CFLAGSWARNCC)
145CFLAGSWALLCXX=$(CFLAGSWARNCXX)
146# Keep -Werror, but do not let the C++11 dialect's deprecation/narrowing
147# warnings (std::auto_ptr, dynamic exception specs, braced-init narrowing) break
148# the build.  Mirrors the macOS handling in unxmacc.mk.
149CFLAGSWERRCC=-Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=narrowing
150
151# Once all modules on this platform compile without warnings, set
152# COMPILER_WARN_ERRORS=TRUE here instead of setting MODULES_WITH_WARNINGS (see
153# settings.mk): Currently this is not tested on FreeBSD
154#MODULES_WITH_WARNINGS :=
155
156# switches for dynamic and static linking
157STATIC      = -Wl,-Bstatic
158DYNAMIC     = -Wl,-Bdynamic
159
160# name of linker
161LINK*=$(CXX)
162LINKC*=$(CC)
163
164# default linker flags
165.IF "$(SYSBASE)"!=""
166LINKFLAGS_SYSBASE:=-Wl,--sysroot=$(SYSBASE)
167.ENDIF          # "$(SYSBASE)"!=""
168LINKFLAGSDEFS*=-Wl,-z,defs
169LINKFLAGSRUNPATH_URELIB=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
170LINKFLAGSRUNPATH_UREBIN=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
171#LINKFLAGSRUNPATH_UREBIN=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN/../lib:$$ORIGIN'\'
172    #TODO: drop $ORIGIN once no URE executable is also shipped in OOo
173LINKFLAGSRUNPATH_OOO=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
174LINKFLAGSRUNPATH_SDK=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
175LINKFLAGSRUNPATH_BRAND=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
176#LINKFLAGSRUNPATH_OOO=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../ure-link/lib'\'
177#LINKFLAGSRUNPATH_SDK=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN/../../ure-link/lib'\'
178#LINKFLAGSRUNPATH_BRAND=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../basis-link/program:$$ORIGIN/../basis-link/ure-link/lib'\'
179LINKFLAGSRUNPATH_OXT=
180LINKFLAGSRUNPATH_BOXT=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN'\'
181#LINKFLAGSRUNPATH_BOXT=-Wl,-z,origin -Wl,-rpath,\''$$ORIGIN/../../../basis-link/program'\'
182LINKFLAGSRUNPATH_NONE=
183LINKFLAGS=-Wl,-z,combreloc $(LDFLAGS) $(LINKFLAGSDEFS) $(LINKFLAGS_SYSBASE)
184
185.IF "$(HAVE_LD_UNDEFINED_VERSION)" == "TRUE"
186LINKFLAGS += -Wl,--undefined-version
187.ENDIF
188
189# linker flags for linking applications
190LINKFLAGSAPPGUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
191      -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
192LINKFLAGSAPPCUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
193      -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
194
195# linker flags for linking shared libraries
196LINKFLAGSSHLGUI= -shared
197LINKFLAGSSHLCUI= -shared
198
199LINKFLAGSTACK=
200LINKFLAGSPROF=
201LINKFLAGSDEBUG=-g
202LINKFLAGSOPT=
203
204# linker flags for optimization (symbol hashtable)
205# for now, applied to symbol scoped libraries, only
206LINKFLAGSOPTIMIZE*=-Wl,-O1
207LINKVERSIONMAPFLAG=$(LINKFLAGSOPTIMIZE) -Wl,--version-script
208
209SONAME_SWITCH=-Wl,-h
210
211# Sequence of libs does matter !
212
213STDLIBCPP=-lstdc++
214
215# default objectfilenames to link
216STDOBJVCL=$(L)$/salmain.o
217STDOBJGUI=
218STDSLOGUI=
219STDOBJCUI=
220STDSLOCUI=
221
222.IF "$(ALLOC)" == "TCMALLOC"
223STDLIBGUIMT+=-ltcmalloc
224STDLIBCUIMT+=-ltcmalloc
225STDSHLGUIMT+=-ltcmalloc
226STDSHLCUIMT+=-ltcmalloc
227.ENDIF
228
229# libraries for linking applications
230STDLIBGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
231STDLIBCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
232# libraries for linking shared libraries
233STDSHLGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
234STDSHLCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH}
235
236X11LINK_DYNAMIC = -Wl,--as-needed -lXext -lX11 -Wl,--no-as-needed
237
238LIBSALCPPRT*=-Wl,--whole-archive -lsalcpprt -Wl,--no-whole-archive
239
240.IF "$(USE_STLP_DEBUG)" != ""
241.IF "$(STLPORT_VER)" >= "500"
242LIBSTLPORT=$(DYNAMIC) -lstlportstlg
243LIBSTLPORTST=$(STATIC) -lstlportstlg $(DYNAMIC)
244.ELSE
245LIBSTLPORT=$(DYNAMIC) -lstlport_gcc_stldebug
246LIBSTLPORTST=$(STATIC) -lstlport_gcc_stldebug $(DYNAMIC)
247.ENDIF
248.ELSE # "$(USE_STLP_DEBUG)" != ""
249.IF "$(STLPORT_VER)" >= "500"
250LIBSTLPORT=$(DYNAMIC) -lstlport
251LIBSTLPORTST=$(STATIC) -lstlport $(DYNAMIC)
252.ELSE
253LIBSTLPORT=$(DYNAMIC) -lstlport_gcc
254LIBSTLPORTST=$(STATIC) -lstlport_gcc $(DYNAMIC)
255.ENDIF
256.ENDIF # "$(USE_STLP_DEBUG)" != ""
257
258#FILLUPARC=$(STATIC) -lsupc++ $(DYNAMIC)
259
260# name of library manager
261LIBMGR=ar
262LIBFLAGS=-r
263
264# tool for generating import libraries
265IMPLIB=
266IMPLIBFLAGS=
267
268MAPSYM=
269MAPSYMFLAGS=
270
271RC=irc
272RCFLAGS=-fo$@ $(RCFILES)
273RCLINK=
274RCLINKFLAGS=
275RCSETVERSION=
276
277# platform specific identifier for shared libs
278DLLPRE=lib
279DLLPOST=.so
280PCHPOST=.gch
281