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