1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
12 # OpenOffice.org is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License version 3
14 # only, as published by the Free Software Foundation.
16 # OpenOffice.org is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU Lesser General Public License version 3 for more details
20 # (a copy is included in the LICENSE file that accompanied this code).
22 # You should have received a copy of the GNU Lesser General Public License
23 # version 3 along with OpenOffice.org. If not, see
24 # <http://www.openoffice.org/license.html>
25 # for a copy of the LGPLv3 License.
27 #*************************************************************************
31 gb_UnoApiPartTarget_IDLCTARGET
:= $(call gb_Executable_get_target_for_build
,idlc
)
32 gb_UnoApiPartTarget_IDLCCOMMAND
:= $(gb_Helper_set_ld_path
) SOLARBINDIR
=$(OUTDIR_FOR_BUILD
)/bin
$(gb_UnoApiPartTarget_IDLCTARGET
)
34 # The .urd files are actually created by the gb_UnoApiPartTarget__command,
35 # invoked for the per-directory .done files.
36 # The reason why .urd files are tracked is so new files that are added are
37 # picked up and cause a rebuild, even if older than the .done file (also, as a
38 # convenience for users who delete them from the workdir by hand; this dummy
39 # rule plus the dependency from the .done target to the .urd file plus the
40 # sort/patsubst call in gb_UnoApiPartTarget__command cause command to be
41 # invoked with the .idl file corresponding to the .urd in that case.
42 # Touch the .urd file, so it is newer than the .done file, causing that to
43 # be rebuilt and overwriting the .urd file again.
44 # the .dir is for make 3.81, which ignores trailing /
45 $(dir $(call gb_UnoApiPartTarget_get_target
,))%/.
dir :
46 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
48 $(call gb_UnoApiPartTarget_get_target
,%.urd
) :
52 # - get idlc switch "-P" (generate .urd into package dir)
53 # - empty $? in headertarget?
55 define gb_UnoApiPartTarget__command
56 $(call gb_Output_announce
,$(2),$(true
),IDL
,2)
57 mkdir
-p
$(call gb_UnoApiPartTarget_get_target
,$(dir $(2))) && \
58 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),500,\
60 -M
$(basename $(call gb_UnoApiPartTarget_get_dep_target
,$(dir $(2)))) \
61 -O
$(call gb_UnoApiPartTarget_get_target
,$(dir $(2))) -verbose \
62 $(sort $(patsubst $(call gb_UnoApiPartTarget_get_target
,%.urd
),$(SRCDIR
)/%.idl
,$(3)))) && \
63 $(gb_UnoApiPartTarget_IDLCCOMMAND
) @
$${RESPONSEFILE} > /dev
/null
&& \
64 rm -f
$${RESPONSEFILE} && \
69 $(call gb_UnoApiPartTarget_get_target
,%.done
) : \
70 $(gb_UnoApiPartTarget_IDLCTARGET
)
71 $(call gb_UnoApiPartTarget__command
,$@
,$*,$(filter-out $(gb_UnoApiPartTarget_IDLCTARGET
),$?
))
73 ifeq ($(gb_FULLDEPS
),$(true
))
75 $(call gb_UnoApiPartTarget_get_dep_target
,%) :
76 $(if
$(wildcard $@
),touch
$@
,\
77 $(call gb_Object__command_dep
,$@
,$(call gb_UnoApiPartTarget_get_target
,$*.urd
)))
83 gb_UnoApiTarget_RDBMAKERTARGET
:= $(call gb_Executable_get_target_for_build
,rdbmaker
)
84 gb_UnoApiTarget_RDBMAKERCOMMAND
:= $(gb_Helper_set_ld_path
) SOLARBINDIR
=$(OUTDIR_FOR_BUILD
)/bin
$(gb_UnoApiTarget_RDBMAKERTARGET
)
85 gb_UnoApiTarget_REGCOMPARETARGET
:= $(call gb_Executable_get_target_for_build
,regcompare
)
86 gb_UnoApiTarget_REGCOMPARECOMMAND
:= $(gb_Helper_set_ld_path
) SOLARBINDIR
=$(OUTDIR_FOR_BUILD
)/bin
$(gb_UnoApiTarget_REGCOMPARETARGET
)
87 gb_UnoApiTarget_REGMERGETARGET
:= $(call gb_Executable_get_target_for_build
,regmerge
)
88 gb_UnoApiTarget_REGMERGECOMMAND
:= $(gb_Helper_set_ld_path
) SOLARBINDIR
=$(OUTDIR_FOR_BUILD
)/bin
$(gb_UnoApiTarget_REGMERGETARGET
)
89 gb_UnoApiTarget_XML2CMPTARGET
:= $(call gb_Executable_get_target_for_build
,xml2cmp
)
90 gb_UnoApiTarget_XML2CMPCOMMAND
:= $(gb_Helper_set_ld_path
) $(gb_UnoApiTarget_XML2CMPTARGET
)
92 gb_UnoApiTarget_XMLRDB
:= $(call gb_UnoApiTarget_get_target
,types
)
94 define gb_UnoApiTarget__get_types
95 $(if
$(1),$(foreach type
,$(shell $(gb_UnoApiTarget_XML2CMPCOMMAND
) -types stdout
$(1)),$(addprefix -T
,$(type
))))
98 define gb_UnoApiTarget__command_impl
99 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),500,$(2)) && \
100 $(1) @
$${RESPONSEFILE} && \
101 rm -f
$${RESPONSEFILE}
104 define gb_UnoApiTarget__regmerge_command_impl
105 $(call gb_UnoApiTarget__command_impl
,$(gb_UnoApiTarget_REGMERGECOMMAND
),$(1) $(2) $(3))
108 define gb_UnoApiTarget__rdbmaker_command_impl
109 $(call gb_UnoApiTarget__command_impl
,$(gb_UnoApiTarget_RDBMAKERCOMMAND
),-O
$(1) -B
$(2) -b
$(3) $(4) $(5))
112 define gb_UnoApiTarget__command
113 $(call gb_Output_announce
,$*,$(true
),UNO
,4)
114 mkdir
-p
$(dir $(1)) && \
115 $(if
$(UNOAPI_FILES
),\
116 $(call gb_UnoApiTarget__regmerge_command_impl
,$(1),$(UNOAPI_ROOT
),$(UNOAPI_FILES
)),\
117 $(if
$(UNOAPI_MERGE
),\
118 $(call gb_UnoApiTarget__regmerge_command_impl
,$(1),$(UNOAPI_ROOT
),$(UNOAPI_MERGE
)),\
119 $(call gb_UnoApiTarget__rdbmaker_command_impl
,$(1),UCR
,$(UNOAPI_ROOT
),\
120 $(call gb_UnoApiTarget__get_types
,$(UNOAPI_XML
)),$(gb_UnoApiTarget_XMLRDB
)))) \
121 $(if
$(UNOAPI_REFERENCE
), \
122 $(call gb_Output_announce
,$*,$(true
),DBc
,3) \
123 && $(gb_UnoApiTarget_REGCOMPARECOMMAND
) \
125 -r1
$(UNOAPI_REFERENCE
) \
129 define gb_UnoApiTarget__check_mode
130 $(if
$(or
$(and
$(1),$(2),$(3)),$(and
$(1),$(2)),$(and
$(2),$(3)),$(and
$(1),$(3))),\
131 $(error More than one mode of function of UnoApiTarget used
: this is not supported
),\
132 $(if
$(or
$(1),$(2),$(3)),,\
133 $(error Neither IDL files nor merged RDBs nor XML desc. were used
: nothing will be produced
)))
134 $(if
$(4),,$(error No root has been set for the rdb file
))
137 # FIXME cannot have a dependency on $(gb_UnoApiTarget_RDBMAKERTARGET) here
138 # because that leads to dependency cycle because rdbmaker depends on offapi
139 $(call gb_UnoApiTarget_get_target
,%) : $(gb_UnoApiTarget_XML2CMPTARGET
) \
140 $(gb_UnoApiTarget_REGCOMPARETARGET
) $(gb_UnoApiTarget_REGMERGETARGET
)
141 $(call gb_UnoApiTarget__check_mode
,$(UNOAPI_FILES
),$(UNOAPI_MERGE
),$(UNOAPI_XML
),$(UNOAPI_ROOT
))
142 $(call gb_UnoApiTarget__command
,$@
,$*)
144 .PHONY
: $(call gb_UnoApiTarget_get_clean_target
,%)
145 $(call gb_UnoApiTarget_get_clean_target
,%) :
146 $(call gb_Output_announce
,$*,$(false
),UNO
,4)
147 -$(call gb_Helper_abbreviate_dirs
,\
148 rm -f
$(call gb_UnoApiTarget_get_target
,$*))
149 -rm -rf
$(call gb_UnoApiTarget_get_dep_target
,$*) \
150 $(basename $(call gb_UnoApiPartTarget_get_dep_target
,$*)) \
151 $(call gb_UnoApiPartTarget_get_target
,$*)
153 # cat the deps of all IDLs in one file, then we need only open that one file
154 define gb_UnoApiTarget__command_dep
155 $(call gb_Output_announce
,IDL
:$(2),$(true
),DEP
,1)
156 $(call gb_Helper_abbreviate_dirs
,\
157 mkdir
-p
$(dir $(1)) && \
158 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),200,\
159 $(foreach idl
,$(patsubst %.idl
,%,$(3)),$(call gb_UnoApiPartTarget_get_dep_target
,$(idl
)))) && \
160 $(SOLARENV
)/bin
/concat-deps
$${RESPONSEFILE} > $(1)) && \
161 rm -f
$${RESPONSEFILE}
165 ifeq ($(gb_FULLDEPS
),$(true
))
167 $(call gb_UnoApiTarget_get_dep_target
,%) :
168 $(call gb_UnoApiTarget__command_dep
,$@
,$*,$(UNOAPI_IDLFILES
))
172 define gb_UnoApiTarget_UnoApiTarget
173 $(call gb_UnoApiTarget_get_target
,$(1)) : INCLUDE
:=
174 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_FILES
:=
175 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_MERGE
:=
176 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_XML
:=
177 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_REFERENCE
:=
178 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_ROOT
:=
180 ifeq ($(gb_FULLDEPS
),$(true
))
181 $(call gb_UnoApiTarget_get_dep_target
,$(1)) : UNOAPI_IDLFILES
:=
182 -include $(call gb_UnoApiTarget_get_dep_target
,$(1))
187 define gb_UnoApiTarget__add_urdfile
188 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_FILES
+= $(2)
189 $(call gb_UnoApiTarget_get_target
,$(1)) : $(2)
193 define gb_UnoApiTarget__add_idlfile
194 $(call gb_UnoApiPartTarget_get_target
,$(2)/idl.done
) : \
195 $(call gb_UnoApiPartTarget_get_target
,$(2)/$(3).urd
)
196 $(call gb_UnoApiTarget__add_urdfile
,$(1),$(call gb_UnoApiPartTarget_get_target
,$(2)/$(3).urd
))
197 $(call gb_UnoApiPartTarget_get_target
,$(2)/$(3).urd
) :| \
198 $(call gb_UnoApiPartTarget_get_target
,$(2)/.
dir)
200 ifeq ($(gb_FULLDEPS
),$(true
))
201 $(call gb_UnoApiTarget_get_dep_target
,$(1)) : UNOAPI_IDLFILES
+= $(2)/$(3).idl
202 $(call gb_UnoApiTarget_get_dep_target
,$(1)) : \
203 $(call gb_UnoApiPartTarget_get_dep_target
,$(2)/$(3))
208 define gb_UnoApiTarget__add_idlfiles
209 $(call gb_UnoApiTarget_get_target
,$(1)) : \
210 $(call gb_UnoApiPartTarget_get_target
,$(2)/idl.done
)
211 $(call gb_UnoApiPartTarget_get_target
,$(2)/idl.done
) : \
212 $(foreach idl
,$(3),$(SRCDIR
)/$(2)/$(idl
).idl
)
216 define gb_UnoApiTarget_add_idlfiles
217 $(foreach idl
,$(3),$(call gb_UnoApiTarget_add_idlfile
,$(1),$(2),$(idl
)))
218 $(call gb_UnoApiTarget__add_idlfiles
,$(1),$(2),$(3))
222 define gb_UnoApiTarget_add_idlfile
223 $(call gb_UnoApiTarget__add_idlfile
,$(1),$(2),$(3))
227 define gb_UnoApiTarget_merge_rdbfiles
228 $$(call gb_Output_error
,gb_UnoApiTarget_merge_rdbfiles
: use gb_UnoApiTarget_merge_api instead.
)
231 define gb_UnoApiTarget_merge_api
232 $(foreach rdb
,$(2),$(call gb_UnoApiTarget__merge_api
,$(1),$(rdb
)))
236 define gb_UnoApiTarget_merge_rdbfile
237 $$(call gb_Output_error
,gb_UnoApiTarget_merge_rdbfile
: use gb_UnoApiTarget_merge_api instead.
)
240 define gb_UnoApiTarget__merge_api
241 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_MERGE
+= $(call gb_UnoApiTarget_get_target
,$(2))
242 $(call gb_UnoApiTarget_get_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(2))
246 # Set XML component dependencies description.
247 define gb_UnoApiTarget_set_xmlfile
248 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_XML
:= $(SRCDIR
)/$(2)
249 $(call gb_UnoApiTarget_get_target
,$(1)) : $(SRCDIR
)/$(2)
250 $(call gb_UnoApiTarget_get_target
,$(1)) : $(gb_UnoApiTarget_XMLRDB
)
254 define gb_UnoApiTarget_add_reference_rdbfile
255 $$(call gb_Output_error
,gb_UnoApiTarget_add_reference_rdbfile
: use gb_UnoApiTarget_set_reference_rdbfile instead.
)
258 define gb_UnoApiTarget_set_reference_rdbfile
259 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_REFERENCE
:= $(SRCDIR
)/$(strip $(2)).rdb
263 define gb_UnoApiTarget_set_include
264 $(call gb_UnoApiTarget_get_target
,$(1)) : INCLUDE
:= $(2)
268 define gb_UnoApiTarget_set_root
269 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_ROOT
:= $(2)
273 # UnoApiHeadersTarget
275 gb_UnoApiHeadersTarget_CPPUMAKERTARGET
:= $(call gb_Executable_get_target_for_build
,cppumaker
)
276 gb_UnoApiHeadersTarget_CPPUMAKERCOMMAND
:= $(gb_Helper_set_ld_path
) SOLARBINDIR
=$(OUTDIR_FOR_BUILD
)/bin
$(gb_UnoApiHeadersTarget_CPPUMAKERTARGET
)
278 define gb_UnoApiHeadersTarget__command
279 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,\
281 -O
$(3) $(call gb_UnoApiTarget_get_target
,$(2)) $(UNOAPI_DEPS
)) && \
282 $(gb_UnoApiHeadersTarget_CPPUMAKERCOMMAND
) @
$${RESPONSEFILE} && \
283 rm -f
$${RESPONSEFILE} && \
288 $(call gb_UnoApiHeadersTarget_get_bootstrap_target
,%) : \
289 $(gb_UnoApiHeadersTarget_CPPUMAKERTARGET
)
290 $(call gb_Output_announce
,$*,$(true
),HPB
,3)
291 $(call gb_UnoApiHeadersTarget__command
,$@
,$*,$(call gb_UnoApiHeadersTarget_get_bootstrap_dir
,$*))
293 $(call gb_UnoApiHeadersTarget_get_comprehensive_target
,%) : \
294 $(gb_UnoApiHeadersTarget_CPPUMAKERTARGET
)
295 $(call gb_Output_announce
,$*,$(true
),HPC
,3)
296 $(call gb_UnoApiHeadersTarget__command
,$@
,$*,$(call gb_UnoApiHeadersTarget_get_comprehensive_dir
,$*),-C
)
298 $(call gb_UnoApiHeadersTarget_get_target
,%) : \
299 $(gb_UnoApiHeadersTarget_CPPUMAKERTARGET
)
300 $(call gb_Output_announce
,$*,$(true
),HPP
,3)
301 $(call gb_UnoApiHeadersTarget__command
,$@
,$*,$(call gb_UnoApiHeadersTarget_get_dir
,$*),-L
)
303 .PHONY
: $(call gb_UnoApiHeadersTarget_get_clean_target
,%)
304 $(call gb_UnoApiHeadersTarget_get_clean_target
,%) :
305 $(call gb_Output_announce
,$*,$(false
),HPP
,3)
306 $(call gb_Helper_abbreviate_dirs
,\
308 $(call gb_UnoApiHeadersTarget_get_dir
,$*) \
309 $(call gb_UnoApiHeadersTarget_get_bootstrap_dir
,$*) \
310 $(call gb_UnoApiHeadersTarget_get_comprehensive_dir
,$*) \
311 $(call gb_UnoApiHeadersTarget_get_target
,$*) \
312 $(call gb_UnoApiHeadersTarget_get_bootstrap_target
,$*)) \
313 $(call gb_UnoApiHeadersTarget_get_comprehensive_target
,$*)
315 define gb_UnoApiHeadersTarget_UnoApiHeadersTarget
316 $(call gb_UnoApiHeadersTarget_get_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(1))
317 $(call gb_UnoApiHeadersTarget_get_bootstrap_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(1))
318 $(call gb_UnoApiHeadersTarget_get_comprehensive_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(1))
319 $(call gb_UnoApiHeadersTarget_get_clean_target
,$(1)) : $(call gb_UnoApiTarget_get_clean_target
,$(1))
321 $(call gb_UnoApiHeadersTarget_get_target
,$(1)) : UNOAPI_DEPS
:=
322 $(call gb_UnoApiHeadersTarget_get_bootstrap_target
,$(1)) : UNOAPI_DEPS
:=
323 $(call gb_UnoApiHeadersTarget_get_comprehensive_target
,$(1)) : UNOAPI_DEPS
:=
325 # need dummy recipes so that header files are delivered in Package_inc;
326 # otherwise make will consider the header to be up-to-date because it was
327 # actually built by the recipe for gb_UnoApiHeadersTarget_get_target
328 $(call gb_UnoApiHeadersTarget_get_dir
,$(1),/%.hdl
) :
331 $(call gb_UnoApiHeadersTarget_get_dir
,$(1),/%.hpp
) :
334 $(call gb_UnoApiHeadersTarget_get_bootstrap_dir
,$(1),/%.hdl
) :
337 $(call gb_UnoApiHeadersTarget_get_bootstrap_dir
,$(1),/%.hpp
) :
340 $(call gb_UnoApiHeadersTarget_get_comprehensive_dir
,$(1),/%.hdl
) :
343 $(call gb_UnoApiHeadersTarget_get_comprehensive_dir
,$(1),/%.hpp
) :
348 # ensure that new urd triggers the dummy rule to rebuild the headers
349 define gb_UnoApiHeadersTarget_add_headerfile
350 $(call gb_UnoApiHeadersTarget_get_dir
,$(1),/$(3)) : \
351 $(call gb_UnoApiPartTarget_get_target
,$(basename $(2)).urd
)
355 define gb_UnoApiHeadersTarget__use_api_for_target
356 $(call gb_UnoApiHeadersTarget_get_
$(3),$(1)) : $(call gb_UnoApiTarget_get_target
,$(2))
357 $(call gb_UnoApiHeadersTarget_get_
$(3),$(1)) : UNOAPI_DEPS
+= -X
$(call gb_UnoApiTarget_get_target
,$(2))
361 define gb_UnoApiHeadersTarget_add_rdbfile
362 $$(call gb_Output_error
,gb_UnoApiHeadersTarget_add_rdbfile
: use gb_UnoApiHeadersTarget_use_api instead.
)
365 define gb_UnoApiHeadersTarget__use_api
366 $(call gb_UnoApiHeadersTarget__use_api_for_target
,$(1),$(2),target
)
367 $(call gb_UnoApiHeadersTarget__use_api_for_target
,$(1),$(2),bootstrap_target
)
368 $(call gb_UnoApiHeadersTarget__use_api_for_target
,$(1),$(2),comprehensive_target
)
372 define gb_UnoApiHeadersTarget_add_rdbfiles
373 $$(call gb_Output_error
,gb_UnoApiHeadersTarget_add_rdbfiles
: use gb_UnoApiHeadersTarget_use_api instead.
)
376 define gb_UnoApiHeadersTarget_use_api
377 $(foreach rdb
,$(2),$(call gb_UnoApiHeadersTarget__use_api
,$(1),$(rdb
)))
381 # vim: set noet sw=4 ts=4: