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