Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / AutoInstall.mk
blob282b02a93e9a4b33fbe1e7b0ff5479c6b34b930a
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 # AutoInstall class
12 define gb_AutoInstall__make_define
13 echo "#define auto_$*_ALL \ " >> $@
14 $(foreach binary,$(filter-out $(lastword $(1)),$(1)),echo " $(subst .,_,$(subst -,_,$(binary))), \ " >> $@;)
15 echo " $(subst .,_,$(subst -,_,$(lastword $(1))))" >> $@;
16 echo "" >> $@
17 endef
19 define gb_AutoInstall__gen_define
20 $(file >>$@,#define auto_$*_ALL \)
21 $(foreach binary,$(filter-out $(lastword $(1)),$(1)),$(file >>$@,\
22 $(subst .,_,$(subst -,_,$(binary))), \))
23 $(file >>$@,\
24 $(subst .,_,$(subst -,_,$(lastword $(1)))))
26 endef
28 define gb_AutoInstall__gen_lib
29 $(SCP2LIBTEMPLATE)(auto_$*_lib_$(subst .,_,$(subst -,_,$(1))),$(call gb_Library_get_runtime_filename,$(1))$(if $(SCP2COMPONENTCONDITION),$(COMMA)$(SCP2COMPONENTCONDITION)))
31 endef
33 $(dir $(call gb_AutoInstall_get_target,%)).dir :
34 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
36 $(call gb_AutoInstall_get_target,%) : $(GBUILDDIR)/AutoInstall.mk \
37 $(SRCDIR)/Repository.mk $(SRCDIR)/RepositoryExternal.mk \
38 $(BUILDDIR)/config_host.mk
39 $(call gb_Output_announce,$*,$(true),AIN,3)
40 ifeq ($(HAVE_GNUMAKE_FILE_FUNC),)
41 echo "/* autogenerated installs for group $* */" > $@
42 $(call gb_AutoInstall__make_define,\
43 $(foreach lib,$(gb_Library_MODULE_$*),auto_$*_lib_$(lib)) \
44 $(foreach lib,$(gb_SdkLinkLibrary_MODULE_$*),auto_$*_link_$(lib)) \
45 $(foreach exe,$(gb_Executable_MODULE_$*),auto_$*_exe_$(exe)) \
46 $(foreach jar,$(gb_Jar_MODULE_$*),auto_$*_jar_$(jar)) \
47 $(foreach pkg,$(gb_Package_MODULE_$*),auto_$*_pkg_$(pkg)))
48 $(foreach lib,$(gb_Library_MODULE_$*),\
49 echo '$(SCP2LIBTEMPLATE)(auto_$*_lib_$(subst .,_,$(subst -,_,$(lib))),$(call gb_Library_get_runtime_filename,$(lib))$(if $(SCP2COMPONENTCONDITION),$(COMMA)$(SCP2COMPONENTCONDITION)))' >> $@;)
50 else
51 $(file >$@,/* autogenerated installs for group $* */)
52 $(call gb_AutoInstall__gen_define,\
53 $(foreach lib,$(gb_Library_MODULE_$*),auto_$*_lib_$(lib)) \
54 $(foreach lib,$(gb_SdkLinkLibrary_MODULE_$*),auto_$*_link_$(lib)) \
55 $(foreach exe,$(gb_Executable_MODULE_$*),auto_$*_exe_$(exe)) \
56 $(foreach jar,$(gb_Jar_MODULE_$*),auto_$*_jar_$(jar)) \
57 $(foreach pkg,$(gb_Package_MODULE_$*),auto_$*_pkg_$(pkg)))
58 $(file >>$@,$(foreach lib,$(gb_Library_MODULE_$*),$(call gb_AutoInstall__gen_lib,$(lib))))
59 endif
60 $(foreach lib,$(gb_SdkLinkLibrary_MODULE_$*),\
61 echo 'SDK_LIBRARY_LINK(auto_$*_link_$(lib),$(notdir $(call gb_Library_get_sdk_link_lib,$(lib))),../../program/$(call gb_Library_get_runtime_filename,$(lib)))' >> $@;)
62 $(foreach exe,$(gb_Executable_MODULE_$*),\
63 echo "$(SCP2EXETEMPLATE)(auto_$*_exe_$(subst .,_,$(subst -,_,$(exe))),$(call gb_Executable_get_filename,$(exe)))" >> $@;)
64 $(foreach jar,$(gb_Jar_MODULE_$*),\
65 echo '$(SCP2JARTEMPLATE)(auto_$*_jar_$(subst .,_,$(subst -,_,$(jar))),$(jar).jar)' >> $@;)
66 $(foreach pkg,$(gb_Package_MODULE_$*),\
67 echo 'PACKAGE_FILELIST(auto_$*_pkg_$(subst -,_,$(pkg)),$(pkg).filelist)' >> $@;)
70 $(call gb_AutoInstall_get_clean_target,%) :
71 $(call gb_Output_announce,$*,$(false),AIL,3)
72 rm -f $(call gb_AutoInstall_get_target,$*)
74 define gb_AutoInstall_AutoInstall
75 $(call gb_AutoInstall_get_target,all) :| $(dir $(call gb_AutoInstall_get_target,all)).dir
77 $$(eval $$(call gb_Module_register_target,$(call gb_AutoInstall_get_target,all),$(call gb_AutoInstall_get_clean_target,all)))
78 $(call gb_Helper_make_userfriendly_targets,all,AutoInstall)
80 endef
82 # gb_AutoInstall_add_module module lib_template exe_template jar_template componentcondition
83 define gb_AutoInstall_add_module
84 $(call gb_AutoInstall_get_target,all) : $(call gb_AutoInstall_get_target,$(1))
85 $(call gb_AutoInstall_get_clean_target,all) : $(call gb_AutoInstall_get_clean_target,$(1))
86 $(call gb_Helper_make_userfriendly_targets,$(1),AutoInstall)
88 $(call gb_AutoInstall_get_target,$(1)) : $(gb_Module_CURRENTMAKEFILE)
89 $(call gb_AutoInstall_get_target,$(1)) :| $(dir $(call gb_AutoInstall_get_target,$(1))).dir
90 $(call gb_AutoInstall_get_target,$(1)) : SCP2LIBTEMPLATE := $(2)
91 $(call gb_AutoInstall_get_target,$(1)) : SCP2EXETEMPLATE := $(3)
92 $(call gb_AutoInstall_get_target,$(1)) : SCP2JARTEMPLATE := $(4)
93 $(call gb_AutoInstall_get_target,$(1)) : SCP2COMPONENTCONDITION := $(5)
95 endef
97 # vim: set shiftwidth=4 tabstop=4 noexpandtab: