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