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