1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22 23 24gb_Helper_NULLFILE := /dev/null 25 26gb_Helper_MISC := $(WORKDIR)/Misc 27 28ifeq ($(JAVACOMPILER),) 29JAVACOMPILER := javac 30endif 31 32ifeq ($(JAVAINTERPRETER),) 33JAVAINTERPRETER := java 34endif 35 36# general propose phony target 37gb_Helper_PHONY := $(gb_Helper_MISC)/PHONY 38 39# general propose empty dummy target 40gb_Helper_MISCDUMMY := $(gb_Helper_MISC)/DUMMY 41 42gb_Helper_REPOSITORYNAMES := 43 44.PHONY : $(WORKDIR)/Misc/PHONY 45$(gb_Helper_MISCDUMMY) : 46 @mkdir -p $(dir $@) && touch $@ 47 48define gb_Helper_abbreviate_dirs 49R=$(REPODIR) && \ 50$(subst $(REPODIR)/,$$R/,S=$(SRCDIR) && \ 51$(subst $(SRCDIR)/,$$S/,O=$(OUTDIR)) && \ 52$(subst $(SRCDIR)/,$$S/,$(subst $(OUTDIR)/,$$O/,W=$(WORKDIR) && $(subst $(WORKDIR)/,$$W/,$(1))))) 53endef 54 55define gb_Helper_make_clean_target 56gb_$(1)_get_clean_target = $(WORKDIR)/Clean/$(1)/$$(1) 57 58endef 59 60define gb_Helper_make_outdir_clean_target 61gb_$(1)_get_clean_target = $$(subst $(OUTDIR)/,$(WORKDIR)/Clean/OutDir/,$$(call gb_$(1)_get_target,$$(1))) 62 63endef 64 65define gb_Helper_make_dep_target 66gb_$(1)_get_dep_target = $(WORKDIR)/Dep/$(1)/$$(1).d 67 68endef 69 70define gb_Helper_make_clean_targets 71$(foreach targettype,$(1),\ 72 $(call gb_Helper_make_clean_target,$(targettype))) 73 74endef 75 76define gb_Helper_make_outdir_clean_targets 77$(foreach targettype,$(1),\ 78 $(call gb_Helper_make_outdir_clean_target,$(targettype))) 79 80endef 81 82define gb_Helper_make_dep_targets 83$(foreach targettype,$(1),\ 84 $(call gb_Helper_make_dep_target,$(targettype))) 85 86endef 87 88define gb_Helper_get_outdir_clean_target 89$$(subst $(OUTDIR)/,$(WORKDIR)/Clean/OutDir/,$(1)) 90endef 91 92define gb_Helper_register_repository 93gb_Helper_CURRENTREPOSITORY := $(1) 94gb_Helper_REPOSITORYNAMES += $(1) 95 96endef 97 98# RepositoryExternal.mk is optional 99define gb_Helper_add_repository 100gb_Helper_CURRENTREPOSITORY := 101include $(1)/Repository.mk 102ifeq ($$(gb_Helper_CURRENTREPOSITORY),) 103$$(eval $$(call gb_Output_error,No call to gb_Helper_register_repository in Repository.mk for repository $(1))) 104endif 105$$(gb_Helper_CURRENTREPOSITORY) := $(1) 106-include $(1)/RepositoryExternal.mk 107 108endef 109 110define gb_Helper_add_repositories 111$(foreach repo,$(1),$(call gb_Helper_add_repository,$(repo))) 112 113endef 114 115define gb_Helper_init_registries 116gb_Executable_VALIDGROUPS := UREBIN SDK OOO BRAND NONE 117gb_Library_VALIDGROUPS := OOOLIBS PLAINLIBS_NONE PLAINLIBS_URE PLAINLIBS_OOO RTLIBS RTVERLIBS STLLIBS UNOLIBS_URE UNOLIBS_OOO UNOVERLIBS 118gb_StaticLibrary_VALIDGROUPS := PLAINLIBS 119 120$$(foreach group,$$(gb_Executable_VALIDGROUPS),$$(eval gb_Executable_$$(group) :=)) 121$$(foreach group,$$(gb_Library_VALIDGROUPS),$$(eval gb_Library_$$(group) :=)) 122$$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(eval gb_StaticLibrary_$$(group) :=)) 123 124endef 125 126define gb_Helper_collect_libtargets 127gb_Library_TARGETS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group))) 128gb_StaticLibrary_TARGETS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group))) 129 130endef 131 132define gb_Helper_collect_knownlibs 133gb_Library_KNOWNLIBS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group))) 134gb_StaticLibrary_KNOWNLIBS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group))) 135 136endef 137 138define gb_Helper_register_executables 139ifeq ($$(filter $(1),$$(gb_Executable_VALIDGROUPS)),) 140$$(eval $$(call gb_Output_error,$(1) is not a valid group for executables. Valid groups are: $$(gb_Executable_VALIDGROUPS))) 141endif 142$(foreach group,$(gb_Executable_VALIDGROUPS),\ 143 $(foreach target,$(2),\ 144 $(if $(filter $(target),$(gb_Executable_$(group))),\ 145 $(call gb_Output_error,gb_Helper_register_executables: already registered: $(target))))) 146$(if $(filter-out $(words $(2)),$(words $(sort $(2)))),\ 147 $(call gb_Output_error,gb_Helper_register_executables: contains duplicates: $(2))) 148 149gb_Executable_$(1) += $(2) 150 151endef 152 153define gb_Helper_register_libraries 154ifeq ($$(filter $(1),$$(gb_Library_VALIDGROUPS)),) 155$$(eval $$(call gb_Output_error,$(1) is not a valid group for libraries. Valid groups are: $$(gb_Library_VALIDGROUPS))) 156endif 157$(foreach group,$(gb_Library_VALIDGROUPS),\ 158 $(foreach target,$(2),\ 159 $(if $(filter $(target),$(gb_Library_$(group))),\ 160 $(call gb_Output_error,gb_Helper_register_libraries: already registered: $(target))))) 161$(if $(filter-out $(words $(2)),$(words $(sort $(2)))),\ 162 $(call gb_Output_error,gb_Helper_register_libraries: contains duplicates: $(2))) 163 164gb_Library_$(1) += $(2) 165 166endef 167 168define gb_Helper_register_static_libraries 169ifeq ($$(filter $(1),$$(gb_StaticLibrary_VALIDGROUPS)),) 170$$(eval $$(call gb_Output_error,$(1) is not a valid group for static libraries. Valid groups are: $$(gb_StaticLibrary_VALIDGROUPS))) 171endif 172$(foreach group,$(gb_StaticLibrary_VALIDGROUPS),\ 173 $(foreach target,$(2),\ 174 $(if $(filter $(target),$(gb_StaticLibrary_$(group))),\ 175 $(call gb_Output_error,gb_Helper_register_static_libraries: already registered: $(target))))) 176$(if $(filter-out $(words $(2)),$(words $(sort $(2)))),\ 177 $(call gb_Output_error,gb_Helper_register_static_libraries: contains duplicates: $(2))) 178 179gb_StaticLibrary_$(1) += $(2) 180 181endef 182 183# vim: set noet sw=4 ts=4: 184