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 107 108gb_DEBUG_CFLAGS := -g 109 110ifeq ($(gb_DEBUGLEVEL),2) 111gb_COMPILEROPTFLAGS := 112else 113ifeq ($(CPUNAME),INTEL) 114gb_COMPILEROPTFLAGS := -xarch=generic -xO3 115else # ifeq ($(CPUNAME),SPARC) 116# -m32 -xarch=sparc restrict target to 32 bit sparc 117# -xO3 optimization level 3 118# -xspace don't do optimizations which do increase binary size 119# -xprefetch=yes do prefetching (helps on UltraSparc III) 120gb_COMPILEROPTFLAGS := -m32 -xarch=sparc -xO3 -xspace -xprefetch=yes 121endif 122endif 123 124gb_COMPILERNOOPTFLAGS := 125 126# Helper class 127 128gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) 129 130# convert parametters filesystem root to native notation 131# does some real work only on windows, make sure not to 132# break the dummy implementations on unx* 133define gb_Helper_convert_native 134$(1) 135endef 136 137# convert parametters filesystem root to native notation 138# does some real work only on windows, make sure not to 139# break the dummy implementations on unx* 140define gb_Helper_convert_native 141$(1) 142endef 143 144 145# CObject class 146 147define gb_CObject__command 148$(call gb_Output_announce,$(2),$(true),C ,3) 149$(call gb_Helper_abbreviate_dirs,\ 150 rm -f $(4) && \ 151 mkdir -p $(dir $(1)) $(dir $(4)) && \ 152 $(gb_CC) \ 153 -c $(3) \ 154 -o $(1) \ 155 -xMMD \ 156 -xMF $(4) \ 157 $(DEFS) \ 158 $(T_CFLAGS) \ 159 -I$(dir $(3)) \ 160 $(INCLUDE)) 161endef 162 163 164# CxxObject class 165 166define gb_CxxObject__command 167$(call gb_Output_announce,$(2),$(true),CXX,3) 168$(call gb_Helper_abbreviate_dirs,\ 169 mkdir -p $(dir $(1)) $(dir $(4)) && \ 170 $(gb_CXX) \ 171 $(DEFS) \ 172 $(T_CXXFLAGS) \ 173 -c $(3) \ 174 -o $(1) \ 175 -xMMD \ 176 -xMF $(4) \ 177 -I$(dir $(3)) \ 178 $(INCLUDE_STL) $(INCLUDE)) 179endef 180 181 182# LinkTarget class 183 184define gb_LinkTarget__get_rpath_for_layer 185$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS))) 186endef 187 188gb_LinkTarget__RPATHS := \ 189 URELIB:\dORIGIN \ 190 UREBIN:\dORIGIN/../lib:\dORIGIN \ 191 OOO:\dORIGIN:\dORIGIN/../ure-link/lib \ 192 BRAND:\dORIGIN:\dORIGIN/../basis-link/program:\dORIGIN/../basis-link/ure-link/lib \ 193 SDKBIN:\dORIGIN/../../ure-link/lib \ 194 NONEBIN:\dORIGIN/../lib:\dORIGIN \ 195 196gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) 197gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR) 198 199 200gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) 201gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC))) 202 203define gb_LinkTarget__command_dynamiclink 204$(call gb_Helper_abbreviate_dirs,\ 205 mkdir -p $(dir $(1)) && \ 206 $(gb_CXX) \ 207 $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ 208 $(subst \d,$$,$(RPATH)) \ 209 $(T_LDFLAGS) \ 210 $(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \ 211 $(patsubst %,-l%,$(EXTERNAL_LIBS)) \ 212 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ 213 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ 214 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ 215 $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ 216 $(LIBS) \ 217 -o $(1)) 218endef 219 220define gb_LinkTarget__command_staticlink 221$(call gb_Helper_abbreviate_dirs,\ 222 mkdir -p $(dir $(1)) && \ 223 $(gb_AR) -rsu $(1) \ 224 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ 225 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ 226 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ 227 2> /dev/null) 228endef 229 230define gb_LinkTarget__command 231$(call gb_Output_announce,$(2),$(true),LNK,4) 232$(if $(filter Library GoogleTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1))) 233$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1))) 234endef 235 236# Library class 237 238gb_Library_DEFS := 239gb_Library_TARGETTYPEFLAGS := -Bdynamic -z text -G 240gb_Library_SYSPRE := lib 241gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_ 242gb_Library_PLAINEXT := .so 243gb_Library_RTEXT := C52$(gb_Library_PLAINEXT) 244ifeq ($(gb_PRODUCT),$(true)) 245gb_Library_STLEXT := port_sunpro$(gb_Library_PLAINEXT) 246else 247gb_Library_STLEXT := port_sunpro_debug$(gb_Library_PLAINEXT) 248endif 249 250ifeq ($(CPUNAME),INTEL) 251gb_Library_OOOEXT := $(gb_Library_PLAINEXT) 252gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) 253else # ifeq ($(CPUNAME),SPARC) 254gb_Library_OOOEXT := $(gb_Library_PLAINEXT) 255gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT) 256endif 257 258gb_STDLIBS := \ 259 Crun \ 260 m \ 261 c \ 262 263gb_Library_PLAINLIBS_NONE += \ 264 $(gb_STDLIBS) \ 265 dl \ 266 freetype \ 267 nsl \ 268 pthread \ 269 socket \ 270 X11 \ 271 Xext \ 272 SM \ 273 ICE 274 275gb_Library_FILENAMES := \ 276 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \ 277 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ 278 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ 279 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \ 280 $(foreach lib,$(gb_Library_RTLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \ 281 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \ 282 $(foreach lib,$(gb_Library_STLLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_STLEXT)) \ 283 $(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \ 284 $(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \ 285 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \ 286 287 288gb_Library_LAYER := \ 289 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \ 290 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \ 291 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \ 292 $(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \ 293 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \ 294 $(foreach lib,$(gb_Library_STLLIBS),$(lib):URELIB) \ 295 $(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):URELIB) \ 296 $(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \ 297 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \ 298 299define gb_Library_get_rpath 300'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))' 301endef 302 303define gb_Library_Library_platform 304$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1)) 305 306endef 307 308 309# StaticLibrary class 310 311gb_StaticLibrary_DEFS := 312gb_StaticLibrary_SYSPRE := lib 313gb_StaticLibrary_PLAINEXT := .a 314gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT) 315 316gb_StaticLibrary_FILENAMES := \ 317 $(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \ 318 $(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \ 319 320gb_StaticLibrary_StaticLibrary_platform = 321 322 323# Executable class 324 325gb_Executable_EXT := 326 327gb_Executable_LAYER := \ 328 $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \ 329 $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \ 330 $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \ 331 $(foreach exe,$(gb_Executable_BRAND),$(exe):BRAND) \ 332 $(foreach exe,$(gb_Executable_NONE),$(exe):NONEBIN) \ 333 334 335define gb_Executable_get_rpath 336'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1)))' 337endef 338 339define gb_Executable_Executable_platform 340$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1)) 341 342endef 343 344 345# GoogleTest class 346 347gb_GoogleTest_GTESTPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 348gb_GoogleTest_get_filename = $(1)$(gb_Executable_EXT) 349 350define gb_GoogleTest_GoogleTest_platform 351$(call gb_LinkTarget_get_target,$(2)) : RPATH := 352endef 353 354# JunitTest class 355 356define gb_JunitTest_JunitTest_platform 357$(call gb_JunitTest_get_target,$(1)) : DEFS := \ 358 -Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/openoffice.org3/program/soffice}" \ 359 -Dorg.openoffice.test.arg.env=LD_LIBRARY_PATH \ 360 -Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \ 361 362endef 363 364# SdiTarget class 365 366gb_SdiTarget_SVIDLPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 367 368# SrsPartMergeTarget 369 370gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 371 372# SrsPartTarget class 373 374gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc 375gb_SrsPartTarget_RSCCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET) 376 377# Sun cc/CC support -xM1/-xMF flags, but unfortunately refuse input files that 378# do not have the right suffix, so use makedepend here... 379define gb_SrsPartTarget__command_dep 380$(call gb_Helper_abbreviate_dirs_native,\ 381 $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ 382 $(INCLUDE) \ 383 $(DEFS) \ 384 $(2) \ 385 -f - \ 386 | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ 387 -v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \ 388 -v OUTDIR=$(OUTDIR)/ \ 389 -v WORKDIR=$(WORKDIR)/ \ 390 -v SRCDIR=$(SRCDIR)/ \ 391 -v REPODIR=$(REPODIR)/ \ 392 > $(call gb_SrsPartTarget_get_dep_target,$(1))) 393endef 394 395 396# ComponentTarget 397 398gb_XSLTPROCPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib 399gb_Library_COMPONENTPREFIXES := \ 400 OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \ 401 URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \ 402 NONE:vnd.sun.star.expand:\dOOO_INBUILD_SHAREDLIB_DIR/ \ 403 404# UnoApiTarget 405 406gb_UnoApiTarget_IDLCTARGET := $(OUTDIR)/bin/idlc 407gb_UnoApiTarget_IDLCCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_IDLCTARGET) 408gb_UnoApiTarget_REGMERGETARGET := $(OUTDIR)/bin/regmerge 409gb_UnoApiTarget_REGMERGECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGMERGETARGET) 410gb_UnoApiTarget_REGCOMPARETARGET := $(OUTDIR)/bin/regcompare 411gb_UnoApiTarget_REGCOMPARECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGCOMPARETARGET) 412gb_UnoApiTarget_CPPUMAKERTARGET := $(OUTDIR)/bin/cppumaker 413gb_UnoApiTarget_CPPUMAKERCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_CPPUMAKERTARGET) 414gb_UnoApiTarget_REGVIEWTARGET := $(OUTDIR)/bin/regview 415gb_UnoApiTarget_REGVIEWCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGVIEWTARGET) 416 417# vim: set noet sw=4 ts=4: 418