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 .
23 # gb_Executable_Executable_platform
25 gb_Executable_LAYER_DIRS
:= \
26 UREBIN
:$(INSTROOT
)/$(LIBO_URE_BIN_FOLDER
) \
27 OOO
:$(INSTROOT
)/$(LIBO_BIN_FOLDER
) \
28 SDKBIN
:$(INSTDIR
)/$(SDKDIRNAME
)/bin \
29 NONE
:$(gb_Executable_BINDIR
) \
31 gb_Executable_LAYER_DIRS_FOR_BUILD
:= \
32 UREBIN
:$(INSTROOT_FOR_BUILD
)/$(LIBO_URE_BIN_FOLDER_FOR_BUILD
) \
33 OOO
:$(INSTROOT_FOR_BUILD
)/$(LIBO_BIN_FOLDER_FOR_BUILD
) \
34 SDKBIN
:$(INSTDIR_FOR_BUILD
)/$(SDKDIRNAME_FOR_BUILD
)/bin \
35 NONE
:$(gb_Executable_BINDIR_FOR_BUILD
) \
37 $(dir $(call gb_Executable_get_runtime_target
,%)).
dir :
38 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
40 $(dir $(call gb_Executable_get_runtime_target
,%))%/.
dir :
41 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
43 $(call gb_Executable_get_runtime_target
,%) :
46 .PHONY
: $(call gb_Executable_get_clean_target
,%)
47 $(call gb_Executable_get_clean_target
,%) :
48 $(call gb_Helper_abbreviate_dirs
,\
49 rm -f
$(call gb_Executable_get_target
,$*) \
50 $(call gb_Executable_get_runtime_target
,$*) \
53 gb_Executable__get_dir_for_layer
= $(patsubst $(1):%,%,$(filter $(1):%,$(call gb_Executable_LAYER_DIRS
)))
54 gb_Executable__get_dir_for_layer_for_build
= $(patsubst $(1):%,%,$(filter $(1):%,$(call gb_Executable_LAYER_DIRS_FOR_BUILD
)))
55 gb_Executable__get_dir_for_exe
= $(call gb_Executable__get_dir_for_layer
,$(call gb_Executable_get_layer
,$(1)))
56 gb_Executable__get_dir_for_exe_for_build
= $(call gb_Executable__get_dir_for_layer_for_build
,$(call gb_Executable_get_layer
,$(1)))
58 define gb_Executable_Executable
59 $(call gb_Postprocess_register_target
,AllExecutables
,Executable
,$(1))
60 ifeq (,$$(findstring $(1),$$(gb_Executable_KNOWN
)))
61 $$(eval
$$(call gb_Output_info
,Currently known executables
: $(sort $(gb_Executable_KNOWN
)),ALL
))
62 $$(eval
$$(call gb_Output_error
,Executable
$(1) must be registered in Repository.mk or RepositoryExternal.mk
))
64 $(call gb_Executable__Executable_impl
,$(1),$(call gb_Executable_get_linktarget
,$(1)))
68 # call gb_Executable__Executable_impl,exe,linktarget
69 define gb_Executable__Executable_impl
70 $(call gb_LinkTarget_LinkTarget
,$(2),Executable_
$(1),$(call gb_Executable_get_layer
,$(1)))
71 $(call gb_LinkTarget_set_targettype
,$(2),Executable
)
72 $(call gb_LinkTarget_add_libs
,$(2),$(gb_STDLIBS
))
73 $(call gb_Executable_get_runtime_target
,$(1)) :|
$(dir $(call gb_Executable_get_runtime_target
,$(1))).
dir
74 $(call gb_Executable_get_runtime_target
,$(1)) : $(call gb_Executable_get_target_for_build
,$(1))
75 $(call gb_Executable_get_clean_target
,$(1)) : $(call gb_LinkTarget_get_clean_target
,$(2))
76 $(call gb_Executable_get_clean_target
,$(1)) : AUXTARGETS
:=
77 $(call gb_Executable_Executable_platform
,$(1),$(2),$(gb_Executable_BINDIR
)/$(1).lib
)
79 $$(eval
$$(call gb_Module_register_target
,$(call gb_Executable_get_target
,$(1)),$(call gb_Executable_get_clean_target
,$(1))))
80 $(call gb_Helper_make_userfriendly_targets
,$(1),Executable
)
84 define gb_Executable_set_targettype_gui
85 $(call gb_LinkTarget_get_target
,$(call gb_Executable_get_linktarget
,$(1))) : TARGETGUI
:= $(2)
88 # forward the call to the gb_LinkTarget implementation
89 # (note: because the function name is in $(1), the other args are shifted by 1)
90 define gb_Executable__forward_to_Linktarget
91 $(call gb_LinkTarget_
$(subst gb_Executable_
,,$(1)),$(call gb_Executable_get_linktarget
,$(2)),$(3),$(4),Executable_
$(2))
95 # copy pasta for forwarding: this could be (and was) done more elegantly, but
96 # these here can be found by both git grep and ctags
97 gb_Executable_add_cobject
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
98 gb_Executable_add_cobjects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
99 gb_Executable_add_cxxobject
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
100 gb_Executable_add_cxxobjects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
101 gb_Executable_add_objcobject
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
102 gb_Executable_add_objcobjects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
103 gb_Executable_add_objcxxobject
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
104 gb_Executable_add_objcxxobjects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
105 gb_Executable_add_cxxclrobject
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
106 gb_Executable_add_cxxclrobjects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
107 gb_Executable_add_grammar
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
108 gb_Executable_add_grammars
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
109 gb_Executable_add_scanner
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
110 gb_Executable_add_scanners
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
111 gb_Executable_add_exception_objects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
112 gb_Executable_add_generated_cobjects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
113 gb_Executable_add_generated_exception_objects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
114 gb_Executable_add_cflags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
115 gb_Executable_add_cxxflags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
116 gb_Executable_add_objcflags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
117 gb_Executable_add_objcxxflags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
118 gb_Executable_add_cxxclrflags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
119 gb_Executable_add_defs
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
120 gb_Executable_set_include
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
121 gb_Executable_add_ldflags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
122 gb_Executable_set_ldflags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
123 gb_Executable_set_x86
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
124 gb_Executable_add_libs
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
125 gb_Executable_disable_standard_system_libs
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
126 gb_Executable_use_system_darwin_frameworks
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
127 gb_Executable_use_system_win32_libs
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
128 gb_Executable_set_library_path_flags
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
129 gb_Executable_use_api
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
130 gb_Executable_use_sdk_api
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
131 gb_Executable_use_udk_api
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
132 gb_Executable_use_internal_api
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
133 gb_Executable_use_internal_bootstrap_api
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
134 gb_Executable_use_internal_comprehensive_api
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
135 gb_Executable_use_library_objects
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
136 gb_Executable_use_libraries
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
137 gb_Executable_use_static_libraries
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
138 gb_Executable_use_external
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
139 gb_Executable_use_externals
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
140 gb_Executable_use_custom_headers
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
141 gb_Executable_use_package
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
142 gb_Executable_use_packages
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
143 gb_Executable_use_unpacked
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
144 gb_Executable_add_sdi_headers
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
145 gb_Executable_set_precompiled_header
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
146 gb_Executable_reuse_precompiled_header
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
147 gb_Executable_use_common_precompiled_header
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
148 gb_Executable_add_nativeres
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
149 gb_Executable_set_warnings_not_errors
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
150 gb_Executable_set_warnings_disabled
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
151 gb_Executable_set_external_code
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
152 gb_Executable_set_generated_cxx_suffix
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
153 gb_Executable_use_clang
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
154 gb_Executable_set_clang_precompiled_header
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
155 gb_Executable_use_glxtest
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
156 gb_Executable_use_vclmain
= $(call gb_Executable__forward_to_Linktarget
,$(0),$(1),$(2),$(3))
160 # Add dependencies needed for running the executable
162 # gb_Executable_add_runtime_dependencies executable dependencies
163 define gb_Executable_add_runtime_dependencies
164 $(call gb_Executable_get_runtime_target
,$(1)) : $(2)
168 # vim: set noet sw=4: