gbuild: ExternalProject: improve NMAKE handling
[LibreOffice.git] / solenv / gbuild / StaticLibrary.mk
blob849c0b51a5ad06b9730fb192c1cd693692748544
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 # Static Library class
23 # defined globally in gbuild.mk
24 # defined by platform
25 # gb_StaticLibrary_get_filename
26 # gb_StaticLibrary_PLAINEXT
27 # gb_StaticLibrary_StaticLibrary_platform
30 # EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
31 .PHONY : $(WORKDIR)/Clean/StaticLibrary/%
32 $(WORKDIR)/Clean/StaticLibrary/% :
33 $(call gb_Helper_abbreviate_dirs,\
34 rm -f $(AUXTARGETS))
36 define gb_StaticLibrary_StaticLibrary
37 $(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary_get_linktarget,$(1)))
39 endef
41 # call gb_StaticLibrary__StaticLibrary_impl,staticlib,linktarget
42 define gb_StaticLibrary__StaticLibrary_impl
43 $(call gb_LinkTarget_LinkTarget,$(2),StaticLibrary_$(1),NONE)
44 $(call gb_LinkTarget_set_targettype,$(2),StaticLibrary)
45 $(call gb_StaticLibrary_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
46 $(call gb_StaticLibrary_get_clean_target,$(1)) : AUXTARGETS :=
47 $(call gb_StaticLibrary_StaticLibrary_platform,$(1),$(2))
48 $$(eval $$(call gb_Module_register_target,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_StaticLibrary_get_clean_target,$(1))))
49 $(call gb_Helper_make_userfriendly_targets,$(1),StaticLibrary)
51 endef
53 # this is a crude hack to "build" header files with include-what-you-use
54 define gb_StaticLibrary__add_iwyu_header
55 $(call gb_LinkTarget_get_target,$(call gb_StaticLibrary_get_linktarget,$(1))) : $(call gb_GenCxxObject_get_target,$(basename $(2)))
56 $(call gb_GenCxxObject_get_target,$(basename $(2))) : $(SRCDIR)/$(2)
57 $(call gb_GenCxxObject_get_target,$(basename $(2))) : WARNINGS_NOT_ERRORS := $(true)
58 $(call gb_GenCxxObject_get_target,$(basename $(2))) : GEN_CXX_SOURCE := $(SRCDIR)/$(2)
60 endef
61 define gb_StaticLibrary__add_iwyu_headers
62 $(foreach file,$(2),$(call gb_StaticLibrary__add_iwyu_header,$(1),$(file)))
63 endef
65 define gb_StaticLibrary_forward_to_Linktarget
66 gb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary_get_linktarget,$$(1)),$$(2),$$(3),StaticLibrary_$$(1))
68 endef
70 $(eval $(foreach method,\
71 add_cobject \
72 add_cobjects \
73 add_cxxobject \
74 add_cxxobjects \
75 add_objcxxobject \
76 add_objcxxobjects \
77 add_cxxclrobject \
78 add_cxxclrobjects \
79 add_asmobject \
80 add_asmobjects \
81 add_exception_objects \
82 add_x64_generated_exception_objects \
83 add_generated_cobjects \
84 add_x64_generated_cobjects \
85 add_generated_cxxobjects \
86 add_generated_exception_objects \
87 add_cflags \
88 add_cxxflags \
89 add_objcflags \
90 add_objcxxflags \
91 add_cxxclrflags \
92 add_defs \
93 set_include \
94 add_ldflags \
95 set_ldflags \
96 set_x64 \
97 add_libs \
98 set_library_path_flags \
99 use_api \
100 use_sdk_api \
101 use_udk_api \
102 use_internal_api \
103 use_internal_bootstrap_api \
104 use_internal_comprehensive_api \
105 use_external \
106 use_externals \
107 use_custom_headers \
108 use_package \
109 use_packages \
110 use_unpacked \
111 use_external_project \
112 use_static_libraries \
113 add_sdi_headers \
114 set_precompiled_header \
115 set_warnings_not_errors \
116 set_external_code \
117 set_generated_cxx_suffix \
119 $(call gb_StaticLibrary_forward_to_Linktarget,$(method))\
122 # vim: set noet sw=4: