Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / ComponentTarget.mk
blobf56a980c3fccdd53ac79e9c9cfa771fa298d011b
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 gb_ComponentTarget_XSLTCOMMANDFILE := $(SRCDIR)/solenv/bin/createcomponent.xslt
21 gb_ComponentTarget_get_source = $(SRCDIR)/$(1).component
23 # In the DISABLE_DYNLOADING case we don't need any COMPONENTPREFIX, we
24 # put just the static library filename into the uri parameter. For
25 # each statically linked app using some subset of LO components, there
26 # is a mapping from library filenames to direct pointers to the
27 # corresponding PREFIX_component_getFactory functions.
28 define gb_ComponentTarget__command
29 $(call gb_Output_announce,$(2),$(true),CMP,1)
30 $(if $(LIBFILENAME),,$(call gb_Output_error,No LIBFILENAME set at component target: $(1)))
31 mkdir -p $(dir $(1)) && \
32 $(call gb_ExternalExecutable_get_command,xsltproc) --nonet \
33 --stringparam uri '$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,$(subst \d,$$,$(COMPONENTPREFIX)))$(LIBFILENAME)' \
34 --stringparam cppu_env $(gb_CPPU_ENV) -o $(1) \
35 $(gb_ComponentTarget_XSLTCOMMANDFILE) $(COMPONENTSOURCE)
36 endef
39 $(call gb_ComponentTarget_get_clean_target,%) :
40 $(call gb_Output_announce,$*,$(false),CMP,1)
41 rm -f $(call gb_ComponentTarget_get_target,$*) \
44 # when a library is renamed, the component file needs to be rebuilt to match.
45 # hence simply depend on Repository{,Fixes}.mk since the command runs quickly.
46 $(call gb_ComponentTarget_get_target,%) : \
47 $(SRCDIR)/Repository.mk \
48 $(SRCDIR)/RepositoryFixes.mk \
49 | $(call gb_ExternalExecutable_get_dependencies,xsltproc)
50 $(call gb_ComponentTarget__command,$@,$*)
52 define gb_ComponentTarget_ComponentTarget
53 $(call gb_ComponentTarget_get_target,$(1)) : COMPONENTPREFIX := $(2)
54 $(call gb_ComponentTarget_get_target,$(1)) : LIBFILENAME := $(3)
55 $(call gb_ComponentTarget_get_target,$(1)) : COMPONENTSOURCE := $(call gb_ComponentTarget_get_source,$(patsubst CppunitTest/%,%,$(1)))
57 $(call gb_ComponentTarget_get_target,$(1)) : $(call gb_ComponentTarget_get_source,$(patsubst CppunitTest/%,%,$(1)))
59 endef
61 # vim: set noet sw=4: