improve support for merging libraries

This commit is contained in:
Matúš Kukan 2012-01-06 10:48:43 +01:00
parent 0ffc8c0d70
commit a74627d53e
4 changed files with 62 additions and 45 deletions

View file

@ -21,26 +21,16 @@
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
$(eval $(call gb_Library_Library,merged))
$(eval $(call gb_Library_add_linked_libs,merged,$(filter-out $(gb_MERGED_LIBS),\
avmedia \
$(eval $(call gb_Library_add_linked_libs,merged,\
basegfx \
canvastools \
comphelper \
cppcanvas \
cppu \
cppuhelper \
drawinglayer \
editeng \
fwe \
i18nisolang1 \
i18npaper \
i18nutil \
jvmfwk \
lng \
fwe \
sal \
salhelper \
sax \
@ -49,28 +39,24 @@ $(eval $(call gb_Library_add_linked_libs,merged,$(filter-out $(gb_MERGED_LIBS),\
sot \
svl \
svt \
svx \
svxcore \
tk \
tl \
ucbhelper \
utl \
vcl \
xo \
xcr \
$(gb_STDLIBS) \
)))
))
$(eval $(call gb_Library_use_externals,merged,\
icui18n \
berkeleydb \
icuuc \
jpeg \
libxml2 \
zlib \
))
# gb_MERGEDLIBS is defined in solenv/gbuild/extensions/pre_MergedLibsList.mk
$(eval $(call gb_Library_add_library_objects,merged,\
$(gb_CORE_LIBS) \
$(gb_MERGEDLIBS) \
))
ifeq ($(OS),WNT)
@ -85,12 +71,4 @@ $(eval $(call gb_Library_add_linked_libs,merged,\
))
endif
# something is missing here for sure
ifeq ($(OS),MACOSX)
$(eval $(call gb_Library_add_linked_libs,merged,\
objc \
Cocoa \
))
endif
# vim: set noet sw=4 ts=4:

View file

@ -106,7 +106,7 @@ endef
# gb_Library__get_final_target has been invented for that purpose...
define gb_Library_set_componentfile
$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),\
$(call gb_Library_get_runtime_filename,$(if $(MERGELIBS),$(if $(filter $(gb_MERGED_LIBS),$(1)),merged,$(1)),$(1))))
$(call gb_Library_get_runtime_filename,$(if $(filter $(1),$(gb_MERGEDLIBS)),merged,$(1))))
$(call gb_Library__get_final_target,$(1)) : \
$(call gb_ComponentTarget_get_outdir_target,$(2))
$(call gb_ComponentTarget_get_target,$(2)) :| $(call gb_Library_get_target,$(1))

View file

@ -46,17 +46,6 @@ CXXFLAGS ?= $(gb_COMPILEROPTFLAGS)
OBJCXXFLAGS ?= $(gb_COMPILEROPTFLAGS)
endif
# if enabled we link all of these libraries into one larger, merged library
# for which we can do a lot more optimisation, and which is faster to read
# from disk.
ifeq ($(MERGELIBS),TRUE)
# list of libraries which are always loaded, thus we can merge them into one
# they have to be from tail_build, so we could link against merged library
gb_CORE_LIBS := \
uui \
endif
# Overview of dependencies and tasks of LinkTarget
#
# target task depends on
@ -357,8 +346,10 @@ mv $${TEMPFILE} $(call gb_LinkTarget_get_objects_list,$(2))
endef
# If object files from this library are merged, create just empty file
$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY)
$(call gb_LinkTarget__command,$@,$*)
$(if $(filter $*,$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktargetname,$(lib)))), \
touch $@, $(call gb_LinkTarget__command,$@,$*))
$(call gb_LinkTarget__command_objectlist,$@,$*)
ifeq ($(gb_FULLDEPS),$(true))
@ -639,11 +630,9 @@ $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Librar
$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk))
endif
ifeq ($(MERGELIBS),TRUE)
gb_LINKED_LIBS := $(if $(filter $(gb_CORE_LIBS),$(2)),merged $(filter-out $(gb_CORE_LIBS),$(2)),$(2))
else
gb_LINKED_LIBS := $(2)
endif
gb_LINKED_LIBS := $(if $(filter $(gb_MERGEDLIBS),$(2)), \
$(if $(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktargetname,$(lib)))),, merged)) \
$(filter-out $(gb_MERGEDLIBS),$(2))
$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $$(gb_LINKED_LIBS)

View file

@ -0,0 +1,50 @@
# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
#
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License or as specified alternatively below. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# Major Contributor(s):
# Copyright (C) 2012 Matúš Kukan <matus.kukan@gmail.com> (initial developer)
#
# All Rights Reserved.
#
# For minor contributions see the git repository.
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
ifeq ($(MERGELIBS),TRUE)
# we link all object files from these libraries into one, merged library
gb_MERGEDLIBS := \
avmedia \
canvastools \
cppcanvas \
deploymentmisc \
drawinglayer \
editeng \
filterconfig \
lng \
package2 \
sofficeapp \
spl \
svx \
svxcore \
uui \
xo \
endif
# vim: set noet sw=4 ts=4: