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_add_defs,$(2),\ 68 $(gb_Library_DEFS) \ 69) 70$(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) 71$(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) 72$(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1))) 73$$(eval $$(call gb_Module_register_target,$(call gb_Library_get_target,$(1)),$(call gb_Library_get_clean_target,$(1)))) 74$(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1)) 75 76endef 77 78define gb_Library_set_componentfile 79$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),$(call gb_Library_get_runtime_filename,$(1))) 80$(call gb_Library_get_target,$(1)) : $(call gb_ComponentTarget_get_outdir_target,$(2)) $(call gb_ComponentTarget_get_outdir_inbuild_target,$(2)) 81$(call gb_Library_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(2)) 82 83endef 84 85gb_Library__get_componentprefix = \ 86 $(call gb_Library__get_layer_componentprefix,$(call \ 87 gb_Library_get_layer,$(1))) 88 89gb_Library__get_layer_componentprefix = \ 90 $(patsubst $(1):%,%,$(or \ 91 $(filter $(1):%,$(gb_Library_COMPONENTPREFIXES)), \ 92 $(call gb_Output_error,no ComponentTarget native prefix for layer '$(1)'))) 93 94 95define gb_Library__forward_to_Linktarget 96gb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library__get_linktargetname,$$(1)),$$(2),$$(3)) 97 98endef 99 100gb_Library_get_runtime_filename = \ 101 $(or $(call gb_Library_get_dllname,$(1)),$(call gb_Library_get_filename,$(1))) 102 103$(eval $(foreach method,\ 104 add_cobject \ 105 add_cobjects \ 106 add_cxxobject \ 107 add_cxxobjects \ 108 add_objcxxobject \ 109 add_objcxxobjects \ 110 add_exception_objects \ 111 add_noexception_objects \ 112 add_generated_exception_objects \ 113 set_yaccflags \ 114 add_cflags \ 115 set_cflags \ 116 add_cxxflags \ 117 set_cxxflags \ 118 add_objcxxflags \ 119 set_objcxxflags \ 120 add_defs \ 121 set_defs \ 122 set_include \ 123 add_ldflags \ 124 set_ldflags \ 125 add_libs \ 126 set_library_path_flags \ 127 add_api \ 128 add_linked_libs \ 129 add_linked_static_libs \ 130 add_external_libs \ 131 use_external \ 132 use_externals \ 133 add_package_headers \ 134 add_sdi_headers \ 135 add_precompiled_header \ 136,\ 137 $(call gb_Library__forward_to_Linktarget,$(method))\ 138)) 139 140# vim: set noet sw=4 ts=4: 141