diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-11-05 06:55:15 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-11-08 22:17:20 -0600 |
commit | 70270b53e764bf814ebb0c771db6280b951ee6b2 (patch) | |
tree | c6cbc8cf2b0930dcab5633b0dc13803dbaa2d6e2 /solenv | |
parent | 696fb8582fe54d6cb5ec54f81680ddc281500b88 (diff) |
begin factorization of common GCC stuff
a lot of configuration/definition is shared between platforms that build
using gcc.
This start to regroup things that are common into 2 files
com_GCC_defs.mk and com_GCC_class.mk
this can be expanded to be, more generically com_$(COM)_defs/class
The reson for 2 files is that some step need to modfify common definitions
based on the platform and some common definitions need platform defined
value.
with these 2 files we can do a
platform - compiler - platform - compiler - platfrom
sandwich that should cover every scenario.
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/platform/android.mk | 21 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_GCC_class.mk | 72 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_GCC_defs.mk | 130 | ||||
-rw-r--r-- | solenv/gbuild/platform/ios.mk | 116 | ||||
-rw-r--r-- | solenv/gbuild/platform/macosx.mk | 134 | ||||
-rw-r--r-- | solenv/gbuild/platform/unxgcc.mk | 124 | ||||
-rw-r--r-- | solenv/gbuild/platform/winmingw.mk | 114 |
7 files changed, 255 insertions, 456 deletions
diff --git a/solenv/gbuild/platform/android.mk b/solenv/gbuild/platform/android.mk index 03f85ec49712..92ad3661832a 100644 --- a/solenv/gbuild/platform/android.mk +++ b/solenv/gbuild/platform/android.mk @@ -39,25 +39,4 @@ include $(GBUILDDIR)/platform/unxgcc.mk # No unit testing can be run gb_CppunitTest_CPPTESTPRECOMMAND := : -# Set the proper enirotment variable so that our BUILD platform -# build-time shared libraries are found. -ifeq ($(OS_FOR_BUILD),MACOSX) -gb_Helper_set_ld_path := DYLD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib -else -gb_Helper_set_ld_path := LD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib -endif - -# UnoApiTarget - -gb_UnoApiTarget_IDLCTARGET := $(OUTDIR_FOR_BUILD)/bin/idlc -gb_UnoApiTarget_IDLCCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_IDLCTARGET) -gb_UnoApiTarget_REGMERGETARGET := $(OUTDIR_FOR_BUILD)/bin/regmerge -gb_UnoApiTarget_REGMERGECOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_REGMERGETARGET) -gb_UnoApiTarget_REGCOMPARETARGET := $(OUTDIR_FOR_BUILD)/bin/regcompare -gb_UnoApiTarget_REGCOMPARECOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_REGCOMPARETARGET) -gb_UnoApiTarget_CPPUMAKERTARGET := $(OUTDIR_FOR_BUILD)/bin/cppumaker -gb_UnoApiTarget_CPPUMAKERCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_CPPUMAKERTARGET) -gb_UnoApiTarget_REGVIEWTARGET := $(OUTDIR_FOR_BUILD)/bin/regview -gb_UnoApiTarget_REGVIEWCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_REGVIEWTARGET) - # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk new file mode 100644 index 000000000000..ccd76bf1f3fb --- /dev/null +++ b/solenv/gbuild/platform/com_GCC_class.mk @@ -0,0 +1,72 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Norbert Thiebaud <nthiebaud@gmail.com> (C) 2010, All Rights Reserved. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + + +# CObject class + +# $(call gb_CObject__command,object,relative-source,source,dep-file) +define gb_CObject__command +$(call gb_Output_announce,$(2),$(true),C ,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(4)) && \ + $(gb_CC) \ + $(DEFS) \ + $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_LTOFLAGS)) \ + $(T_CFLAGS) \ + -c $(3) \ + -o $(1) \ + -MMD -MT $(1) \ + -MP -MF $(4) \ + -I$(dir $(3)) \ + $(INCLUDE)) +endef + +# CxxObject class + +# $(call gb_CxxObject__command,object,relative-source,source,dep-file) +define gb_CxxObject__command +$(call gb_Output_announce,$(2),$(true),CXX,3) +$(call gb_Helper_abbreviate_dirs,\ + mkdir -p $(dir $(1)) $(dir $(4)) && \ + $(gb_CXX) \ + $(DEFS) \ + $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_LTOFLAGS)) \ + $(T_CXXFLAGS) \ + -c $(3) \ + -o $(1) \ + -MMD -MT $(1) \ + -MP -MF $(4) \ + -I$(dir $(3)) \ + $(INCLUDE_STL) $(INCLUDE)) +endef + +gb_UnoApiTarget_IDLCTARGET := $(OUTDIR_FOR_BUILD)/bin/idlc +gb_UnoApiTarget_IDLCCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_IDLCTARGET) +gb_UnoApiTarget_REGMERGETARGET := $(OUTDIR_FOR_BUILD)/bin/regmerge +gb_UnoApiTarget_REGMERGECOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_REGMERGETARGET) +gb_UnoApiTarget_REGCOMPARETARGET := $(OUTDIR_FOR_BUILD)/bin/regcompare +gb_UnoApiTarget_REGCOMPARECOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_REGCOMPARETARGET) +gb_UnoApiTarget_CPPUMAKERTARGET := $(OUTDIR_FOR_BUILD)/bin/cppumaker +gb_UnoApiTarget_CPPUMAKERCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_CPPUMAKERTARGET) +gb_UnoApiTarget_REGVIEWTARGET := $(OUTDIR_FOR_BUILD)/bin/regview +gb_UnoApiTarget_REGVIEWCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_FOR_BUILD)/bin $(gb_UnoApiTarget_REGVIEWTARGET) + diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk new file mode 100644 index 000000000000..c73219eabad7 --- /dev/null +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -0,0 +1,130 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Norbert Thiebaud <nthiebaud@gmail.com> (C) 2010, All Rights Reserved. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +gb_AWK := awk +gb_YACC := bison + +gb_CLASSPATHSEP := : + +# use CC/CXX if they are nondefaults +ifneq ($(origin CC),default) +gb_CC := $(CC) +gb_GCCP := $(CC) +else +gb_CC := gcc +gb_GCCP := gcc +endif + +ifneq ($(origin CXX),default) +gb_CXX := $(CXX) +else +gb_CXX := g++ +endif + +ifneq ($(origin AR),default) +gb_AR := $(AR) +else +gb_AR := $(shell $(CC) -print-prog-name=ar) +endif + +ifeq ($(strip $(gb_COMPILERDEFAULTOPTFLAGS)),) +gb_COMPILERDEFAULTOPTFLAGS := -O2 +endif + +gb_CCVER := $(shell $(gb_CC) -dumpversion | $(gb_AWK) -F. -- '{ print $$1*10000+$$2*100+$$3 }') + +gb_COMPILERDEFS := \ + -D$(COM) \ + -DCPPU_ENV=gcc3 \ + -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \ + +gb_CFLAGS_COMMON := \ + -Wall \ + -Wendif-labels \ + -Wextra \ + -fmessage-length=0 \ + -fno-common \ + -pipe \ + +gb_CXXFLAGS_COMMON := \ + -Wall \ + -Wendif-labels \ + -Wextra \ + -fmessage-length=0 \ + -fno-common \ + -pipe \ + +ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) +gb_CFLAGS_WERROR := -Werror -DLIBO_WERROR +gb_CXXFLAGS_WERROR := -Werror -DLIBO_WERROR +endif + +ifeq ($(ENABLE_LTO),TRUE) +gb_Library_LTOFLAGS := -flto +endif + +gb_LinkTarget_EXCEPTIONFLAGS := \ + -DEXCEPTIONS_ON \ + -fexceptions \ + -fno-enforce-eh-specs \ + +gb_LinkTarget_NOEXCEPTIONFLAGS := \ + -DEXCEPTIONS_OFF \ + -fno-exceptions \ + + +# optimization level +ifneq ($(gb_DEBUGLEVEL),0) +gb_COMPILEROPTFLAGS := -O0 +else +gb_COMPILEROPTFLAGS := $(gb_COMPILERDEFAULTOPTFLAGS) +endif +gb_COMPILERNOOPTFLAGS := -O0 + +gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) +gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC))) + + + +ifeq ($(OS_FOR_BUILD),MACOSX) +gb_Helper_LIBRARY_PATH_VAR := DYLD_LIBRARY_PATH +else ifeq ($(OS_FOR_BUILD),WNT) +# In theory possible if cross-compiling to some Unix from Windows, +# in practice strongly discouraged to even try that +gb_Helper_LIBRARY_PATH_VAR := PATH +else +gb_Helper_LIBRARY_PATH_VAR := LD_LIBRARY_PATH +endif + +gb_Helper_set_ld_path := $(gb_Helper_LIBRARY_PATH_VAR)=$(OUTDIR_FOR_BUILD)/lib + + +# convert parameters filesystem root to native notation +# does some real work only on windows, make sure not to +# break the dummy implementations on unx* +define gb_Helper_convert_native +$(1) +endef + +gb_Helper_OUTDIRLIBDIR := $(OUTDIR)/lib + +gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) diff --git a/solenv/gbuild/platform/ios.mk b/solenv/gbuild/platform/ios.mk index 2f954c1042a5..b10a3916c144 100644 --- a/solenv/gbuild/platform/ios.mk +++ b/solenv/gbuild/platform/ios.mk @@ -29,8 +29,9 @@ GUI := UNX COM := GCC -# Darwin mktemp -t expects a prefix, not a pattern -gb_MKTEMP := /usr/bin/mktemp -t gbuild. +gb_CPUDEFS := -DARM32 + +gb_COMPILERDEFAULTOPTFLAGS := -O2 ifeq ($(CC),) $(error You must set CC in the environment. See README.cross for example.) @@ -39,13 +40,10 @@ ifeq ($(CXX),) $(error You must set CXX in the environment. See README.cross for example.) endif -gb_CC := $(CC) -gb_CXX := $(CXX) -gb_GCCP := $(CC) -gb_AR := ar -gb_AWK := awk -gb_CLASSPATHSEP := : -gb_YACC := bison +include $(GBUILDDIR)/platform/com_GCC_defs.mk + +# Darwin mktemp -t expects a prefix, not a pattern +gb_MKTEMP := /usr/bin/mktemp -t gbuild. gb_OSDEFS := \ -D$(OS) \ @@ -56,35 +54,18 @@ gb_OSDEFS := \ -DNO_PTHREAD_PRIORITY \ $(EXTRA_CDEFS) \ -gb_COMPILERDEFS := \ - -D$(COM) \ - -DCPPU_ENV=gcc3 \ - -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \ - -gb_CPUDEFS := -DARM32 - gb_CFLAGS := \ - -Wall \ - -Wendif-labels \ - -Wextra \ + $(gb_CFLAGS_COMMON) \ -Wshadow \ - -fmessage-length=0 \ - -fno-common \ -fno-strict-aliasing \ - -pipe \ gb_CXXFLAGS := \ - -Wall \ - -Wendif-labels \ - -Wextra \ + $(gb_CXXFLAGS_COMMON) \ -Wno-ctor-dtor-privacy \ -Wno-non-virtual-dtor \ - -fmessage-length=0 \ - -fno-common \ -fno-strict-aliasing \ -fsigned-char \ -malign-natural \ - -pipe \ #-Wshadow \ break in compiler headers already #-fsigned-char \ might be removed? #-malign-natural \ might be removed? @@ -96,47 +77,10 @@ gb_OBJCXXFLAGS := -x objective-c++ $(gb_OBJC_OBJCXX_COMMON_FLAGS) gb_OBJCFLAGS := -x objective-c $(gb_OBJC_OBJCXX_COMMON_FLAGS) -ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) -gb_CFLAGS_WERROR := -Werror -DLIBO_WERROR -gb_CXXFLAGS_WERROR := -Werror -DLIBO_WERROR -endif - -gb_LinkTarget_EXCEPTIONFLAGS := \ - -DEXCEPTIONS_ON \ - -fexceptions \ - -fno-enforce-eh-specs \ - -gb_LinkTarget_NOEXCEPTIONFLAGS := \ - -DEXCEPTIONS_OFF \ - -fno-exceptions \ - gb_LinkTarget_LDFLAGS := \ $(subst -L../lib , ,$(SOLARLIB)) \ #man ld says: obsolete -Wl,-multiply_defined,suppress \ -ifneq ($(gb_DEBUGLEVEL),0) -gb_COMPILEROPTFLAGS := -O0 -else -gb_COMPILEROPTFLAGS := -O2 -endif - -gb_COMPILERNOOPTFLAGS := -O0 - -# Helper class - -gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) - -gb_Helper_set_ld_path := DYLD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib - -# convert parameters filesystem root to native notation -# does some real work only on windows, make sure not to -# break the dummy implementations on unx* -define gb_Helper_convert_native -$(1) -endef - -gb_Helper_OUTDIRLIBDIR := $(OUTDIR)/lib - # YaccTarget class define gb_YaccTarget__command @@ -148,43 +92,6 @@ $(call gb_Helper_abbreviate_dirs,\ endef -# CObject class - -define gb_CObject__command -$(call gb_Output_announce,$(2),$(true),C ,3) -$(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $(1)) $(dir $(4)) && \ - $(gb_CC) \ - $(DEFS) \ - $(T_CFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE)) -endef - - -# CxxObject class - -# N.B: $(T_CXXFLAGS) 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)) $(dir $(4)) && \ - $(gb_CXX) \ - $(DEFS) \ - $(T_CXXFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE_STL) $(INCLUDE)) -endef - - # ObjCxxObject class define gb_ObjCxxObject__command @@ -234,9 +141,6 @@ gb_LinkTarget_OBJCXXFLAGS += -g gb_LinkTarget_OBJCFLAGS += -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%.a,-l%,$(foreach lib,$(filter-out $(gb_Library__FRAMEWORKS) $(gb_Library_UNOLIBS_OOO),$(1)),$(call gb_Library_get_filename,$(lib)))) \ @@ -433,4 +337,6 @@ gb_UnoApiTarget_REGVIEWCOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib SOLA # Python gb_PYTHON_PRECOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib +include $(GBUILDDIR)/platform/com_GCC_class.mk + # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 616550b69c33..45fb9a7f46b0 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -29,26 +29,22 @@ GUI := UNX COM := GCC +gb_SDKDIR := $(MACOSX_SDK_PATH) + +ifeq ($(CPUNAME),POWERPC) +gb_CPUDEFS := -DPPC +else +gb_CPUDEFS := -DX86 +endif + +gb_COMPILERDEFAULTOPTFLAGS := -O2 + +include $(GBUILDDIR)/platform/com_GCC_defs.mk + + # Darwin mktemp -t expects a prefix, not a pattern gb_MKTEMP ?= /usr/bin/mktemp -t gbuild. -gb_CC := cc -gb_CXX := g++ -gb_GCCP := gcc -gb_AR := ar -gb_AWK := awk -gb_CLASSPATHSEP := : -gb_YACC := bison - -# 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_CCVER := $(shell $(gb_CC) -dumpversion | $(gb_AWK) -F. -- '{ print $$1*10000+$$2*100+$$3 }') gb_OSDEFS := \ -D$(OS) \ @@ -62,46 +58,28 @@ gb_OSDEFS := \ -DMAC_OS_X_VERSION_MAX_ALLOWED=$(MAC_OS_X_VERSION_MAX_ALLOWED) \ $(EXTRA_CDEFS) \ -gb_COMPILERDEFS := \ - -D$(COM) \ + +gb_COMPILERDEFS += \ -DHAVE_GCC_VISIBILITY_FEATURE \ - -DCPPU_ENV=gcc3 \ - -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \ -ifeq ($(CPUNAME),POWERPC) -gb_CPUDEFS := -DPPC -else -gb_CPUDEFS := -DX86 -endif -gb_SDKDIR := $(MACOSX_SDK_PATH) gb_CFLAGS := \ -isysroot $(gb_SDKDIR) \ - -Wall \ - -Wendif-labels \ - -Wextra \ + $(gb_CFLAGS_COMMON) \ -Wshadow \ -fPIC \ - -fmessage-length=0 \ - -fno-common \ -fno-strict-aliasing \ - -pipe \ gb_CXXFLAGS := \ -isysroot $(gb_SDKDIR) \ - -Wall \ - -Wendif-labels \ - -Wextra \ + $(gb_CXXFLAGS_COMMON) \ + -fPIC \ -Wno-ctor-dtor-privacy \ -Wno-non-virtual-dtor \ - -fPIC \ - -fmessage-length=0 \ - -fno-common \ -fno-strict-aliasing \ -fsigned-char \ -malign-natural \ - -pipe \ #-Wshadow \ break in compiler headers already #-fsigned-char \ might be removed? #-malign-natural \ might be removed? @@ -120,24 +98,6 @@ gb_OBJCXXFLAGS := -x objective-c++ -fobjc-exceptions gb_OBJCFLAGS := -x objective-c -ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) -gb_CFLAGS_WERROR := -Werror -DLIBO_WERROR -gb_CXXFLAGS_WERROR := -Werror -DLIBO_WERROR -endif - -ifeq ($(ENABLE_LTO),TRUE) -gb_Library_LTOFLAGS := -flto -endif - -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)) \ @@ -153,21 +113,6 @@ endif gb_COMPILERNOOPTFLAGS := -O0 -# Helper class - -gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) - -gb_Helper_set_ld_path := DYLD_LIBRARY_PATH=$(OUTDIR)/lib - -# convert parameters filesystem root to native notation -# does some real work only on windows, make sure not to -# break the dummy implementations on unx* -define gb_Helper_convert_native -$(1) -endef - -gb_Helper_OUTDIRLIBDIR := $(OUTDIR)/lib - # YaccTarget class ifeq ($(CPUNAME),POWERPC) @@ -194,44 +139,6 @@ $(call gb_Helper_abbreviate_dirs,\ endef endif -# CObject class - -define gb_CObject__command -$(call gb_Output_announce,$(2),$(true),C ,3) -$(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $(1)) $(dir $(4)) && \ - $(gb_CC) \ - $(DEFS) \ - $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_LTOFLAGS)) \ - $(T_CFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE)) -endef - - -# CxxObject class - -# N.B: $(CXXFLAGS) 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)) $(dir $(4)) && \ - $(gb_CXX) \ - $(DEFS) \ - $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_LTOFLAGS)) \ - $(T_CXXFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE_STL) $(INCLUDE)) -endef - # ObjCxxObject class @@ -298,9 +205,6 @@ gb_LinkTarget_OBJCFLAGS += -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),$(1)),$(call gb_Library_get_filename,$(lib)))) \ @@ -526,4 +430,6 @@ gb_UnoApiTarget_REGVIEWCOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$( # Python gb_PYTHON_PRECOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib +include $(GBUILDDIR)/platform/com_GCC_class.mk + # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 0cf599154cb3..bc3f61a5b52e 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -29,24 +29,10 @@ GUI := UNX COM := GCC +include $(GBUILDDIR)/platform/com_GCC_defs.mk + gb_MKTEMP := mktemp -t gbuild.XXXXXX -gb_CC := gcc -gb_CXX := g++ -gb_GCCP := gcc -gb_AR := ar -gb_AWK := awk -gb_CLASSPATHSEP := : -gb_YACC := bison - -# 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 ifneq ($(origin AR),default) gb_AR := $(AR) endif @@ -62,34 +48,19 @@ ifeq ($(GXX_INCLUDE_PATH),) GXX_INCLUDE_PATH=$(COMPATH)/include/c++/$(shell gcc -dumpversion) endif -gb_COMPILERDEFS := \ - -D$(COM) \ - -DCPPU_ENV=gcc3 \ - -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \ - gb_CFLAGS := \ - -Wall \ + $(gb_CFLAGS_COMMON) \ + -fPIC \ -Wdeclaration-after-statement \ - -Wendif-labels \ - -Wextra \ -Wshadow \ - -fPIC \ - -fmessage-length=0 \ - -fno-common \ - -pipe \ gb_CXXFLAGS := \ - -Wall \ - -Wendif-labels \ - -Wextra \ + $(gb_CXXFLAGS_COMMON) \ + -fPIC \ -Wshadow \ -Wsign-promo \ -Woverloaded-virtual \ -Wno-non-virtual-dtor \ - -fPIC \ - -fmessage-length=0 \ - -fno-common \ - -pipe \ ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE) gb_COMPILERDEFS += \ @@ -128,11 +99,6 @@ gb_CFLAGS += -fno-strict-aliasing gb_CXXFLAGS += -fno-strict-aliasing endif -ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) -gb_CFLAGS_WERROR := -Werror -DLIBO_WERROR -gb_CXXFLAGS_WERROR := -Werror -DLIBO_WERROR -endif - ifeq ($(HAVE_CXX0X),TRUE) #Currently, as well as for its own merits, c++11/c++0x mode allows use to use #a template for SAL_N_ELEMENTS to detect at compiler time its misuse @@ -151,7 +117,6 @@ endif endif ifeq ($(ENABLE_LTO),TRUE) -gb_Library_LTOFLAGS := -flto gb_LinkTarget_LDFLAGS += -fuse-linker-plugin $(gb_COMPILERDEFAULTOPTFLAGS) endif @@ -161,14 +126,6 @@ gb_CFLAGS += --sysroot=$(SYSBASE) gb_LinkTarget_LDFLAGS += \ -Wl,--sysroot=$(SYSBASE) endif -gb_LinkTarget_EXCEPTIONFLAGS := \ - -DEXCEPTIONS_ON \ - -fexceptions \ - -fno-enforce-eh-specs \ - -gb_LinkTarget_NOEXCEPTIONFLAGS := \ - -DEXCEPTIONS_OFF \ - -fno-exceptions \ gb_LinkTarget_LDFLAGS += \ -Wl,-rpath-link,$(SYSBASE)/lib:$(SYSBASE)/usr/lib \ @@ -209,31 +166,6 @@ gb_DEBUG_CFLAGS := -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline gb_COMPILERNOOPTFLAGS := -O0 -# Helper class - -gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) - -ifeq ($(OS_FOR_BUILD),MACOSX) -gb_Helper_LIBRARY_PATH_VAR := DYLD_LIBRARY_PATH -else ifeq ($(OS_FOR_BUILD),WNT) -# In theory possible if cross-compiling to some Unix from Windows, -# in practice strongly discouraged to even try that -gb_Helper_LIBRARY_PATH_VAR := PATH -else -gb_Helper_LIBRARY_PATH_VAR := LD_LIBRARY_PATH -endif - -gb_Helper_set_ld_path := $(gb_Helper_LIBRARY_PATH_VAR)=$(OUTDIR_FOR_BUILD)/lib - -# convert parameters filesystem root to native notation -# does some real work only on windows, make sure not to -# break the dummy implementations on unx* -define gb_Helper_convert_native -$(1) -endef - -gb_Helper_OUTDIRLIBDIR := $(OUTDIR)/lib - # YaccTarget class define gb_YaccTarget__command @@ -244,45 +176,6 @@ $(call gb_Helper_abbreviate_dirs,\ endef -# CObject class - -# $(call gb_CObject__command,object,relative-source,source,dep-file) -define gb_CObject__command -$(call gb_Output_announce,$(2),$(true),C ,3) -$(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $(1)) $(dir $(4)) && \ - $(gb_CC) \ - $(DEFS) \ - $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_LTOFLAGS)) \ - $(T_CFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE)) -endef - - -# CxxObject class - -# $(call gb_CxxObject__command,object,relative-source,source,dep-file) -define gb_CxxObject__command -$(call gb_Output_announce,$(2),$(true),CXX,3) -$(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $(1)) $(dir $(4)) && \ - $(gb_CXX) \ - $(DEFS) \ - $(if $(filter Library,$(TARGETTYPE)),$(gb_Library_LTOFLAGS)) \ - $(T_CXXFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE_STL) $(INCLUDE)) -endef - # AsmObject class @@ -327,9 +220,6 @@ gb_LinkTarget_CXXFLAGS += -ggdb2 gb_LinkTarget_CFLAGS += -ggdb2 endif -gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) -gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC))) - # note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10 # we want to use @$(extraobjectlist) in the long run define gb_LinkTarget__command_dynamiclink @@ -525,4 +415,6 @@ gb_UnoApiTarget_REGVIEWCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR) # Python gb_PYTHON_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME=$(OUTDIR)/lib/python PYTHONPATH=$(OUTDIR)/lib/python:$(OUTDIR)/lib/python/lib-dynload +include $(GBUILDDIR)/platform/com_GCC_class.mk + # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/winmingw.mk b/solenv/gbuild/platform/winmingw.mk index ea3ae756dbb4..c25ef6f21e3e 100644 --- a/solenv/gbuild/platform/winmingw.mk +++ b/solenv/gbuild/platform/winmingw.mk @@ -29,17 +29,15 @@ GUI := WNT COM := GCC +gb_COMPILERDEFAULTOPTFLAGS := -Os +gb_CPUDEFS := -D_M_IX86 + +include $(GBUILDDIR)/platform/com_GCC_defs.mk + gb_TMPDIR:=$(if $(TMPDIR),$(TMPDIR),/tmp) gb_MKTEMP := mktemp --tmpdir=$(gb_TMPDIR) gbuild.XXXXXX -gb_CC := $(CC) -gb_CXX := $(CXX) -gb_AR := $(shell $(CC) -print-prog-name=ar) -gb_AWK := awk -gb_CLASSPATHSEP := : -gb_YACC := bison gb_RC := $(WINDRES) -gb_CCVER := $(shell $(gb_CC) -dumpversion | $(gb_AWK) -F. -- '{ print $$1*10000+$$2*100+$$3 }') gb_OSDEFS := \ -DWINVER=0x0500 \ @@ -52,17 +50,12 @@ ifeq ($(GXX_INCLUDE_PATH),) GXX_INCLUDE_PATH=$(COMPATH)/include/c++/$(shell gcc -dumpversion) endif -gb_COMPILERDEFS := \ - -DGCC \ - -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \ - -DCPPU_ENV=gcc3 \ +gb_COMPILERDEFS += \ -D_MT \ -D_NATIVE_WCHAR_T_DEFINED \ -D_MSC_EXTENSIONS \ -D_FORCENAMELESSUNION \ -gb_CPUDEFS := -D_M_IX86 - gb_RCDEFS := \ -DWINVER=0x0400 \ -DWIN32 \ @@ -70,49 +63,32 @@ gb_RCDEFS := \ gb_RCFLAGS := \ -V -gb_CFLAGS := \ - -Wall \ +gb_CFLAGS += \ + $(gb_CFLAGS_COMMON) \ -Wdeclaration-after-statement \ - -Wendif-labels \ - -Wextra \ - -fmessage-length=0 \ -fno-strict-aliasing \ - -pipe \ gb_CXXFLAGS := \ - -Wall \ - -Wendif-labels \ - -Wextra \ + $(gb_CXXFLAGS_COMMON) \ -Wno-ctor-dtor-privacy \ -Wno-non-virtual-dtor \ -Wreturn-type \ -Wshadow \ -Wuninitialized \ - -fmessage-length=0 \ -fno-strict-aliasing \ - -pipe \ -ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) -gb_CFLAGS_WERROR := -Werror -DLIBO_WERROR -gb_CXXFLAGS_WERROR := -Werror -DLIBO_WERROR -endif ifneq ($(SYSBASE),) gb_CXXFLAGS += --sysroot=$(SYSBASE) gb_CFLAGS += --sysroot=$(SYSBASE) endif -gb_LinkTarget_EXCEPTIONFLAGS := \ - -DEXCEPTIONS_ON \ - -fexceptions \ + +gb_LinkTarget_EXCEPTIONFLAGS += \ -fno-enforce-eh-specs \ gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS) -gb_LinkTarget_NOEXCEPTIONFLAGS := \ - -DEXCEPTIONS_OFF \ - -fno-exceptions \ - gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS := $(gb_LinkTarget_NOEXCEPTIONFLAGS) gb_LinkTarget_LDFLAGS := \ @@ -126,14 +102,6 @@ gb_LinkTarget_LDFLAGS += -shared-libgcc endif gb_DEBUG_CFLAGS := -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline -ifneq ($(gb_DEBUGLEVEL),0) - -gb_COMPILEROPTFLAGS := -O0 -else -gb_COMPILEROPTFLAGS := -Os -endif - -gb_COMPILERNOOPTFLAGS := -O0 gb_STDLIBS := \ mingwthrd \ @@ -152,16 +120,6 @@ gb_Helper_WORKDIR_NATIVE := $(WORKDIR) gb_Helper_OUTDIR_NATIVE := $(OUTDIR) gb_Helper_REPODIR_NATIVE := $(REPODIR) -gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) - -# Set the proper enirotment variable so that our BUILD platform -# build-time shared libraries are found. -ifeq ($(OS_FOR_BUILD),MACOSX) -gb_Helper_set_ld_path := DYLD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib -else -gb_Helper_set_ld_path := LD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib -endif - # Convert parameters filesystem root to native notation # does some real work only on Windows, and this file is for # cross-compilation. @@ -169,8 +127,6 @@ define gb_Helper_convert_native $(1) endef -gb_Helper_OUTDIRLIBDIR := $(OUTDIR)/bin - # YaccTarget class define gb_YaccTarget__command @@ -181,47 +137,6 @@ $(call gb_Helper_abbreviate_dirs,\ endef -# CObject class - -# We (LibreOffice) support MinGW only for cross-compilation. This is identical to -# gb_CObject__command in unxgcc.mk - -# $(call gb_CObject__command,object,relative-source,source,dep-file) -define gb_CObject__command -$(call gb_Output_announce,$(2),$(true),C ,3) -$(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $(1)) $(dir $(4)) && \ - $(gb_CC) \ - $(DEFS) \ - $(T_CFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE)) -endef - - -# CxxObject class - -# $(call gb_CxxObject__command,object,relative-source,source,dep-file) -define gb_CxxObject__command -$(call gb_Output_announce,$(2),$(true),CXX,3) -$(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $(1)) $(dir $(4)) && \ - $(gb_CXX) \ - $(DEFS) \ - $(T_CXXFLAGS) \ - -c $(3) \ - -o $(1) \ - -MMD -MT $(1) \ - -MP -MF $(4) \ - -I$(dir $(3)) \ - $(INCLUDE_STL) $(INCLUDE)) -endef - - # PrecompiledHeader class gb_PrecompiledHeader_EXT := .gch @@ -340,12 +255,9 @@ gb_LinkTarget_CXXFLAGS += -ggdb2 gb_LinkTarget_CFLAGS += -ggdb2 endif -gb_LinkTarget_INCLUDE :=\ - $(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) \ +gb_LinkTarget_INCLUDE +=\ $(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \ -gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC))) - define gb_LinkTarget__command_dynamiclinkexecutable $(call gb_Output_announce,$(2),$(true),LNK,4) $(call gb_Helper_abbreviate_dirs,\ @@ -677,4 +589,6 @@ gb_UnoApiTarget_REGVIEWCOMMAND := $(gb_Helper_set_ld_path) SOLARBINDIR=$(OUTDIR_ # Python gb_PYTHON_PRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin" PYTHONHOME="$(OUTDIR)/lib/python" PYTHONPATH="$(OUTDIR)/lib/python;$(OUTDIR)/lib/python/lib-dynload" +include $(GBUILDDIR)/platform/com_GCC_class.mk + # vim: set noet sw=4: |