Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / SdiTarget.mk
blob3e64fda43fd71b0856a69e29bcd4ff2a4e0f2a1b
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_Helper_abbreviate_dirs,\
27 mkdir -p $(dir $@))
28 $(call gb_Helper_abbreviate_dirs,\
29 cd $(dir $<) && \
30 $(gb_SdiTarget_SVIDLCOMMAND) -quiet \
31 $(INCLUDE) \
32 -fs$@.hxx \
33 -fx$(EXPORTS) \
34 -fm$@ \
35 $(if $(gb_FULLDEPS),-fM$(call gb_SdiTarget_get_dep_target,$*)) \
36 $< \
37 && touch $@.hxx)
38 # touch the hxx file so it's newer than the target - the .hxx only occurs in
39 # generated .d files, so it's not a target yet when building from scratch!
41 # rule necessary to rebuild cxx files that include the header
42 $(call gb_SdiTarget_get_target,%.hxx) : $(call gb_SdiTarget_get_target,%)
43 touch $@
45 ifeq ($(gb_FULLDEPS),$(true))
46 $(dir $(call gb_SdiTarget_get_dep_target,%)).dir :
47 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
49 $(dir $(call gb_SdiTarget_get_dep_target,%))%/.dir :
50 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
52 $(call gb_SdiTarget_get_dep_target,%) :
53 $(if $(wildcard $@),touch $@)
54 endif
56 .PHONY : $(call gb_SdiTarget_get_clean_target,%)
57 $(call gb_SdiTarget_get_clean_target,%) :
58 $(call gb_Output_announce,$*,$(false),SDI,1)
59 -$(call gb_Helper_abbreviate_dirs,\
60 rm -f \
61 $(call gb_SdiTarget_get_target,$*).hxx \
62 $(call gb_SdiTarget_get_dep_target,$*) \
63 $(call gb_SdiTarget_get_target,$*))
65 define gb_SdiTarget_SdiTarget
66 $(call gb_SdiTarget_get_target,$(1)) : INCLUDE := $$(subst -I. ,-I$$(dir $(SRCDIR)/$(1)) ,$$(SOLARINC))
67 $(call gb_SdiTarget_get_target,$(1)) : EXPORTS := $(SRCDIR)/$(2).sdi
68 ifeq ($(gb_FULLDEPS),$(true))
69 -include $(call gb_SdiTarget_get_dep_target,$(1))
70 $(call gb_SdiTarget_get_dep_target,$(1)) :| $(dir $(call gb_SdiTarget_get_dep_target,$(1))).dir
71 endif
72 endef
74 define gb_SdiTarget_set_include
75 $(call gb_SdiTarget_get_target,$(1)) : INCLUDE := $(2)
77 endef
79 # vim: set noet sw=4: