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 98define gb_Helper_add_repository 99gb_Helper_CURRENTREPOSITORY := 100include $(1)/Repository.mk 101ifeq ($$(gb_Helper_CURRENTREPOSITORY),) 102$$(eval $$(call gb_Output_error,No call to gb_Helper_register_repository in Repository.mk for repository $(1))) 103endif 104$$(gb_Helper_CURRENTREPOSITORY) := $(1) 105 106endef 107 108define gb_Helper_add_repositories 109$(foreach repo,$(1),$(call gb_Helper_add_repository,$(repo))) 110 111endef 112 113define gb_Helper_init_registries 114gb_Executable_VALIDGROUPS := UREBIN SDK OOO BRAND NONE 115gb_Library_VALIDGROUPS := OOOLIBS PLAINLIBS_NONE PLAINLIBS_URE PLAINLIBS_OOO RTLIBS RTVERLIBS STLLIBS UNOLIBS_URE UNOLIBS_OOO UNOVERLIBS 116gb_StaticLibrary_VALIDGROUPS := PLAINLIBS 117 118$$(foreach group,$$(gb_Executable_VALIDGROUPS),$$(eval gb_Executable_$$(group) :=)) 119$$(foreach group,$$(gb_Library_VALIDGROUPS),$$(eval gb_Library_$$(group) :=)) 120$$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(eval gb_StaticLibrary_$$(group) :=)) 121 122endef 123 124define gb_Helper_collect_libtargets 125gb_Library_TARGETS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group))) 126gb_StaticLibrary_TARGETS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group))) 127 128endef 129 130define gb_Helper_collect_knownlibs 131gb_Library_KNOWNLIBS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group))) 132gb_StaticLibrary_KNOWNLIBS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group))) 133 134endef 135 136define gb_Helper_register_executables 137ifeq ($$(filter $(1),$$(gb_Executable_VALIDGROUPS)),) 138$$(eval $$(call gb_Output_error,$(1) is not a valid group for executables. Valid groups are: $$(gb_Executable_VALIDGROUPS))) 139endif 140 141gb_Executable_$(1) += $(2) 142 143endef 144 145define gb_Helper_register_libraries 146ifeq ($$(filter $(1),$$(gb_Library_VALIDGROUPS)),) 147$$(eval $$(call gb_Output_error,$(1) is not a valid group for libraries. Valid groups are: $$(gb_Library_VALIDGROUPS))) 148endif 149 150gb_Library_$(1) += $(2) 151 152endef 153 154define gb_Helper_register_static_libraries 155ifeq ($$(filter $(1),$$(gb_StaticLibrary_VALIDGROUPS)),) 156$$(eval $$(call gb_Output_error,$(1) is not a valid group for static libraries. Valid groups are: $$(gb_StaticLibrary_VALIDGROUPS))) 157endif 158 159gb_StaticLibrary_$(1) += $(2) 160 161endef 162 163# vim: set noet sw=4 ts=4: 164