xref: /aoo4110/main/solenv/gbuild/WinResTarget.mk (revision b1cdbd2c)
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# WinResTarget class
23
24gb_WinResTarget_DEFAULTDEFS := $(gb_RCDEFS)
25
26define gb_WinResTarget_WinResTarget
27$(call gb_WinResTarget_WinResTarget_init,$(1))
28$$(eval $$(call gb_Module_register_target,$(call gb_WinResTarget_get_target,$(1)),$(call gb_WinResTarget_get_clean_target,$(1))))
29
30endef
31
32define gb_WinResTarget_WinResTarget_init
33$(call gb_WinResTarget_get_target,$(1)) : DEFS := $(gb_WinResTarget_DEFAULTDEFS)
34$(call gb_WinResTarget_get_target,$(1)) : INCLUDE := $(SOLARINC)
35$(call gb_WinResTarget_get_clean_target,$(1)) : RCFILE :=
36$(call gb_WinResTarget_get_target,$(1)) : RCFILE :=
37ifeq ($(gb_FULLDEPS),$(true))
38$(call gb_WinResTarget_get_target,$(1)) : $(call gb_WinResTarget_get_dep_target,$(1))
39ifneq ($(wildcard $(call gb_WinResTarget_get_dep_target,$(1))),)
40include $(call gb_WinResTarget_get_dep_target,$(1))
41else
42$(firstword $(MAKEFILE_LIST)) : $(call gb_WinResTarget_get_dep_target,$(1))
43endif
44$(call gb_WinResTarget_get_dep_target,$(1)) : DEFS := $$(gb_WinResTarget_DEFAULTDEFS)
45$(call gb_WinResTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_WinResTarget_INCLUDE)
46$(call gb_WinResTarget_get_dep_target,$(1)) : RCFILE :=
47endif
48
49endef
50
51ifeq ($(gb_FULLDEPS),$(true))
52$(call gb_WinResTarget_get_dep_target,%) : $(gb_Helper_MISCDUMMY)
53		mkdir -p $(dir $@) && \
54			echo '$(call gb_WinResTarget_get_target,$*) : $$(gb_Helper_PHONY)' > $@
55endif
56
57
58$(call gb_WinResTarget_get_target,%) :
59	$(call gb_Output_announce,$*,$(true),RES,1)
60	$(call gb_WinResTarget__command_dep,$*,$<)
61	$(call gb_Helper_abbreviate_dirs,\
62		mkdir -p $(dir $@))
63	$(call gb_WinResTarget__command,$@)
64
65$(call gb_WinResTarget_get_clean_target,%) :
66	$(call gb_Helper_abbreviate_dirs,\
67		rm -f $(call gb_WinResTarget_get_target,$*))
68
69define gb_WinResTarget_set_defs
70$(call gb_WinResTarget_get_target,$(1)) : DEFS := $(2)
71$(call gb_WinResTarget_get_dep_target,$(1)) : DEFS := $(2)
72
73endef
74
75define gb_WinResTarget_set_include
76$(call gb_WinResTarget_get_target,$(1)) : INCLUDE := $(2)
77
78endef
79
80define gb_WinResTarget_add_file
81$(call gb_WinResTarget_get_clean_target,$(1)) : RCFILE=$(gb_Helper_SRCDIR_NATIVE)/$(2).rc
82$(call gb_WinResTarget_get_target,$(1)) : RCFILE=$(foreach file,$(gb_REPOS),$(realpath $(file)/$(strip $(2)).rc))
83$(call gb_WinResTarget_get_target,$(1)) : $(foreach file,$(gb_REPOS),$(realpath $(file)/$(strip $(2)).rc))
84
85endef
86
87define gb_WinResTarget_add_dependency
88$(call gb_WinResTarget_get_target,$(1)) : $(foreach file,$(2),$(foreach repo,$(gb_REPOS),$(realpath $(repo)/$(strip $(file)))))
89
90endef
91