bump product version to 4.1.6.2
[LibreOffice.git] / solenv / gbuild / Executable.mk
blob7663343313b305cd5f1c0347c7df6ec52f1a19f3
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/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # Executable class
22 # defined by platform
23 # gb_Executable_Executable_platform
25 # NOTE: SDKBIN executables are already packaged in module odk
26 gb_Executable_LAYER_DIRS := \
27 OOO:program \
28 UREBIN:ure/bin
30 $(dir $(call gb_Executable_get_runtime_target,%)).dir :
31 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
33 $(dir $(call gb_Executable_get_runtime_target,%))%/.dir :
34 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
36 $(call gb_Executable_get_runtime_target,%) : $(call gb_Executable_get_target_for_build,%)
37 touch $@
39 .PHONY : $(call gb_Executable_get_clean_target,%)
40 $(call gb_Executable_get_clean_target,%) :
41 $(call gb_Helper_abbreviate_dirs,\
42 rm -f $(call gb_Executable_get_target,$*) \
43 $(call gb_Executable_get_runtime_target,$*) \
44 $(AUXTARGETS))
46 gb_Executable_get_packagename = Executable/$(1)
48 gb_Executable__get_dir_for_layer = $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Executable_LAYER_DIRS)))
49 gb_Executable__get_instdir = $(call gb_Executable__get_dir_for_layer,$(call gb_Executable_get_layer,$(1)))
51 define gb_Executable_Executable
52 $(call gb_Postprocess_get_target,AllExecutables) : $(call gb_Executable_get_target,$(1))
53 ifeq (,$$(findstring $(1),$$(gb_Executable_KNOWN)))
54 $$(eval $$(call gb_Output_info,Currently known executables: $(sort $(gb_Executable_KNOWN)),ALL))
55 $$(eval $$(call gb_Output_error,Executable $(1) must be registered in Repository.mk))
56 endif
57 $(call gb_Executable__Executable_impl,$(1),Executable/$(1)$(gb_Executable_EXT))
59 endef
61 define gb_Executable__Executable_impl
62 $(call gb_LinkTarget_LinkTarget,$(2),Executable_$(1))
63 $(call gb_LinkTarget_set_targettype,$(2),Executable)
64 $(call gb_LinkTarget_add_libs,$(2),$(gb_STDLIBS))
65 $(call gb_Executable_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) \
66 | $(dir $(call gb_Executable_get_target,$(1))).dir
67 $(call gb_Executable_get_runtime_target,$(1)) :| $(dir $(call gb_Executable_get_runtime_target,$(1))).dir
68 $(call gb_Executable_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
69 $(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS :=
70 $(call gb_Executable_Executable_platform,$(1),$(2))
72 ifneq ($(gb_RUNNABLE_INSTDIR),)
73 $(if $(filter $(call gb_Executable_get_layer,$(1)):%,$(gb_Executable_LAYER_DIRS)),\
74 $(call gb_Executable__Executable_package,$(1),$(call gb_Executable_get_packagename,$(1)),$(2),$(notdir $(call gb_Executable_get_target,$(1)))) \
76 endif
78 $$(eval $$(call gb_Module_register_target,$(call gb_Executable_get_target,$(1)),$(call gb_Executable_get_clean_target,$(1))))
79 $(call gb_Helper_make_userfriendly_targets,$(1),Executable)
80 $(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1))
82 endef
84 # gb_Executable__Executable_package executable package linktarget filename
85 define gb_Executable__Executable_package
86 $(call gb_Package_Package_internal,$(2),$(WORKDIR))
87 $(call gb_Package_set_outdir,$(2),$(INSTDIR))
88 $(call gb_Package_add_file,$(2),$(call gb_Executable__get_instdir,$(1))/$(4),$(subst $(WORKDIR)/,,$(call gb_LinkTarget_get_target,$(3))))
90 $(call gb_Executable_get_target,$(1)) :| $(call gb_Package_get_target,$(2))
91 $(call gb_Package_get_target,$(2)) : $(call gb_LinkTarget_get_target,$(3))
92 $(call gb_Executable_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(2))
94 endef
96 define gb_Executable_set_targettype_gui
97 $(call gb_LinkTarget_get_target,Executable/$(1)$(gb_Executable_EXT)) : TARGETGUI := $(2)
98 endef
100 # The auxtarget is delivered via the rule in Package.mk.
101 # gb_Executable_add_auxtarget executable outdirauxtarget
102 define gb_Executable_add_auxtarget
103 $(call gb_LinkTarget_add_auxtarget,$(call gb_Executable_get_linktargetname,$(1)),$(dir $(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktargetname,$(1))))/$(notdir $(2)))
104 $(call gb_Executable_get_target,$(1)) : $(2)
105 $(2) : $(dir $(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktargetname,$(1))))/$(notdir $(2))
106 $(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS += $(2)
108 endef
110 define gb_Executable_forward_to_Linktarget
111 gb_Executable_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Executable_get_linktargetname,$$(1)),$$(2),$$(3),Executable_$$(1))
113 endef
115 $(eval $(foreach method,\
116 add_cobject \
117 add_cobjects \
118 add_cxxobject \
119 add_cxxobjects \
120 add_objcobject \
121 add_objcobjects \
122 add_objcxxobject \
123 add_objcxxobjects \
124 add_grammar \
125 add_grammars \
126 add_scanner \
127 add_scanners \
128 add_exception_objects \
129 add_noexception_objects \
130 add_generated_cobjects \
131 add_generated_cxxobjects \
132 add_generated_exception_objects \
133 add_cflags \
134 set_cflags \
135 add_cxxflags \
136 set_cxxflags \
137 add_objcflags \
138 add_objcxxflags \
139 set_objcflags \
140 set_objcxxflags \
141 add_defs \
142 set_defs \
143 set_include \
144 add_ldflags \
145 set_ldflags \
146 add_libs \
147 disable_standard_system_libs \
148 use_system_darwin_frameworks \
149 use_system_win32_libs \
150 set_library_path_flags \
151 use_api \
152 use_sdk_api \
153 use_udk_api \
154 add_internal_api \
155 use_internal_api \
156 add_internal_bootstrap_api \
157 use_internal_bootstrap_api \
158 add_internal_comprehensive_api \
159 use_internal_comprehensive_api \
160 add_linked_libs \
161 use_libraries \
162 add_linked_static_libs \
163 use_static_libraries \
164 use_external \
165 use_externals \
166 add_custom_headers \
167 use_custom_headers \
168 add_package_headers \
169 use_package \
170 use_packages \
171 use_unpacked \
172 add_sdi_headers \
173 set_precompiled_header \
174 add_precompiled_header \
175 add_nativeres \
176 set_warnings_not_errors \
177 set_generated_cxx_suffix \
179 $(call gb_Executable_forward_to_Linktarget,$(method))\
182 # Run-time use
184 # Add dependencies needed for running the executable
186 # gb_Executable_add_runtime_dependencies executable dependencies
187 define gb_Executable_add_runtime_dependencies
188 $(call gb_Executable_get_runtime_target,$(1)) : $(2)
190 endef
192 # vim: set noet sw=4: