xref: /trunk/main/solenv/gbuild/WinResTarget.mk (revision d71964d5)
1*d71964d5SAndrew Rist# *************************************************************
2*d71964d5SAndrew Rist#
3*d71964d5SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*d71964d5SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*d71964d5SAndrew Rist#  distributed with this work for additional information
6*d71964d5SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*d71964d5SAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*d71964d5SAndrew Rist#  "License"); you may not use this file except in compliance
9*d71964d5SAndrew Rist#  with the License.  You may obtain a copy of the License at
10*d71964d5SAndrew Rist#
11*d71964d5SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*d71964d5SAndrew Rist#
13*d71964d5SAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*d71964d5SAndrew Rist#  software distributed under the License is distributed on an
15*d71964d5SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d71964d5SAndrew Rist#  KIND, either express or implied.  See the License for the
17*d71964d5SAndrew Rist#  specific language governing permissions and limitations
18*d71964d5SAndrew Rist#  under the License.
19*d71964d5SAndrew Rist#
20*d71964d5SAndrew Rist# *************************************************************
21cdf0e10cSrcweir
22cdf0e10cSrcweir# WinResTarget class
23cdf0e10cSrcweir
24cdf0e10cSrcweirgb_WinResTarget_DEFAULTDEFS := $(gb_RCDEFS)
25cdf0e10cSrcweir
26cdf0e10cSrcweirdefine gb_WinResTarget_WinResTarget
27cdf0e10cSrcweir$(call gb_WinResTarget_WinResTarget_init,$(1))
28cdf0e10cSrcweir$$(eval $$(call gb_Module_register_target,$(call gb_WinResTarget_get_target,$(1)),$(call gb_WinResTarget_get_clean_target,$(1))))
29cdf0e10cSrcweir
30cdf0e10cSrcweirendef
31cdf0e10cSrcweir
32cdf0e10cSrcweirdefine gb_WinResTarget_WinResTarget_init
33cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : DEFS := $(gb_WinResTarget_DEFAULTDEFS)
34cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : INCLUDE := $(SOLARINC)
35cdf0e10cSrcweir$(call gb_WinResTarget_get_clean_target,$(1)) : RCFILE :=
36cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : RCFILE :=
37cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
38cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : $(call gb_WinResTarget_get_dep_target,$(1))
39cdf0e10cSrcweirifneq ($(wildcard $(call gb_WinResTarget_get_dep_target,$(1))),)
40cdf0e10cSrcweirinclude $(call gb_WinResTarget_get_dep_target,$(1))
41cdf0e10cSrcweirelse
42cdf0e10cSrcweir$(firstword $(MAKEFILE_LIST)) : $(call gb_WinResTarget_get_dep_target,$(1))
43cdf0e10cSrcweirendif
44cdf0e10cSrcweir$(call gb_WinResTarget_get_dep_target,$(1)) : DEFS := $$(gb_WinResTarget_DEFAULTDEFS)
45cdf0e10cSrcweir$(call gb_WinResTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_WinResTarget_INCLUDE)
46cdf0e10cSrcweir$(call gb_WinResTarget_get_dep_target,$(1)) : RCFILE :=
47cdf0e10cSrcweirendif
48cdf0e10cSrcweir
49cdf0e10cSrcweirendef
50cdf0e10cSrcweir
51cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
52cdf0e10cSrcweir$(call gb_WinResTarget_get_dep_target,%) : $(gb_Helper_MISCDUMMY)
53cdf0e10cSrcweir		mkdir -p $(dir $@) && \
54cdf0e10cSrcweir			echo '$(call gb_WinResTarget_get_target,$*) : $$(gb_Helper_PHONY)' > $@
55cdf0e10cSrcweirendif
56cdf0e10cSrcweir
57cdf0e10cSrcweir
58cdf0e10cSrcweir$(call gb_WinResTarget_get_target,%) :
59cdf0e10cSrcweir	$(call gb_Output_announce,$*,$(true),RES,1)
60cdf0e10cSrcweir	$(call gb_WinResTarget__command_dep,$*,$<)
61cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
62cdf0e10cSrcweir		mkdir -p $(dir $@))
63cdf0e10cSrcweir	$(call gb_WinResTarget__command,$@)
64cdf0e10cSrcweir
65cdf0e10cSrcweir$(call gb_WinResTarget_get_clean_target,%) :
66cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
67cdf0e10cSrcweir		rm -f $(call gb_WinResTarget_get_target,$*))
68cdf0e10cSrcweir
69cdf0e10cSrcweirdefine gb_WinResTarget_set_defs
70cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : DEFS := $(2)
71cdf0e10cSrcweir$(call gb_WinResTarget_get_dep_target,$(1)) : DEFS := $(2)
72cdf0e10cSrcweir
73cdf0e10cSrcweirendef
74cdf0e10cSrcweir
75cdf0e10cSrcweirdefine gb_WinResTarget_set_include
76cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : INCLUDE := $(2)
77cdf0e10cSrcweir
78cdf0e10cSrcweirendef
79cdf0e10cSrcweir
80cdf0e10cSrcweirdefine gb_WinResTarget_add_file
81cdf0e10cSrcweir$(call gb_WinResTarget_get_clean_target,$(1)) : RCFILE=$(gb_Helper_SRCDIR_NATIVE)/$(2).rc
82cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : RCFILE=$(foreach file,$(gb_REPOS),$(realpath $(file)/$(strip $(2)).rc))
83cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : $(foreach file,$(gb_REPOS),$(realpath $(file)/$(strip $(2)).rc))
84cdf0e10cSrcweir
85cdf0e10cSrcweirendef
86cdf0e10cSrcweir
87cdf0e10cSrcweirdefine gb_WinResTarget_add_dependency
88cdf0e10cSrcweir$(call gb_WinResTarget_get_target,$(1)) : $(foreach file,$(2),$(foreach repo,$(gb_REPOS),$(realpath $(repo)/$(strip $(file)))))
89cdf0e10cSrcweir
90cdf0e10cSrcweirendef
91