bump product version to 6.3.0.0.beta1
[LibreOffice.git] / solenv / gbuild / platform / com_GCC_class.mk
blob5ae811ad81c74474fad02eafa72990bd56e8dcf3
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 ifeq ($(gb_FULLDEPS),$(true))
11 ifneq (,$(CCACHE_HARDLINK))
12 # cannot move hardlink over itself, so create dep file directly, even if that
13 # might leave a broken file behind in case the build is interrupted forcefully
14 define gb_cxx_dep_generation_options
15 -MMD -MT $(1) -MP -MF $(2)
16 endef
17 define gb_cxx_dep_copy
18 endef
19 else
20 define gb_cxx_dep_generation_options
21 -MMD -MT $(1) -MP -MF $(2)_
22 endef
23 define gb_cxx_dep_copy
24 && mv $(1)_ $(1)
25 endef
26 endif
27 else
28 define gb_cxx_dep_generation_options
29 endef
30 define gb_cxx_dep_copy
31 endef
32 endif
34 # AsmObject class
36 gb_AsmObject_get_source = $(1)/$(2).s
38 # $(call gb_AsmObject__command,object,relative-source,source,dep-file)
39 define gb_AsmObject__command
40 $(call gb_Output_announce,$(2),$(true),ASM,3)
41 $(call gb_Helper_abbreviate_dirs,\
42 mkdir -p $(dir $(1)) $(dir $(4)) && cd $(SRCDIR) && \
43 $(gb_CC) \
44 -x assembler-with-cpp \
45 $(gb_LTOFLAGS) \
46 $(gb_AFLAGS) \
47 -c $(3) \
48 -o $(1)) \
49 $(INCLUDE) && \
50 echo "$(1) : $(3)" > $(4)
51 endef
53 # CObject class
55 # $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols)
56 define gb_CObject__command_pattern
57 $(call gb_Helper_abbreviate_dirs,\
58 mkdir -p $(dir $(1)) $(dir $(4)) && cd $(SRCDIR) && \
59 $(gb_COMPILER_SETUP) \
60 $(if $(5),$(gb_COMPILER_PLUGINS_SETUP)) \
61 $(if $(filter %.c %.m,$(3)), $(gb_CC), $(gb_CXX)) \
62 $(DEFS) \
63 $(gb_LTOFLAGS) \
64 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
65 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
66 $(if $(5),$(gb_COMPILER_PLUGINS)) \
67 $(if $(COMPILER_TEST),-fsyntax-only -ferror-limit=0 -Xclang -verify) \
68 $(if $(WARNINGS_DISABLED),$(call gb_Helper_disable_warnings,$(2)),$(2)) \
69 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
70 -c $(3) \
71 -o $(1) \
72 $(if $(COMPILER_TEST),,$(call gb_cxx_dep_generation_options,$(1),$(4))) \
73 $(INCLUDE) \
74 $(PCHFLAGS) \
75 $(if $(COMPILER_TEST),,$(call gb_cxx_dep_copy,$(4))) \
77 endef
79 # PrecompiledHeader class
81 ifeq ($(COM_IS_CLANG),TRUE)
82 gb_PrecompiledHeader_get_enableflags = -include-pch $(call gb_PrecompiledHeader_get_target,$(1),$(2))
83 gb_PrecompiledHeader_EXT := .pch
84 else
85 gb_PrecompiledHeader_get_enableflags = \
86 -include $(dir $(call gb_PrecompiledHeader_get_target,$(1),$(2)))$(notdir $(subst .gch,,$(call gb_PrecompiledHeader_get_target,$(1),$(2))))
87 gb_PrecompiledHeader_EXT := .gch
88 endif
90 # Clang and gcc do not need any extra .o file for PCH
91 gb_PrecompiledHeader_get_objectfile =
93 define gb_PrecompiledHeader__command
94 $(call gb_Output_announce,$(2),$(true),PCH,1)
95 $(call gb_Helper_abbreviate_dirs,\
96 mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(7))) && \
97 CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
98 $(gb_CXX) \
99 -x c++-header \
100 $(if $(WARNINGS_DISABLED),$(call gb_Helper_disable_warnings,$(4) $(5)),$(4) $(5)) \
101 $(gb_COMPILERDEPFLAGS) \
102 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
103 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
104 $(gb_NO_PCH_TIMESTAMP) \
105 $(6) \
106 $(call gb_cxx_dep_generation_options,$(1),$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(7))) \
107 -c $(patsubst %.cxx,%.hxx,$(3)) \
108 -o$(1) \
109 $(call gb_cxx_dep_copy,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(7))) \
111 endef
113 ifeq ($(COM_IS_CLANG),TRUE)
114 # Clang has -fno-pch-timestamp, just checksum the file for CCACHE_PCH_EXTSUM
115 define gb_PrecompiledHeader__sum_command
116 $(SHA256SUM) $(1) >$(1).sum
117 endef
118 else
119 # GCC does not generate the same .gch for the same input, so checksum the (preprocessed) input
120 define gb_PrecompiledHeader__sum_command
121 $(call gb_Helper_abbreviate_dirs,\
122 CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
123 $(gb_CXX) \
124 -x c++-header \
125 $(if $(WARNINGS_DISABLED),$(call gb_Helper_disable_warnings,$(4) $(5)),$(4) $(5)) \
126 $(gb_COMPILERDEPFLAGS) \
127 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
128 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
129 $(gb_NO_PCH_TIMESTAMP) \
130 $(6) \
131 -E $(patsubst %.cxx,%.hxx,$(3)) \
132 -o- \
133 | $(SHA256SUM) >$(1).sum \
135 endef
136 endif
139 # YaccTarget class
141 define gb_YaccTarget__command
142 $(call gb_Output_announce,$(2),$(true),YAC,3)
143 $(call gb_Helper_abbreviate_dirs,\
144 mkdir -p $(dir $(3)) && \
145 $(gb_YACC) $(T_YACCFLAGS) -v --defines=$(4) -o $(5) $(1) && touch $(3) )
147 endef
149 # CppunitTest class
151 ifeq ($(strip $(DEBUGCPPUNIT)),TRUE)
152 gb_CppunitTest_GDBTRACE := gdb -nx -ex "add-auto-load-safe-path $(INSTDIR)" -ex "set environment $(subst =, ,$(gb_CppunitTest_CPPTESTPRECOMMAND))" --batch --command=$(SRCDIR)/solenv/bin/gdbtrycatchtrace-stdout -return-child-result --args
153 endif
155 # ExternalProject class
157 gb_ExternalProject_use_autoconf :=
158 gb_ExternalProject_use_nmake :=
160 # StaticLibrary class
162 gb_StaticLibrary_get_filename = lib$(1).a
163 gb_StaticLibrary_PLAINEXT := .a
164 gb_StaticLibrary_StaticLibrary_platform :=
166 gb_LinkTarget_get_linksearchpath_for_layer = \
167 -L$(WORKDIR)/LinkTarget/StaticLibrary \
168 -L$(call gb_Library_get_sdk_link_dir) \
169 $(foreach layer,\
170 $(subst +, ,$(patsubst $(1):%.,%,\
171 $(filter $(1):%.,$(gb_LinkTarget_LAYER_LINKPATHS)))),\
172 $(patsubst $(layer):%,-L%,\
173 $(filter $(layer):%,$(gb_Library_LAYER_DIRS))))
176 gb_ICU_PRECOMMAND := $(call gb_Helper_extend_ld_path,$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib)
178 # UIConfig class
180 # macOS sort(1) cannot read a response file
181 define gb_UIConfig__command
182 $(call gb_Helper_abbreviate_dirs,\
183 $(SORT) -u $(UI_IMAGELISTS) /dev/null > $@ \
186 endef
188 define gb_UIConfig__gla11y_command
189 $(call gb_Helper_abbreviate_dirs,\
190 $(gb_UIConfig_LXML_PATH) $(gb_Helper_set_ld_path) \
191 $(call gb_ExternalExecutable_get_command,python) \
192 $(gb_UIConfig_gla11y_SCRIPT) $(gb_UIConfig_gla11y_PARAMETERS) -o $@ $(UIFILES)
195 endef
197 # vim: set noet sw=4 ts=4: