Avoid potential negative array index access to cached text.
[LibreOffice.git] / solenv / gbuild / SdiTarget.mk
blobed98bdbfadeae747e092661408c856fdf0dfab99
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 # SdiTarget class
21 gb_SdiTarget_SVIDLDEPS := $(call gb_Executable_get_runtime_dependencies,svidl)
22 gb_SdiTarget_SVIDLCOMMAND := $(call gb_Executable_get_command,svidl)
24 $(call gb_SdiTarget_get_target,%) : $(SRCDIR)/%.sdi $(gb_SdiTarget_SVIDLDEPS)
25 $(call gb_Output_announce,$*,$(true),SDI,1)
26 $(call gb_Trace_StartRange,$*,SDI)
27 $(call gb_Helper_abbreviate_dirs,\
28 mkdir -p $(dir $@))
29 $(call gb_Helper_abbreviate_dirs,\
30 cd $(dir $<) && \
31 $(gb_SdiTarget_SVIDLCOMMAND) -quiet \
32 $(INCLUDE) \
33 -fs$@.hxx \
34 -fx$(EXPORTS) \
35 -fm$@ \
36 $(if $(gb_FULLDEPS),-fM$(call gb_SdiTarget_get_dep_target,$*)) \
37 $< \
38 && touch $@.hxx)
39 $(call gb_Trace_EndRange,$*,SDI)
40 # touch the hxx file so it's newer than the target - the .hxx only occurs in
41 # generated .d files, so it's not a target yet when building from scratch!
43 # rule necessary to rebuild cxx files that include the header
44 $(call gb_SdiTarget_get_target,%.hxx) : $(call gb_SdiTarget_get_target,%)
45 touch $@
47 ifeq ($(gb_FULLDEPS),$(true))
48 $(dir $(call gb_SdiTarget_get_dep_target,%)).dir :
49 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
51 $(dir $(call gb_SdiTarget_get_dep_target,%))%/.dir :
52 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
54 $(call gb_SdiTarget_get_dep_target,%) :
55 $(if $(wildcard $@),touch $@)
56 endif
58 .PHONY : $(call gb_SdiTarget_get_clean_target,%)
59 $(call gb_SdiTarget_get_clean_target,%) :
60 $(call gb_Output_announce,$*,$(false),SDI,1)
61 -$(call gb_Helper_abbreviate_dirs,\
62 rm -f \
63 $(call gb_SdiTarget_get_target,$*).hxx \
64 $(call gb_SdiTarget_get_dep_target,$*) \
65 $(call gb_SdiTarget_get_target,$*))
67 define gb_SdiTarget_SdiTarget
68 $(call gb_SdiTarget_get_target,$(1)) : \
69 INCLUDE := -I$(SRCDIR)/include $(SOLARINC) -I$$(dir $(SRCDIR)/$(1))
70 $(call gb_SdiTarget_get_target,$(1)) : EXPORTS := $(SRCDIR)/$(2).sdi
71 ifeq ($(gb_FULLDEPS),$(true))
72 -include $(call gb_SdiTarget_get_dep_target,$(1))
73 $(call gb_SdiTarget_get_dep_target,$(1)) :| $(dir $(call gb_SdiTarget_get_dep_target,$(1))).dir
74 endif
75 $(call gb_Helper_make_userfriendly_targets,$(1),SdiTarget)
76 endef
78 define gb_SdiTarget_set_include
79 $(call gb_SdiTarget_get_target,$(1)) : INCLUDE := $(2)
81 endef
83 # vim: set noet sw=4: