office-gobmx/solenv/gbuild/Helper.mk

168 lines
5 KiB
Makefile
Raw Normal View History

2010-12-13 02:37:43 -06:00
# -*- Mode: GNUmakefile; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2010-04-17 05:41:17 -05:00
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
2010-11-12 05:43:33 -06:00
# Copyright 2000, 2010 Oracle and/or its affiliates.
2010-04-17 05:41:17 -05:00
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
2010-11-12 05:43:33 -06:00
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2010-04-17 05:41:17 -05:00
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
2010-11-12 05:43:33 -06:00
# version 3 along with OpenOffice.org. If not, see
2010-04-17 05:41:17 -05:00
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
gb_Helper_NULLFILE := /dev/null
gb_Helper_MISC := $(WORKDIR)/Misc
# general propose phony target
2010-04-17 05:41:17 -05:00
gb_Helper_PHONY := $(gb_Helper_MISC)/PHONY
# general propose empty dummy target
2010-04-17 05:41:17 -05:00
gb_Helper_MISCDUMMY := $(gb_Helper_MISC)/DUMMY
gb_Helper_REPOSITORYNAMES :=
2010-04-17 05:41:17 -05:00
.PHONY : $(WORKDIR)/Misc/PHONY
$(gb_Helper_MISCDUMMY) :
@mkdir -p $(dir $@) && touch $@
2010-04-17 05:41:17 -05:00
define gb_Helper_abbreviate_dirs
R=$(REPODIR) && \
$(subst $(REPODIR)/,$$R/,S=$(SRCDIR) && \
2010-05-07 10:23:27 -05:00
$(subst $(SRCDIR)/,$$S/,O=$(OUTDIR)) && \
$(subst $(SRCDIR)/,$$S/,$(subst $(OUTDIR)/,$$O/,W=$(WORKDIR) && $(subst $(WORKDIR)/,$$W/,$(1)))))
2010-04-17 05:41:17 -05:00
endef
define gb_Helper_make_clean_target
gb_$(1)_get_clean_target = $(WORKDIR)/Clean/$(1)/$$(1)
endef
define gb_Helper_make_outdir_clean_target
gb_$(1)_get_clean_target = $$(subst $(OUTDIR)/,$(WORKDIR)/Clean/OutDir/,$$(call gb_$(1)_get_target,$$(1)))
endef
define gb_Helper_make_dep_target
gb_$(1)_get_dep_target = $(WORKDIR)/Dep/$(1)/$$(1).d
endef
define gb_Helper_make_clean_targets
$(foreach targettype,$(1),\
$(call gb_Helper_make_clean_target,$(targettype)))
2010-04-17 05:41:17 -05:00
endef
define gb_Helper_make_outdir_clean_targets
$(foreach targettype,$(1),\
$(call gb_Helper_make_outdir_clean_target,$(targettype)))
2010-04-17 05:41:17 -05:00
endef
define gb_Helper_make_dep_targets
$(foreach targettype,$(1),\
$(call gb_Helper_make_dep_target,$(targettype)))
2010-04-17 05:41:17 -05:00
endef
define gb_Helper_get_outdir_clean_target
$$(subst $(OUTDIR)/,$(WORKDIR)/Clean/OutDir/,$(1))
endef
2010-11-11 08:36:05 -06:00
define gb_Helper_register_repository
gb_Helper_CURRENTREPOSITORY := $(1)
gb_Helper_REPOSITORYNAMES += $(1)
2010-11-11 08:36:05 -06:00
endef
define gb_Helper_add_repository
gb_Helper_CURRENTREPOSITORY :=
2010-11-11 05:19:55 -06:00
include $(1)/Repository.mk
2010-11-11 08:36:05 -06:00
ifeq ($$(gb_Helper_CURRENTREPOSITORY),)
2010-11-13 18:21:34 -06:00
$$(eval $$(call gb_Output_error,No call to gb_Helper_register_repository in Repository.mk for repository $(1)))
2010-11-11 05:19:55 -06:00
endif
2010-11-11 08:36:05 -06:00
$$(gb_Helper_CURRENTREPOSITORY) := $(1)
endef
define gb_Helper_add_repositories
$(foreach repo,$(1),$(call gb_Helper_add_repository,$(repo)))
2010-11-11 12:01:45 -06:00
2010-11-11 08:36:05 -06:00
endef
define gb_Helper_init_registries
2010-11-12 12:01:52 -06:00
gb_Executable_VALIDGROUPS := UREBIN SDK OOO BRAND NONE
2011-03-17 07:38:36 -05:00
gb_Library_VALIDGROUPS := OOOLIBS PLAINLIBS_NONE PLAINLIBS_URE PLAINLIBS_OOO RTLIBS RTVERLIBS UNOLIBS_URE UNOLIBS_OOO UNOVERLIBS
2010-11-12 12:01:52 -06:00
gb_StaticLibrary_VALIDGROUPS := PLAINLIBS
2010-11-11 08:36:05 -06:00
2010-11-12 12:01:52 -06:00
$$(foreach group,$$(gb_Executable_VALIDGROUPS),$$(eval gb_Executable_$$(group) :=))
$$(foreach group,$$(gb_Library_VALIDGROUPS),$$(eval gb_Library_$$(group) :=))
$$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(eval gb_StaticLibrary_$$(group) :=))
2010-11-11 11:38:32 -06:00
2010-11-11 08:36:05 -06:00
endef
define gb_Helper_collect_libtargets
2010-11-12 12:01:52 -06:00
gb_Library_TARGETS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group)))
gb_StaticLibrary_TARGETS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group)))
2010-11-11 08:36:05 -06:00
endef
define gb_Helper_collect_knownlibs
2010-11-12 12:01:52 -06:00
gb_Library_KNOWNLIBS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group)))
gb_StaticLibrary_KNOWNLIBS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group)))
2010-11-11 05:19:55 -06:00
endef
2010-11-11 11:38:32 -06:00
define gb_Helper_register_executables
2010-11-12 12:01:52 -06:00
ifeq ($$(filter $(1),$$(gb_Executable_VALIDGROUPS)),)
2010-11-13 18:21:34 -06:00
$$(eval $$(call gb_Output_error,$(1) is not a valid group for executables. Valid groups are: $$(gb_Executable_VALIDGROUPS)))
2010-11-11 11:38:32 -06:00
endif
gb_Executable_$(1) += $(2)
2010-11-11 12:01:45 -06:00
endef
define gb_Helper_register_libraries
2010-11-12 12:01:52 -06:00
ifeq ($$(filter $(1),$$(gb_Library_VALIDGROUPS)),)
2010-11-13 18:21:34 -06:00
$$(eval $$(call gb_Output_error,$(1) is not a valid group for libraries. Valid groups are: $$(gb_Library_VALIDGROUPS)))
2010-11-11 12:01:45 -06:00
endif
gb_Library_$(1) += $(2)
endef
define gb_Helper_register_static_libraries
2010-11-12 12:01:52 -06:00
ifeq ($$(filter $(1),$$(gb_StaticLibrary_VALIDGROUPS)),)
2010-11-13 18:21:34 -06:00
$$(eval $$(call gb_Output_error,$(1) is not a valid group for static libraries. Valid groups are: $$(gb_StaticLibrary_VALIDGROUPS)))
2010-11-11 12:01:45 -06:00
endif
gb_StaticLibrary_$(1) += $(2)
2010-11-11 11:38:32 -06:00
endef
define gb_Helper_execute
$(call gb_Helper_set_ld_path) $(OUTDIR)/bin/$(1)
endef
export gb_Helper_set_ld_path
export gb_Helper_execute
# vim: set noet sw=4 ts=4: