Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / platform / com_GCC_class.mk
blobd358b367f65b2fcd181eb787215bf2a66a4c7162
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 define gb_cxx_dep_generation_options
12 -MMD -MT $(1) -MP -MF $(2)_
13 endef
14 define gb_cxx_dep_copy
15 && mv $(1)_ $(1)
16 endef
17 else
18 define gb_cxx_dep_generation_options
19 endef
20 define gb_cxx_dep_copy
21 endef
22 endif
24 # AsmObject class
26 gb_AsmObject_get_source = $(1)/$(2).s
28 # $(call gb_AsmObject__command,object,relative-source,source,dep-file)
29 define gb_AsmObject__command
30 $(call gb_Output_announce,$(2),$(true),ASM,3)
31 $(call gb_Helper_abbreviate_dirs,\
32 mkdir -p $(dir $(1)) $(dir $(4)) && cd $(SRCDIR) && \
33 $(gb_CC) \
34 -x assembler-with-cpp \
35 $(gb_LTOFLAGS) \
36 $(gb_AFLAGS) \
37 -c $(3) \
38 -o $(1)) \
39 $(INCLUDE) && \
40 echo "$(1) : $(3)" > $(4)
41 endef
43 # CObject class
45 # $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins)
46 define gb_CObject__command_pattern
47 $(call gb_Helper_abbreviate_dirs,\
48 mkdir -p $(dir $(1)) $(dir $(4)) && cd $(SRCDIR) && \
49 $(if $(5),$(gb_COMPILER_PLUGINS_SETUP)) \
50 $(if $(filter %.c %.m,$(3)), $(gb_CC), $(gb_CXX)) \
51 $(DEFS) \
52 $(gb_LTOFLAGS) \
53 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
54 $(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
55 $(if $(5),$(gb_COMPILER_PLUGINS)) \
56 $(2) \
57 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
58 -c $(3) \
59 -o $(1) \
60 $(call gb_cxx_dep_generation_options,$(1),$(4)) \
61 -I$(dir $(3)) \
62 $(INCLUDE) \
63 $(PCHFLAGS) \
64 $(call gb_cxx_dep_copy,$(4)) \
66 endef
68 # Used to run a compiler plugin tool.
69 # $(call gb_CObject__tool_command,relative-source,source)
70 define gb_CObject__tool_command
71 $(call gb_Output_announce,$(1).c,$(true),C ,3)
72 $(call gb_Helper_abbreviate_dirs,\
73 ICECC=no CCACHE_DISABLE=1 \
74 $(gb_CC) \
75 $(DEFS) \
76 $(gb_LTOFLAGS) \
77 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
78 $(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
79 $(gb_COMPILER_PLUGINS) \
80 $(T_CFLAGS) $(T_CFLAGS_APPEND) \
81 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
82 -c $(2) \
83 -I$(dir $(2)) \
84 $(INCLUDE) \
86 endef
87 define gb_ObjCObject__tool_command
88 $(call gb_Output_announce,$(1).m,$(true),OCC,3)
89 $(call gb_Helper_abbreviate_dirs,\
90 ICECC=no CCACHE_DISABLE=1 \
91 $(gb_CC) \
92 $(DEFS) \
93 $(gb_LTOFLAGS) \
94 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
95 $(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
96 $(gb_COMPILER_PLUGINS) \
97 $(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
98 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
99 -c $(2) \
100 -I$(dir $(2)) \
101 $(INCLUDE) \
103 endef
105 # Used to run a compiler plugin tool.
106 # $(call gb_CxxObject__tool_command,relative-source,source)
107 define gb_CxxObject__tool_command
108 $(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
109 $(call gb_Helper_abbreviate_dirs,\
110 ICECC=no CCACHE_DISABLE=1 \
111 $(gb_CXX) \
112 $(DEFS) \
113 $(gb_LTOFLAGS) \
114 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
115 $(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
116 $(gb_COMPILER_PLUGINS) \
117 $(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
118 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
119 -c $(2) \
120 -I$(dir $(2)) \
121 $(INCLUDE) \
123 endef
124 define gb_ObjCxxObject__tool_command
125 $(call gb_Output_announce,$(1).mm,$(true),OCX,3)
126 $(call gb_Helper_abbreviate_dirs,\
127 ICECC=no CCACHE_DISABLE=1 \
128 $(gb_CXX) \
129 $(DEFS) \
130 $(gb_LTOFLAGS) \
131 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
132 $(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
133 $(gb_COMPILER_PLUGINS) \
134 $(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
135 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
136 -c $(2) \
137 -I$(dir $(2)) \
138 $(INCLUDE) \
140 endef
142 define gb_SrsPartTarget__command_dep
143 $(call gb_Helper_abbreviate_dirs,\
144 mkdir -p $(dir $(call gb_SrsPartTarget_get_dep_target,$(1))) && cd $(SRCDIR) && \
145 $(gb_GCCP) \
146 -MM -MP -MT $(call gb_SrsPartTarget_get_target,$(1)) \
147 $(INCLUDE) \
148 $(DEFS) \
149 -c -x c++-header $(2) \
150 -o $(call gb_SrsPartTarget_get_dep_target,$(1)))
151 endef
153 # PrecompiledHeader class
155 ifeq ($(COM_GCC_IS_CLANG),TRUE)
156 gb_PrecompiledHeader_get_enableflags = -include-pch $(call gb_PrecompiledHeader_get_target,$(1))
157 else
158 gb_PrecompiledHeader_get_enableflags = -include $(notdir $(subst .gch,,$(call gb_PrecompiledHeader_get_target,$(1)))) \
159 -I $(dir $(call gb_PrecompiledHeader_get_target,$(1)))
160 endif
162 # Clang and gcc do not need any extra .o file for PCH
163 gb_PrecompiledHeader_get_objectfile =
165 define gb_PrecompiledHeader__command
166 $(call gb_Output_announce,$(2),$(true),PCH,1)
167 $(call gb_Helper_abbreviate_dirs,\
168 mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2))) && \
169 $(gb_CXX) \
170 -x c++-header \
171 $(4) $(5) \
172 $(gb_COMPILERDEPFLAGS) \
173 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
174 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
175 $(6) \
176 $(call gb_cxx_dep_generation_options,$(1),$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2))) \
177 -c $(patsubst %.cxx,%.hxx,$(3)) \
178 -o$(1) \
179 $(call gb_cxx_dep_copy,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2))) \
181 endef
183 # YaccTarget class
185 define gb_YaccTarget__command
186 $(call gb_Output_announce,$(2),$(true),YAC,3)
187 $(call gb_Helper_abbreviate_dirs,\
188 mkdir -p $(dir $(3)) && \
189 $(gb_YACC) $(T_YACCFLAGS) -v --defines=$(4) -o $(5) $(1) && touch $(3) )
191 endef
193 # ExternalProject class
195 gb_ExternalProject_use_autoconf :=
196 gb_ExternalProject_use_nmake :=
198 # StaticLibrary class
200 gb_StaticLibrary_get_filename = lib$(1).a
201 gb_StaticLibrary_PLAINEXT := .a
202 gb_StaticLibrary_StaticLibrary_platform :=
204 gb_LinkTarget_get_linksearchpath_for_layer = \
205 -L$(WORKDIR)/LinkTarget/StaticLibrary \
206 -L$(call gb_Library_get_sdk_link_dir) \
207 $(foreach layer,\
208 $(subst +, ,$(patsubst $(1):%.,%,\
209 $(filter $(1):%.,$(gb_LinkTarget_LAYER_LINKPATHS)))),\
210 $(patsubst $(layer):%,-L%,\
211 $(filter $(layer):%,$(gb_Library_LAYER_DIRS))))
214 gb_ICU_PRECOMMAND := $(call gb_Helper_extend_ld_path,$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib)
216 # UIConfig class
218 # Mac OS X sort(1) cannot read a response file
219 define gb_UIConfig__command
220 $(call gb_Helper_abbreviate_dirs,\
221 sort -u $(UI_IMAGELISTS) /dev/null > $@ \
224 endef
226 # vim: set noet sw=4 ts=4: