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# Static Library class 26 27# defined globally in gbuild.mk 28# gb_StaticLibrary_OUTDIRLOCATION := $(OUTDIR)/lib 29# defined by platform 30# gb_StaticLibrary_DEFS 31# gb_StaticLibrary_FILENAMES 32# gb_StaticLibrary_TARGETS 33 34gb_StaticLibrary__get_linktargetname = StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1)) 35 36# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows 37.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT) 38$(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT) : 39 $(call gb_Helper_abbreviate_dirs,\ 40 rm -f $(OUTDIR)/lib/$*$(gb_StaticLibrary_PLAINEXT) \ 41 $(AUXTARGETS)) 42 43# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows 44$(gb_StaticLibrary_OUTDIRLOCATION)/%$(gb_StaticLibrary_PLAINEXT) : 45 $(call gb_Helper_abbreviate_dirs,\ 46 $(call gb_Deliver_deliver,$<,$@) \ 47 $(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target)))) 48 49define gb_StaticLibrary_StaticLibrary 50ifeq (,$$(findstring $(1),$$(gb_StaticLibrary_KNOWNLIBS))) 51$$(eval $$(call gb_Output_info,Currently known static libraries are: $(sort $(gb_StaticLibrary_KNOWNLIBS)),ALL)) 52$$(eval $$(call gb_Output_error,Static library $(1) must be registered in Repository.mk)) 53endif 54$(call gb_StaticLibrary_get_target,$(1)) : AUXTARGETS := 55$(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary__get_linktargetname,$(1))) 56 57endef 58 59define gb_StaticLibrary__StaticLibrary_impl 60$(call gb_LinkTarget_LinkTarget,$(2)) 61$(call gb_LinkTarget_set_targettype,$(2),StaticLibrary) 62$(call gb_LinkTarget_add_defs,$(2),\ 63 $(gb_StaticLibrary_DEFS) \ 64) 65$(call gb_StaticLibrary_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) 66$(call gb_StaticLibrary_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) 67$(call gb_StaticLibrary_StaticLibrary_platform,$(1),$(2)) 68$$(eval $$(call gb_Module_register_target,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_StaticLibrary_get_clean_target,$(1)))) 69$(call gb_Deliver_add_deliverable,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1)) 70 71endef 72 73define gb_StaticLibrary_forward_to_Linktarget 74gb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary__get_linktargetname,$$(1)),$$(2),$$(3),$$(4)) 75 76endef 77 78$(eval $(foreach method,\ 79 add_cobject \ 80 add_cobjects \ 81 add_cxxobject \ 82 add_cxxobjects \ 83 add_objcxxobject \ 84 add_objcxxobjects \ 85 add_exception_objects \ 86 add_noexception_objects \ 87 add_generated_exception_objects \ 88 add_cflags \ 89 set_cflags \ 90 add_cxxflags \ 91 set_cxxflags \ 92 add_objcxxflags \ 93 set_objcxxflags \ 94 add_defs \ 95 set_defs \ 96 set_include \ 97 add_ldflags \ 98 set_ldflags \ 99 add_libs \ 100 set_library_path_flags \ 101 add_api \ 102 add_linked_libs \ 103 add_linked_static_libs \ 104 add_package_headers \ 105 add_sdi_headers \ 106 add_precompiled_header \ 107,\ 108 $(call gb_StaticLibrary_forward_to_Linktarget,$(method))\ 109)) 110 111# vim: set noet sw=4 ts=4: 112