bump product version to 4.1.6.2
[LibreOffice.git] / solenv / gbuild / UnoApi.mk
blobc3ee107903f7c29983e97329c117904f8fa8b072
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 gb_UnoApi_DOCDIR := $(gb_Package_SDKDIRNAME)/docs/common/ref
11 # NOTE: this is the output dir used in odk/CustomTarget_autodoc.mk
12 gb_UnoApi_SRCDOCDIR := $(call gb_CustomTarget_get_workdir,odk/docs/common/ref)
13 gb_UnoApi_ENABLE_INSTALL := $(and $(filter host,$(gb_Side)),$(filter ODK,$(BUILD_TYPE)))
15 .PHONY : $(call gb_UnoApi_get_clean_target,%)
16 $(call gb_UnoApi_get_clean_target,%) :
17 $(call gb_Helper_abbreviate_dirs,\
18 rm -f $(call gb_UnoApi_get_target,$*))
20 define gb_UnoApi_UnoApi
21 $(call gb_UnoApiTarget_UnoApiTarget,$(1))
22 $(call gb_UnoApiHeadersTarget_UnoApiHeadersTarget,$(1))
23 ifneq ($(gb_UnoApi_ENABLE_INSTALL),)
24 $(call gb_Package_Package_internal,$(1)_idl,$(SRCDIR))
25 $(call gb_Package_set_outdir,$(1)_idl,$(INSTDIR))
26 $(call gb_Package_Package_internal,$(1)_doc,$(gb_UnoApi_SRCDOCDIR))
27 $(call gb_Package_set_outdir,$(1)_doc,$(INSTDIR))
28 endif
30 $(call gb_UnoApiTarget_set_root,$(1),UCR)
32 $(call gb_UnoApi_get_target,$(1)) :| $(dir $(call gb_UnoApi_get_target,$(1))).dir
33 $(call gb_UnoApi_get_target,$(1)) : $(call gb_UnoApiTarget_get_target,$(1))
34 $(call gb_UnoApi_get_target,$(1)) : $(call gb_UnoApiHeadersTarget_get_target,$(1))
35 $(call gb_UnoApi_get_clean_target,$(1)) : $(call gb_UnoApiTarget_get_clean_target,$(1))
36 $(call gb_UnoApi_get_clean_target,$(1)) : $(call gb_UnoApiHeadersTarget_get_clean_target,$(1))
38 $(call gb_Deliver_add_deliverable,$(call gb_UnoApi_get_target,$(1)),$(call gb_UnoApiTarget_get_target,$(1)),$(1))
40 $$(eval $$(call gb_Module_register_target,$(call gb_UnoApi_get_target,$(1)),$(call gb_UnoApi_get_clean_target,$(1))))
41 $(call gb_Helper_make_userfriendly_targets,$(1),UnoApi)
43 endef
45 ifneq ($(gb_UnoApi_ENABLE_INSTALL),)
47 # Create a package of IDL files for putting into SDK.
49 # gb_UnoApi_package_idlfiles api
50 define gb_UnoApi_package_idlfiles
51 $(call gb_UnoApi_get_target,$(1)) : $(call gb_Package_get_target,$(1)_idl)
52 $(call gb_UnoApi_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(1)_idl)
54 endef
56 define gb_UnoApi__add_idlfile
57 $(call gb_Package_add_file,$(1)_idl,$(patsubst $(1)/%,$(gb_Package_SDKDIRNAME)/idl/%,$(2)),$(2))
59 endef
61 else # !gb_UnoApi_ENABLE_INSTALL
63 gb_UnoApi_package_idlfiles :=
64 gb_UnoApi__add_idlfile :=
66 endif
68 define gb_UnoApi__add_headerfile_impl
69 $(call gb_UnoApiHeadersTarget_add_headerfile,$(1),$(2),$(3))
71 endef
73 # Note: the expression in 3rd arg of call of gb_UnoApi__add_headerfile_impl
74 # removes the leftmost dir in the subpath .-)
75 define gb_UnoApi__add_headerfile
76 $(call gb_UnoApi__add_headerfile_impl,$(1),$(2),$(subst $() $(),/,$(wordlist 2,$(words $(subst /, ,$(2))),$(subst /, ,$(2)))))
78 endef
80 ifneq ($(gb_UnoApi_ENABLE_INSTALL),)
82 # gb_UnoApi__add_docfile_impl api htmlfile
83 define gb_UnoApi__add_docfile_impl
84 $(if $(filter-out com ooo org,$(firstword $(subst /, ,$(2)))),\
85 $(call gb_Output_error,gb_UnoApi__add_docfile_impl: unknown namespace: $(firstword $(subst /, ,$(2)))) \
87 $(call gb_Package_add_file,$(1)_doc,$(gb_UnoApi_DOCDIR)/$(2),$(2))
89 endef
91 # gb_UnoApi__add_docfile_direct api htmlfile
92 define gb_UnoApi__add_docfile_direct
93 $(call gb_UnoApi__add_docfile_impl,$(1),$(patsubst $(1)/%,%,$(2)))
95 endef
97 # gb_UnoApi__add_docfile_for_idl api idlfile has-xref?
98 define gb_UnoApi__add_docfile_for_idl
99 $(if $(filter-out modules %-modules,$(basename $(notdir $(2)))),\
100 $(call gb_UnoApi__add_docfile_direct,$(1),$(2).html) \
101 $(if $(3),$(call gb_UnoApi__add_docfile_direct,$(1),$(2)-xref.html)) \
104 endef
106 # gb_UnoApi__add_docfile api idlfile has-xref?
107 define gb_UnoApi__add_docfile
108 $(call gb_UnoApi__add_docfile_for_idl,$(1),$(2),$(3))
110 endef
112 # gb_UnoApi__add_docfiles api dir idlfiles has-xref?
113 define gb_UnoApi__add_docfiles
114 $(foreach idlfile,$(3),$(call gb_UnoApi__add_docfile_for_idl,$(1),$(2)/$(idlfile),$(3)))
116 endef
118 else # !gb_UnoApi_ENABLE_INSTALL
120 gb_UnoApi__add_docfile :=
121 gb_UnoApi__add_docfiles :=
123 endif
125 define gb_UnoApi__add_idlfile_noheader
126 $(call gb_UnoApi__add_idlfile,$(1),$(2).idl)
128 endef
130 define gb_UnoApi__add_idlfile_nohdl
131 $(call gb_UnoApi__add_idlfile_noheader,$(1),$(2))
132 $(call gb_UnoApi__add_headerfile,$(1),$(2).hpp)
134 endef
136 define gb_UnoApi__add_idlfile_full
137 $(call gb_UnoApi__add_idlfile_nohdl,$(1),$(2))
138 $(call gb_UnoApi__add_headerfile,$(1),$(2).hdl)
140 endef
142 # for interfaces, exceptions, structs, enums, constant groups
143 define gb_UnoApi_add_idlfile
144 $(call gb_UnoApiTarget_add_idlfile,$(1),$(2),$(3))
145 $(call gb_UnoApi__add_idlfile_full,$(1),$(2)/$(3))
146 $(call gb_UnoApi__add_docfile,$(1),$(2)/$(3),$(true))
148 endef
150 define gb_UnoApi_add_idlfiles
151 $(call gb_UnoApiTarget_add_idlfiles,$(1),$(2),$(3))
152 $(foreach idl,$(3),$(call gb_UnoApi__add_idlfile_full,$(1),$(2)/$(idl)))
153 $(call gb_UnoApi__add_docfiles,$(1),$(2),$(3),$(true))
155 endef
157 # for new-style services
158 define gb_UnoApi_add_idlfile_nohdl
159 $(call gb_UnoApiTarget_add_idlfile,$(1),$(2),$(3))
160 $(call gb_UnoApi__add_idlfile_nohdl,$(1),$(2)/$(3))
161 $(call gb_UnoApi__add_docfile,$(1),$(2)/$(3))
163 endef
165 define gb_UnoApi_add_idlfiles_nohdl
166 $(call gb_UnoApiTarget_add_idlfiles,$(1),$(2),$(3))
167 $(foreach idl,$(3),$(call gb_UnoApi__add_idlfile_nohdl,$(1),$(2)/$(idl)))
168 $(call gb_UnoApi__add_docfiles,$(1),$(2),$(3))
170 endef
172 # for old-style services and modules
173 define gb_UnoApi_add_idlfile_noheader
174 $(call gb_UnoApiTarget_add_idlfile,$(1),$(2),$(3))
175 $(call gb_UnoApi__add_idlfile_noheader,$(1),$(2)/$(3))
176 $(call gb_UnoApi__add_docfile,$(1),$(2)/$(3))
178 endef
180 define gb_UnoApi_add_idlfiles_noheader
181 $(call gb_UnoApiTarget_add_idlfiles,$(1),$(2),$(3))
182 $(foreach idl,$(3),$(call gb_UnoApi__add_idlfile_noheader,$(1),$(2)/$(idl)))
183 $(call gb_UnoApi__add_docfiles,$(1),$(2),$(3))
185 endef
187 define gb_UnoApi__use_api
188 $(call gb_UnoApiTarget_use_api,$(1),$(2))
189 $(call gb_UnoApiHeadersTarget_use_api,$(1),$(2))
190 $(call gb_UnoApi_get_target,$(1)) :| $(call gb_UnoApi_get_target,$(2))
192 endef
194 define gb_UnoApi_use_api
195 $(foreach rdb,$(2),$(call gb_UnoApi__use_api,$(1),$(rdb)))
197 endef
199 define gb_UnoApi_add_reference_rdbfile
200 $$(call gb_Output_error,gb_UnoApi_add_reference_rdbfile: use gb_UnoApi_set_reference_rdbfile instead.)
202 endef
204 define gb_UnoApi_set_reference_rdbfile
205 $(call gb_UnoApiTarget_set_reference_rdbfile,$(1),$(2))
207 endef
209 define gb_UnoApi_set_include
210 $(call gb_UnoApiTarget_set_include,$(1),$(2))
212 endef
214 # vim: set noet sw=4 ts=4: