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 24# Library class 25 26# defined globally in TargetLocations.mk 27# gb_Library_OUTDIRLOCATION := $(OUTDIR)/lib 28# gb_Library_DLLDIR := $(WORKDIR)/LinkTarget/Library 29# defined by platform 30# gb_Library_COMPONENTPREFIXES 31# gb_Library_DEFS 32# gb_Library_DLLFILENAMES 33# gb_Library_FILENAMES 34# gb_Library_Library_platform 35# gb_Library_TARGETS 36 37gb_Library__get_linktargetname = Library/$(call gb_Library_get_filename,$(1)) 38 39# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on Windows 40.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) 41$(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) : 42 $(call gb_Helper_abbreviate_dirs,\ 43 rm -f $(OUTDIR)/lib/$*$(gb_Library_PLAINEXT) \ 44 $(AUXTARGETS)) 45 46# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on Windows 47$(gb_Library_OUTDIRLOCATION)/%$(gb_Library_PLAINEXT) : 48 $(call gb_Helper_abbreviate_dirs,\ 49 $(call gb_Deliver_deliver,$<,$@) \ 50 $(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target)))) 51 52define gb_Library_Library 53ifeq (,$$(findstring $(1),$$(gb_Library_KNOWNLIBS))) 54$$(eval $$(call gb_Output_info,Currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL)) 55$$(eval $$(call gb_Output_error,Library $(1) must be registered in Repository.mk)) 56endif 57$(call gb_Library_get_target,$(1)) : AUXTARGETS := 58$(call gb_Library__Library_impl,$(1),$(call gb_Library__get_linktargetname,$(1))) 59$(call gb_Library_add_default_nativeres,$(1),default) 60 61endef 62 63define gb_Library__Library_impl 64$(call gb_LinkTarget_LinkTarget,$(2)) 65$(call gb_LinkTarget_set_targettype,$(2),Library) 66$(call gb_LinkTarget_add_defs,$(2),\ 67 $(gb_Library_DEFS) \ 68) 69$(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) 70$(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) 71$(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1))) 72$$(eval $$(call gb_Module_register_target,$(call gb_Library_get_target,$(1)),$(call gb_Library_get_clean_target,$(1)))) 73$(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1)) 74 75endef 76 77define gb_Library_set_componentfile 78$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),$(call gb_Library_get_runtime_filename,$(1))) 79$(call gb_Library_get_target,$(1)) : $(call gb_ComponentTarget_get_outdir_target,$(2)) $(call gb_ComponentTarget_get_outdir_inbuild_target,$(2)) 80$(call gb_Library_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(2)) 81 82endef 83 84gb_Library__get_componentprefix = \ 85 $(call gb_Library__get_layer_componentprefix,$(call \ 86 gb_Library_get_layer,$(1))) 87 88gb_Library__get_layer_componentprefix = \ 89 $(patsubst $(1):%,%,$(or \ 90 $(filter $(1):%,$(gb_Library_COMPONENTPREFIXES)), \ 91 $(call gb_Output_error,no ComponentTarget native prefix for layer '$(1)'))) 92 93 94define gb_Library__forward_to_Linktarget 95gb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library__get_linktargetname,$$(1)),$$(2),$$(3),$$(4)) 96 97endef 98 99gb_Library_get_runtime_filename = \ 100 $(or $(call gb_Library_get_dllname,$(1)),$(call gb_Library_get_filename,$(1))) 101 102define gb_Library_is_udk_versioned 103$(or \ 104 $(filter $(patsubst %:$(notdir $(1)),%,$(filter %:$(notdir $(1)),$(gb_Library_FILENAMES))),$(gb_Library_RTVERLIBS)),\ 105 $(filter $(patsubst %:$(notdir $(1)),%,$(filter %:$(notdir $(1)),$(gb_Library_FILENAMES))),$(gb_Library_UNOVERLIBS))) 106endef 107 108$(eval $(foreach method,\ 109 add_asmobject \ 110 add_asmobjects \ 111 add_cobject \ 112 add_cobjects \ 113 add_cxxobject \ 114 add_cxxobjects \ 115 add_objcobject \ 116 add_objcobjects \ 117 add_objcxxobject \ 118 add_objcxxobjects \ 119 add_exception_objects \ 120 add_noexception_objects \ 121 add_generated_cobject \ 122 add_generated_cobjects \ 123 add_generated_exception_objects \ 124 set_yaccflags \ 125 add_cflags \ 126 set_cflags \ 127 add_cxxflags \ 128 set_cxxflags \ 129 add_objcflags \ 130 set_objcflags \ 131 add_objcxxflags \ 132 set_objcxxflags \ 133 add_defs \ 134 set_defs \ 135 set_include \ 136 add_ldflags \ 137 set_ldflags \ 138 add_libs \ 139 set_library_path_flags \ 140 add_api \ 141 add_linked_libs \ 142 add_linked_static_libs \ 143 add_external_libs \ 144 use_external \ 145 use_externals \ 146 add_package_headers \ 147 add_sdi_headers \ 148 add_precompiled_header \ 149 set_versionmap \ 150 set_private_api \ 151 set_private_extract_of_public_api \ 152,\ 153 $(call gb_Library__forward_to_Linktarget,$(method))\ 154)) 155 156# vim: set noet sw=4 ts=4: 157