425 lines
13 KiB
Makefile
Executable file
425 lines
13 KiB
Makefile
Executable file
#*************************************************************************
|
|
#
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
#
|
|
# Copyright 2009 by Sun Microsystems, Inc.
|
|
#
|
|
# OpenOffice.org - a multi-platform office productivity suite
|
|
#
|
|
# This file is part of OpenOffice.org.
|
|
#
|
|
# OpenOffice.org is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
# only, as published by the Free Software Foundation.
|
|
#
|
|
# OpenOffice.org is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Lesser General Public License version 3 for more details
|
|
# (a copy is included in the LICENSE file that accompanied this code).
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
# version 3 along with OpenOffice.org. If not, see
|
|
# <http://www.openoffice.org/license.html>
|
|
# for a copy of the LGPLv3 License.
|
|
#
|
|
#*************************************************************************
|
|
|
|
GUI := UNX
|
|
COM := GCC
|
|
|
|
gb_MKTEMP := TMPDIR= /usr/bin/mktemp -t
|
|
|
|
gb_CC := cc
|
|
gb_CXX := g++
|
|
gb_GCCP := gcc
|
|
gb_AWK := awk
|
|
|
|
# use CC/CXX if they are nondefaults
|
|
ifneq ($(origin CC),default)
|
|
gb_CC := $(CC)
|
|
gb_GCCP := $(CC)
|
|
endif
|
|
ifneq ($(origin CXX),default)
|
|
gb_CXX := $(CXX)
|
|
endif
|
|
|
|
gb_OSDEFS := \
|
|
-D$(OS) \
|
|
-D_PTHREADS \
|
|
-DUNIX \
|
|
-D_REENTRANT \
|
|
-DNO_PTHREAD_PRIORITY \
|
|
-DQUARTZ \
|
|
$(EXTRA_CDEFS) \
|
|
|
|
gb_COMPILERDEFS := \
|
|
-D$(COM) \
|
|
-DHAVE_GCC_VISIBILITY_FEATURE \
|
|
-DCPPU_ENV=gcc3 \
|
|
-DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \
|
|
|
|
ifeq ($(CPUNAME),POWERPC)
|
|
gb_CPUDEFS := -DPOWERPC -DPPC
|
|
else
|
|
gb_CPUDEFS := -DX86
|
|
endif
|
|
|
|
ifeq ($(strip $(SYSBASE)),)
|
|
gb_SDKDIR := /Developer/SDKs/MacOSX10.4u.sdk
|
|
else
|
|
gb_SDKDIR := $(SYSBASE)/MacOSX10.4u.sdk
|
|
endif
|
|
|
|
|
|
gb_CFLAGS := \
|
|
-Wall \
|
|
-Wendif-labels \
|
|
-Wextra \
|
|
-fPIC \
|
|
-fmessage-length=0 \
|
|
-fno-common \
|
|
-fno-strict-aliasing \
|
|
-fsigned-char \
|
|
-fvisibility=hidden \
|
|
-pipe \
|
|
|
|
gb_CXXFLAGS := \
|
|
-Wall \
|
|
-Wendif-labels \
|
|
-Wextra \
|
|
-Wno-ctor-dtor-privacy \
|
|
-Wno-long-double \
|
|
-Wno-non-virtual-dtor \
|
|
-Wreturn-type \
|
|
-Wshadow \
|
|
-Wuninitialized \
|
|
-fPIC \
|
|
-fmessage-length=0 \
|
|
-fno-common \
|
|
-fno-strict-aliasing \
|
|
-fsigned-char \
|
|
-isysroot $(gb_SDKDIR) \
|
|
-malign-natural \
|
|
-pipe \
|
|
|
|
# these are to get g++ to switch to Objective-C++ mode
|
|
# (see toolkit module for a case where it is necessary to do it this way)
|
|
gb_OBJCXXFLAGS := -x objective-c++ -fobjc-exceptions
|
|
|
|
gb_CFLAGS_WERROR := \
|
|
-Werror \
|
|
|
|
gb_CXXFLAGS_WERROR := \
|
|
-Werror \
|
|
|
|
gb_LinkTarget_EXCEPTIONFLAGS := \
|
|
-DEXCEPTIONS_ON \
|
|
-fexceptions \
|
|
-fno-enforce-eh-specs \
|
|
|
|
gb_LinkTarget_NOEXCEPTIONFLAGS := \
|
|
-DEXCEPTIONS_OFF \
|
|
-fno-exceptions \
|
|
|
|
gb_LinkTarget_LDFLAGS := \
|
|
-Wl,-syslibroot,$(gb_SDKDIR) \
|
|
$(subst -L../lib , ,$(SOLARLIB)) \
|
|
#man ld says: obsolete -Wl,-multiply_defined,suppress \
|
|
|
|
ifeq ($(gb_DEBUGLEVEL),2)
|
|
gb_COMPILEROPTFLAGS := -O0
|
|
else
|
|
gb_COMPILEROPTFLAGS := -O2
|
|
endif
|
|
|
|
|
|
# Helper class
|
|
|
|
gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs)
|
|
|
|
|
|
# CObject class
|
|
|
|
define gb_CObject__command
|
|
$(call gb_Output_announce,$(2),$(true),C ,3)
|
|
$(call gb_Helper_abbreviate_dirs,\
|
|
mkdir -p $(dir $(1)) && \
|
|
mkdir -p $(dir $(call gb_CObject_get_dep_target,$(2))) && \
|
|
$(gb_CC) \
|
|
$(DEFS) $(CFLAGS) \
|
|
-c $(3) \
|
|
-o $(1) \
|
|
-MMD -MT $(call gb_CObject_get_target,$(2)) \
|
|
-MF $(call gb_CObject_get_dep_target,$(2)) \
|
|
-I$(dir $(3)) \
|
|
$(INCLUDE))
|
|
endef
|
|
|
|
|
|
# CxxObject class
|
|
|
|
# N.B: $(4) or $(5) may contain -x objective-c++, which must come before -c
|
|
define gb_CxxObject__command
|
|
$(call gb_Output_announce,$(2),$(true),CXX,3)
|
|
$(call gb_Helper_abbreviate_dirs,\
|
|
mkdir -p $(dir $(1)) && \
|
|
mkdir -p $(dir $(call gb_CxxObject_get_dep_target,$(2))) && \
|
|
$(gb_CXX) \
|
|
$(DEFS) $(CXXFLAGS) \
|
|
-c $(3) \
|
|
-o $(1) \
|
|
-MMD -MT $(call gb_CxxObject_get_target,$(2)) \
|
|
-MF $(call gb_CxxObject_get_dep_target,$(2)) \
|
|
-I$(dir $(3)) \
|
|
$(INCLUDE_STL) $(INCLUDE))
|
|
endef
|
|
|
|
|
|
# ObjCxxObject class
|
|
|
|
define gb_ObjCxxObject__command
|
|
$(call gb_Output_announce,$(2),$(true),OCX,3)
|
|
$(call gb_Helper_abbreviate_dirs,\
|
|
mkdir -p $(dir $(1)) && \
|
|
mkdir -p $(dir $(call gb_ObjCxxObject_get_dep_target,$(2))) && \
|
|
$(gb_CXX) \
|
|
$(4) $(5) \
|
|
-c $(3) \
|
|
-o $(1) \
|
|
-MMD -MT $(call gb_ObjCxxObject_get_target,$(2)) \
|
|
-MF $(call gb_ObjCxxObject_get_dep_target,$(2)) \
|
|
-I$(dir $(3)) \
|
|
$(6))
|
|
endef
|
|
|
|
|
|
# LinkTarget class
|
|
|
|
define gb_LinkTarget__get_rpath_for_layer
|
|
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS)))
|
|
endef
|
|
|
|
gb_LinkTarget__RPATHS := \
|
|
URELIB:@__________________________________________________URELIB/ \
|
|
UREBIN: \
|
|
OOOLIB:@__________________________________________________OOO/ \
|
|
BRAND: \
|
|
SDKBIN: \
|
|
NONEBIN: \
|
|
|
|
define gb_LinkTarget__get_installname
|
|
$(if $(2),-install_name '$(2)$(1)',)
|
|
endef
|
|
|
|
gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_COMPILEROPTFLAGS)
|
|
gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_COMPILEROPTFLAGS)
|
|
gb_LinkTarget_OBJCXXFLAGS := $(gb_CXXFLAGS) $(gb_OBJCXXFLAGS) $(gb_COMPILEROPTFLAGS)
|
|
|
|
ifeq ($(gb_DEBUGLEVEL),2)
|
|
gb_LinkTarget_CFLAGS += -g
|
|
gb_LinkTarget_CXXFLAGS += -g
|
|
gb_LinkTarget_OBJCXXFLAGS += -g
|
|
endif
|
|
|
|
gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC)))
|
|
gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
|
|
|
|
# FIXME framework handling very hackish
|
|
define gb_LinkTarget__get_liblinkflags
|
|
$(patsubst lib%.dylib,-l%,$(foreach lib,$(filter-out $(gb_Library__FRAMEWORKS),$(4)),$(call gb_Library_get_filename,$(lib)))) \
|
|
$(addprefix -framework ,$(filter $(gb_Library__FRAMEWORKS),$(4)))
|
|
endef
|
|
|
|
define gb_LinkTarget__get_layer
|
|
$(if $(filter Executable,$(1)),\
|
|
$(call gb_Executable_get_layer,$(2)),\
|
|
$(call gb_Library_get_layer,$(2)))
|
|
endef
|
|
|
|
# FIXME the DYLIB_FILE mess is only necessary because
|
|
# solver layout is different from installation layout
|
|
define gb_LinkTarget__command_dynamiclink
|
|
$(call gb_Helper_abbreviate_dirs,\
|
|
mkdir -p $(dir $(1)) && \
|
|
DYLIB_FILE=`$(gb_MKTEMP) $(dir $(1))` && \
|
|
$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl $(LDFLAGS) $(patsubst lib%.dylib,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) > $${DYLIB_FILE} && \
|
|
$(gb_CXX) \
|
|
$(RPATH) $(LDFLAGS) \
|
|
$(call gb_LinkTarget__get_liblinkflags,$(LINKED_LIBS)) \
|
|
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
|
|
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
|
|
$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
|
|
$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
|
|
-o $(1) \
|
|
`cat $${DYLIB_FILE}` && \
|
|
$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl $(TARGETTYPE) $(call gb_LinkTarget__get_layer,$(TARGETTYPE),$(1)) $(1) && \
|
|
$(if $(filter-out Executable,$(TARGETTYPE)),ln -sf $(1) $(patsubst %.dynlib,%.jnilib,$(1)) && )
|
|
rm -f $${DYLIB_FILE})
|
|
endef
|
|
|
|
# parameters: 1-linktarget 2-cobjects 3-cxxobjects
|
|
define gb_LinkTarget__command_staticlink
|
|
$(call gb_Helper_abbreviate_dirs,\
|
|
mkdir -p $(dir $(1)) && \
|
|
$(gb_AR) -rsu $(1) \
|
|
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
|
|
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) 2> /dev/null)
|
|
endef
|
|
|
|
define gb_LinkTarget__command
|
|
$(call gb_Output_announce,$(2),$(true),LNK,4)
|
|
$(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1)))
|
|
$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1)))
|
|
endef
|
|
|
|
|
|
# Library class
|
|
|
|
gb_Library_DEFS :=
|
|
gb_Library_TARGETTYPEFLAGS := -dynamiclib -single_module
|
|
gb_Library_SYSPRE := lib
|
|
gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_
|
|
gb_Library_PLAINEXT := .dylib
|
|
gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT)
|
|
ifeq ($(gb_PRODUCT),$(true))
|
|
gb_Library_STLEXT := port_gcc$(gb_Library_PLAINEXT)
|
|
else
|
|
gb_Library_STLEXT := port_gcc_stldebug$(gb_Library_PLAINEXT)
|
|
endif
|
|
|
|
ifeq ($(CPUNAME),INTEL)
|
|
gb_Library_OOOEXT := mxi$(gb_Library_PLAINEXT)
|
|
gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
|
|
else # ifeq ($(CPUNAME),POWERPC)
|
|
gb_Library_OOOEXT := mxp$(gb_Library_PLAINEXT)
|
|
gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
|
|
endif
|
|
|
|
gb_Library__FRAMEWORKS += \
|
|
Cocoa \
|
|
|
|
gb_Library_PLAINLIBS_NONE += \
|
|
Cocoa \
|
|
objc \
|
|
jpeg \
|
|
m \
|
|
pthread \
|
|
z \
|
|
|
|
gb_Library_FILENAMES := \
|
|
$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
|
|
$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
|
|
$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
|
|
$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
|
|
$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
|
|
$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
|
|
$(foreach lib,$(gb_Library_STLLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_STLEXT)) \
|
|
$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
|
|
$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
|
|
$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \
|
|
|
|
|
|
gb_Library_LAYER := \
|
|
$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
|
|
$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
|
|
$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
|
|
$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
|
|
$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \
|
|
$(foreach lib,$(gb_Library_STLLIBS),$(lib):URELIB) \
|
|
$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):URELIB) \
|
|
$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
|
|
$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \
|
|
|
|
define gb_Library_get_rpath
|
|
$(call gb_LinkTarget__get_installname,$(call gb_Library_get_filename,$(1)),$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1))))
|
|
endef
|
|
|
|
define gb_Library_Library_platform
|
|
$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1))
|
|
|
|
endef
|
|
|
|
|
|
# StaticLibrary class
|
|
|
|
gb_StaticLibrary_DEFS :=
|
|
gb_StaticLibrary_SYSPRE := lib
|
|
gb_StaticLibrary_PLAINEXT := .a
|
|
gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
|
|
|
|
gb_StaticLibrary_FILENAMES := \
|
|
$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
|
|
$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
|
|
|
|
gb_StaticLibrary_StaticLibrary_platform =
|
|
|
|
|
|
# Executable class
|
|
|
|
gb_Executable_EXT :=
|
|
gb_Executable_TARGETTYPEFLAGS := -bind_at_load
|
|
|
|
gb_Executable_LAYER := \
|
|
$(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \
|
|
$(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \
|
|
$(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \
|
|
$(foreach exe,$(gb_Executable_BRAND),$(exe):BRAND) \
|
|
$(foreach exe,$(gb_Executable_NONE),$(exe):NONEBIN) \
|
|
|
|
|
|
define gb_Executable_get_rpath
|
|
$(call gb_LinkTarget__get_installname,$(1),$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1))))
|
|
endef
|
|
|
|
define gb_Executable_Executable_platform
|
|
$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1))
|
|
|
|
endef
|
|
|
|
|
|
# CppunitTest class
|
|
|
|
gb_CppunitTest_TARGETTYPEFLAGS := $(gb_Library_TARGETTYPEFLAGS)
|
|
gb_CppunitTest_CPPTESTPRECOMMAND :=
|
|
gb_CppunitTest_SYSPRE := libtest_
|
|
gb_CppunitTest_EXT := .dylib
|
|
gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
|
|
|
|
define gb_CppunitTest_CppunitTest_platform
|
|
$(call gb_LinkTarget_get_target,$(2)) : RPATH :=
|
|
|
|
endef
|
|
|
|
|
|
# SdiTarget class
|
|
|
|
gb_SdiTarget_SVIDLPRECOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib
|
|
|
|
# SrsPartMergeTarget
|
|
|
|
gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib
|
|
|
|
# SrsPartTarget class
|
|
|
|
gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc
|
|
gb_SrsPartTarget_RSCCOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
|
|
|
|
define gb_SrsPartTarget__command_dep
|
|
$(call gb_Helper_abbreviate_dirs,\
|
|
$(gb_GCCP) \
|
|
-MM -MT $(call gb_SrsPartTarget_get_target,$(1)) \
|
|
$(INCLUDE) \
|
|
$(DEFS) \
|
|
-c -x c++-header $(2) \
|
|
-o $(call gb_SrsPartTarget_get_dep_target,$(1)))
|
|
endef
|
|
|
|
|
|
# ComponentTarget
|
|
|
|
gb_ComponentTarget_XSLTPROCPRECOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib
|
|
gb_ComponentTarget_PREFIXBASISNATIVE := vnd.sun.star.expand:$$OOO_BASE_DIR/program/
|
|
|
|
|
|
# vim: set noet sw=4 ts=4:
|