tdf#162760 Fix solver crashing with unset parameters
[LibreOffice.git] / solenv / gbuild / WinResTarget.mk
blobbc66d427a71604af1e0acd4f9e8e1be708cffedb
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 .
20 # WinResTarget class
22 gb_WinResTarget_DEFAULTDEFS := $(gb_RCDEFS)
24 define gb_WinResTarget_WinResTarget
25 $(call gb_WinResTarget_WinResTarget_init,$(1))
26 $$(eval $$(call gb_Module_register_target,$(call gb_WinResTarget_get_target,$(1)),$(call gb_WinResTarget_get_clean_target,$(1))))
27 $(call gb_Helper_make_userfriendly_targets,$(1),WinResTarget)
29 endef
31 define gb_WinResTarget_WinResTarget_init
32 $(call gb_WinResTarget_get_target,$(1)) : DEFS := $(gb_WinResTarget_DEFAULTDEFS)
33 $(call gb_WinResTarget_get_target,$(1)) : FLAGS := $(gb_RCFLAGS)
34 $(call gb_WinResTarget_get_target,$(1)) : INCLUDE := -I$(SRCDIR)/include $(subst -isystem,-I,$(SOLARINC)) -I$(BUILDDIR)/config_$(gb_Side)
35 $(call gb_WinResTarget_get_clean_target,$(1)) : RCFILE :=
36 $(call gb_WinResTarget_get_target,$(1)) : RCFILE :=
38 ifeq ($(gb_FULLDEPS),$(true))
39 $(call gb_WinResTarget_get_dep_target,$(1)) : DEFS := $$(gb_WinResTarget_DEFAULTDEFS)
40 $(call gb_WinResTarget_get_dep_target,$(1)) : FLAGS := $$(gb_RCFLAGS)
41 $(call gb_WinResTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_WinResTarget_INCLUDE) -I$(BUILDDIR)/config_$(gb_Side)
42 $(call gb_WinResTarget_get_dep_target,$(1)) : RCFILE :=
44 -include $(call gb_WinResTarget_get_dep_target,$(1))
45 endif
47 endef
49 ifeq ($(gb_FULLDEPS),$(true))
50 $(call gb_WinResTarget_get_dep_target,%) : $(gb_WinResTarget__command_target)
51 $(call gb_WinResTarget__command_dep,$@,$*,$(call gb_WinResTarget_get_target,$*))
52 endif
55 $(call gb_WinResTarget_get_target,%) :
56 $(call gb_WinResTarget__command,$@,$*,$<)
58 $(call gb_WinResTarget_get_clean_target,%) :
59 $(call gb_Output_announce,$*,$(false),RC ,3)
60 $(call gb_Helper_abbreviate_dirs,\
61 rm -f $(call gb_WinResTarget_get_target,$*) \
62 $(call gb_WinResTarget_get_dep_target,$*))
64 define gb_WinResTarget_add_defs
65 $(call gb_WinResTarget_get_target,$(1)) : DEFS += $(2)
67 ifeq ($(gb_FULLDEPS),$(true))
68 $(call gb_WinResTarget_get_dep_target,$(1)) : DEFS += $(2)
69 endif
71 endef
73 define gb_WinResTarget__add_include
74 $(call gb_WinResTarget_get_target,$(1)) : INCLUDE += -I$(2)
76 ifeq ($(gb_FULLDEPS),$(true))
77 $(call gb_WinResTarget_get_dep_target,$(1)) : INCLUDE += -I$(2)
78 endif
80 endef
82 define gb_WinResTarget_set_include
83 $(call gb_WinResTarget_get_target,$(1)) : INCLUDE := $(2)
85 ifeq ($(gb_FULLDEPS),$(true))
86 $(call gb_WinResTarget_get_dep_target,$(1)) : INCLUDE := $(2)
87 endif
89 endef
91 define gb_WinResTarget_set_rcfile
92 $(call gb_WinResTarget_get_clean_target,$(1)) : RCFILE := $(SRCDIR)/$(strip $(2)).rc
93 $(call gb_WinResTarget_get_target,$(1)) : RCFILE := $(SRCDIR)/$(strip $(2)).rc
94 $(call gb_WinResTarget_get_target,$(1)) : $(SRCDIR)/$(strip $(2)).rc
96 ifeq ($(gb_FULLDEPS),$(true))
97 $(call gb_WinResTarget_get_dep_target,$(1)) : RCFILE := $(SRCDIR)/$(strip $(2)).rc
98 endif
100 endef
102 define gb_WinResTarget_add_dependency
103 $(call gb_WinResTarget_get_target,$(1)) : $(SRCDIR)/$(strip $(2))
105 endef
107 define gb_WinResTarget_add_dependencies
108 $(foreach dep,$(2),$(call gb_WinResTarget_add_dependency,$(1),$(dep)))
110 endef
112 define gb_WinResTarget__use_custom_headers
113 $(call gb_WinResTarget_get_target,$(1)) : $(call gb_CustomTarget_get_target,$(2))
114 $(call gb_WinResTarget__add_include,$(1),$(gb_CustomTarget_workdir)/$(2))
116 endef
118 define gb_WinResTarget_use_custom_headers
119 $(foreach customtarget,$(2),$(call gb_WinResTarget__use_custom_headers,$(1),$(customtarget)))
121 endef
123 # vim: set noet sw=4 ts=4: