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 24GUI := UNX 25COM := C52 26 27gb_MKTEMP := mktemp -t gbuild.XXXXXX 28 29gb_CC := cc 30gb_CXX := CC 31gb_GCCP := cc 32gb_AR := ar 33gb_AWK := /usr/xpg4/bin/awk 34gb_CLASSPATHSEP := : 35 36# use CC/CXX if they are nondefaults 37ifneq ($(origin CC),default) 38gb_CC := $(CC) 39gb_GCCP := $(CC) 40endif 41ifneq ($(origin CXX),default) 42gb_CXX := $(CXX) 43endif 44 45gb_OSDEFS := \ 46 -D$(OS) \ 47 -D$(GUI) \ 48 -DSYSV \ 49 -DSUN \ 50 -DSUN4 \ 51 -D_REENTRANT \ 52 -D_POSIX_PTHREAD_SEMANTICS \ 53 -D_PTHREADS \ 54 -DUNIX \ 55 56gb_COMPILERDEFS := \ 57 -D$(COM) \ 58 -DCPPU_ENV=sunpro5 \ 59 60gb_CPUDEFS := -D$(CPUNAME) 61ifeq ($(CPUNAME),SPARC) 62gb_CPUDEFS += -D__sparcv8plus 63endif 64 65gb_CFLAGS := \ 66 -temp=/tmp \ 67 -KPIC \ 68 -mt \ 69 -xldscope=hidden \ 70 -xCC \ 71 -xc99=none \ 72 73gb_CXXFLAGS := \ 74 -temp=/tmp \ 75 -KPIC \ 76 -mt \ 77 -xldscope=hidden \ 78 -features=no%altspell \ 79 -library=no%Cstd \ 80 +w2 \ 81 -erroff=doubunder,identexpected,inllargeuse,inllargeint,notemsource,reftotemp,truncwarn,wnoretvalue,anonnotype \ 82 83ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) 84gb_CFLAGS_WERROR := -errwarn=%all 85gb_CXXFLAGS_WERROR := -xwe 86endif 87 88gb_LinkTarget_EXCEPTIONFLAGS := \ 89 -DEXCEPTIONS_ON \ 90 91gb_LinkTarget_NOEXCEPTIONFLAGS := \ 92 -DEXCEPTIONS_OFF \ 93 -noex \ 94 95gb_LinkTarget_LDFLAGS := \ 96 $(subst -L../lib , ,$(SOLARLIB)) \ 97 -temp=/tmp \ 98 -w \ 99 -mt \ 100 -Bdirect \ 101 -z defs \ 102 -z combreloc \ 103 -norunpath \ 104 -PIC \ 105 -library=no%Cstd \ 106 107ifeq ($(gb_DEBUGLEVEL),2) 108gb_COMPILEROPTFLAGS := 109else 110ifeq ($(CPUNAME),INTEL) 111gb_COMPILEROPTFLAGS := -xarch=generic -xO3 112else # ifeq ($(CPUNAME),SPARC) 113# -m32 -xarch=sparc restrict target to 32 bit sparc 114# -xO3 optimization level 3 115# -xspace don't do optimizations which do increase binary size 116# -xprefetch=yes do prefetching (helps on UltraSparc III) 117gb_COMPILEROPTFLAGS := -m32 -xarch=sparc -xO3 -xspace -xprefetch=yes 118endif 119endif 120 121gb_COMPILERNOOPTFLAGS := 122 123# Helper class 124 125gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) 126 127# convert parametters filesystem root to native notation 128# does some real work only on windows, make sure not to 129# break the dummy implementations on unx* 130define gb_Helper_convert_native 131$(1) 132endef 133 134 135# CObject class 136 137define gb_CObject__command 138$(call gb_Output_announce,$(2),$(true),C ,3) 139$(call gb_Helper_abbreviate_dirs,\ 140 mkdir -p $(dir $(1)) && \ 141 rm -f $(call gb_CObject_get_dep_target,$(2)) && \ 142 mkdir -p $(dir $(call gb_CObject_get_dep_target,$(2))) && \ 143 $(gb_CC) \ 144 -c $(3) \ 145 -o $(1) \ 146 -xMMD \ 147 -xMF $(call gb_CObject_get_dep_target,$(2)) \ 148 $(DEFS) $(CFLAGS) \ 149 -I$(dir $(3)) \ 150 $(INCLUDE)) 151endef 152 153 154# CxxObject class 155 156define gb_CxxObject__command 157$(call gb_Output_announce,$(2),$(true),CXX,3) 158$(call gb_Helper_abbreviate_dirs,\ 159 mkdir -p $(dir $(1)) && \ 160 mkdir -p $(dir $(call gb_CxxObject_get_dep_target,$(2))) && \ 161 $(gb_CXX) \ 162 $(DEFS) $(CXXFLAGS) \ 163 -c $(3) \ 164 -o $(1) \ 165 -xMMD \ 166 -xMF $(call gb_CxxObject_get_dep_target,$(2)) \ 167 -I$(dir $(3)) \ 168 $(INCLUDE_STL) $(INCLUDE)) 169endef 170 171 172# LinkTarget class 173 174define gb_LinkTarget__get_rpath_for_layer 175$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS))) 176endef 177 178gb_LinkTarget__RPATHS := \ 179 URELIB:\dORIGIN \ 180 UREBIN:\dORIGIN/../lib:\dORIGIN \ 181 OOO:\dORIGIN:\dORIGIN/../ure-link/lib \ 182 BRAND:\dORIGIN:\dORIGIN/../basis-link/program:\dORIGIN/../basis-link/ure-link/lib \ 183 SDKBIN:\dORIGIN/../../ure-link/lib \ 184 NONEBIN:\dORIGIN/../lib:\dORIGIN \ 185 186gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS) 187gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR) 188 189ifeq ($(gb_DEBUGLEVEL),2) 190gb_LinkTarget_CXXFLAGS += -g 191gb_LinkTarget_CFLAGS += -g 192endif 193 194gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) 195gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC))) 196 197define gb_LinkTarget__command_dynamiclink 198$(call gb_Helper_abbreviate_dirs,\ 199 mkdir -p $(dir $(1)) && \ 200 $(gb_CXX) \ 201 $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ 202 $(subst \d,$$,$(RPATH)) $(LDFLAGS) \ 203 $(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \ 204 $(patsubst %,-l%,$(EXTERNAL_LIBS)) \ 205 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ 206 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ 207 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ 208 $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ 209 -o $(1)) 210endef 211 212define gb_LinkTarget__command_staticlink 213$(call gb_Helper_abbreviate_dirs,\ 214 mkdir -p $(dir $(1)) && \ 215 $(gb_AR) -rsu $(1) \ 216 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ 217 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ 218 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ 219 2> /dev/null) 220endef 221 222define gb_LinkTarget__command 223$(call gb_Output_announce,$(2),$(true),LNK,4) 224$(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1))) 225$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1))) 226endef 227 228# Library class 229 230gb_Library_DEFS := 231gb_Library_TARGETTYPEFLAGS := -Bdynamic -z text -G 232gb_Library_SYSPRE := lib 233gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_ 234gb_Library_PLAINEXT := .so 235gb_Library_RTEXT := C52$(gb_Library_PLAINEXT) 236ifeq ($(gb_PRODUCT),$(true)) 237gb_Library_STLEXT := port_sunpro$(gb_Library_PLAINEXT) 238else 239gb_Library_STLEXT := port_sunpro_debug$(gb_Library_PLAINEXT) 240endif 241 242ifeq ($(CPUNAME),INTEL) 243gb_Library_OOOEXT := $(gb_Library_PLAINEXT) 244gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) 245else # ifeq ($(CPUNAME),SPARC) 246gb_Library_OOOEXT := $(gb_Library_PLAINEXT) 247gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) 248endif 249 250gb_STDLIBS := \ 251 Crun \ 252 m \ 253 c \ 254 255gb_Library_PLAINLIBS_NONE += \ 256 $(gb_STDLIBS) \ 257 dl \ 258 freetype \ 259 jpeg \ 260 pthread \ 261 X11 \ 262 Xext \ 263 SM \ 264 ICE \ 265 z \ 266 cppunit 267 268gb_Library_FILENAMES := \ 269 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ 270 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ 271 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ 272 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ 273 $(foreach lib,$(gb_Library_RTLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \ 274 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \ 275 $(foreach lib,$(gb_Library_STLLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_STLEXT)) \ 276 $(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \ 277 $(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \ 278 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \ 279 280 281gb_Library_LAYER := \ 282 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ 283 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \ 284 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ 285 $(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \ 286 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \ 287 $(foreach lib,$(gb_Library_STLLIBS),$(lib):URELIB) \ 288 $(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):URELIB) \ 289 $(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \ 290 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \ 291 292define gb_Library_get_rpath 293'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))' 294endef 295 296define gb_Library_Library_platform 297$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1)) 298 299endef 300 301 302# StaticLibrary class 303 304gb_StaticLibrary_DEFS := 305gb_StaticLibrary_SYSPRE := lib 306gb_StaticLibrary_PLAINEXT := .a 307gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT) 308 309gb_StaticLibrary_FILENAMES := \ 310 $(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \ 311 $(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \ 312 313gb_StaticLibrary_StaticLibrary_platform = 314 315 316# Executable class 317 318gb_Executable_EXT := 319 320gb_Executable_LAYER := \ 321 $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \ 322 $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \ 323 $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \ 324 $(foreach exe,$(gb_Executable_BRAND),$(exe):BRAND) \ 325 $(foreach exe,$(gb_Executable_NONE),$(exe):NONEBIN) \ 326 327 328define gb_Executable_get_rpath 329'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1)))' 330endef 331 332define gb_Executable_Executable_platform 333$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1)) 334 335endef 336 337 338# CppunitTest class 339 340gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 341gb_CppunitTest_SYSPRE := libtest_ 342gb_CppunitTest_EXT := .so 343gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT) 344gb_CppunitTest_get_libfilename = $(gb_CppunitTest_get_filename) 345 346define gb_CppunitTest_CppunitTest_platform 347$(call gb_LinkTarget_get_target,$(2)) : RPATH := 348 349endef 350 351# JunitTest class 352 353define gb_JunitTest_JunitTest_platform 354$(call gb_JunitTest_get_target,$(1)) : DEFS := \ 355 -Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/openoffice.org3/program/soffice}" \ 356 -Dorg.openoffice.test.arg.env=LD_LIBRARY_PATH \ 357 -Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \ 358 359endef 360 361# SdiTarget class 362 363gb_SdiTarget_SVIDLPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 364 365# SrsPartMergeTarget 366 367gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 368 369# SrsPartTarget class 370 371gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc 372gb_SrsPartTarget_RSCCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET) 373 374# Sun cc/CC support -xM1/-xMF flags, but unfortunately refuse input files that 375# do not have the right suffix, so use makedepend here... 376define gb_SrsPartTarget__command_dep 377$(call gb_Helper_abbreviate_dirs_native,\ 378 $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ 379 $(INCLUDE) \ 380 $(DEFS) \ 381 $(2) \ 382 -f - \ 383 | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ 384 -v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \ 385 -v OUTDIR=$(OUTDIR)/ \ 386 -v WORKDIR=$(WORKDIR)/ \ 387 -v SRCDIR=$(SRCDIR)/ \ 388 -v REPODIR=$(REPODIR)/ \ 389 > $(call gb_SrsPartTarget_get_dep_target,$(1))) 390endef 391 392 393# ComponentTarget 394 395gb_XSLTPROCPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 396gb_Library_COMPONENTPREFIXES := \ 397 OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \ 398 URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \ 399 400 401# vim: set noet sw=4 ts=4: 402