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 # the .dir is for make 3.81, which ignores trailing /
21 $(call gb_CustomTarget_get_workdir
,%)/.
dir :
22 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
24 $(call gb_CustomTarget_get_target
,%) :
25 $(call gb_Output_announce
,$*,$(true
),CUS
,3)
28 .PHONY
: $(call gb_CustomTarget_get_clean_target
,%)
29 $(call gb_CustomTarget_get_clean_target
,%) :
30 $(call gb_Output_announce
,$*,$(false
),CUS
,3)
31 $(call gb_Helper_abbreviate_dirs
,\
32 rm -rf
$(call gb_CustomTarget_get_workdir
,$*) && \
33 rm -f
$(call gb_CustomTarget_get_target
,$*))
35 define gb_CustomTarget_CustomTarget
36 $(eval
$(call gb_Module_register_target
,$(call gb_CustomTarget_get_target
,$(1)),$(call gb_CustomTarget_get_clean_target
,$(1))))
37 $(call gb_Helper_make_userfriendly_targets
,$(1),CustomTarget
)
38 $(call gb_CustomTarget_get_target
,$(1)) :|
$(dir $(call gb_CustomTarget_get_target
,$(1))).
dir
42 define gb_CustomTarget_register_target
43 $(call gb_CustomTarget_get_target
,$(1)) : $(call gb_CustomTarget_get_workdir
,$(1))/$(2)
44 $(call gb_CustomTarget_get_workdir
,$(1))/$(2) :|
$(dir $(call gb_CustomTarget_get_workdir
,$(1))/$(2)).
dir
48 define gb_CustomTarget_register_targets
49 $(foreach target
,$(2),$(call gb_CustomTarget_register_target
,$(1),$(target
)))
55 # $(call gb_CustomTarget_ulfex__command,ulftarget,ulfsource,pofiles)
56 define gb_CustomTarget_ulfex__command
57 $(call gb_Output_announce
,$(1),$(true
),ULF
,1)
58 MERGEINPUT
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,$(3)) && \
59 $(call gb_Helper_abbreviate_dirs
,\
60 $(call gb_Executable_get_command
,ulfex
) -i
$(2) -o
$(1) -m
$${MERGEINPUT} -l
all) && \
66 define gb_CustomTarget_ulfex__command
72 # $(call gb_CustomTarget_ulfex_rule,ulftargetpattern,ulfsource,pofiles)
73 define gb_CustomTarget_ulfex_rule
74 $(1) : $(2) $(if
$(WITH_LANG
),$(call gb_Executable_get_runtime_dependencies
,ulfex
)) |
$(dir $(1)).
dir
75 $$(call gb_CustomTarget_ulfex__command
,$$@
,$(subst %,$$*,$(strip $(2))),$(strip $(3)))
79 #$(call gb_CustomTarget_token_hash,oox/generated,tokenhash.inc,tokenhash.gperf)
80 define gb_CustomTarget_token_hash
81 $(call gb_CustomTarget_get_target
,$(1)) : $(call gb_CustomTarget_get_workdir
,$(1))/$(2)
82 $(call gb_CustomTarget_get_workdir
,$(1))/$(2) : $(call gb_CustomTarget_get_workdir
,$(1))/misc
/$(3)
83 $$(call gb_Output_announce
,$$(subst $(WORKDIR
)/,,$$@
),build
,GPF
,1)
84 $(GPERF
) --compare-strncmp
--switch
=2 --readonly-tables
$$< \
85 | sed
-e
's/char\*)0/(char\*)0, 0/g' | grep
-v
'^#line' > $$@
89 #$(call gb_CustomTarget_generate_tokens,oox/generated,oox,oox/source/token,
90 #namespaces,namespace,namespaces.txt,namespaces-strict,namespaces.pl)
91 define gb_CustomTarget_generate_tokens
92 $(call gb_CustomTarget_get_workdir
,$(1))/misc
/$(5)ids.inc \
93 $(call gb_CustomTarget_get_workdir
,$(1))/$(5)names.inc \
94 $(if
$(6),$(call gb_CustomTarget_get_workdir
,$(1))/misc
/$(6)) \
95 $(if
$(7),$(call gb_CustomTarget_get_workdir
,$(1))/$(7)names.inc
) : \
96 $(call gb_CustomTarget_get_workdir
,$(1))/$(2)/token
/$(4).hxx
99 $(call gb_CustomTarget_get_workdir
,$(1))/$(2)/token
/$(4).hxx
: \
100 $(if
$(8),$(SRCDIR
)/$(3)/$(8),$(SRCDIR
)/solenv
/bin
/generate-tokens.pl
) \
101 $(SRCDIR
)/$(3)/$(4).txt \
102 $(SRCDIR
)/$(3)/$(4).hxx.head \
103 $(SRCDIR
)/$(3)/$(4).hxx.tail
104 $$(call gb_Output_announce
,$$(subst $(WORKDIR
)/,,$$@
),build
,PRL
,1)
105 mkdir
-p
$(call gb_CustomTarget_get_workdir
,$(1))/misc \
106 $(call gb_CustomTarget_get_workdir
,$(1)) \
107 $(call gb_CustomTarget_get_workdir
,$(1))/$(2)/token
108 perl
$(if
$(8),$(SRCDIR
)/$(3)/$(8),$(SRCDIR
)/solenv
/bin
/generate-tokens.pl
) \
109 $(SRCDIR
)/$(3)/$(4).txt \
110 $(call gb_CustomTarget_get_workdir
,$(1))/misc
/$(5)ids.inc \
111 $(call gb_CustomTarget_get_workdir
,$(1))/$(5)names.inc \
112 $(if
$(6), $(call gb_CustomTarget_get_workdir
,$(1))/misc
/$(6)) \
113 $(if
$(7), $(SRCDIR
)/$(3)/$(7).txt \
114 $(call gb_CustomTarget_get_workdir
,$(1))/$(7)names.inc
) \
115 && cat
$(SRCDIR
)/$(3)/$(4).hxx.head \
116 $(call gb_CustomTarget_get_workdir
,$(1))/misc
/$(5)ids.inc \
117 $(SRCDIR
)/$(3)/$(4).hxx.tail \
118 > $(call gb_CustomTarget_get_workdir
,$(1))/$(2)/token
/$(4).hxx \
121 $(call gb_CustomTarget_get_target
,$(1)) : \
122 $(call gb_CustomTarget_get_workdir
,$(1))/$(5)names.inc \
123 $(if
$(7),$(call gb_CustomTarget_get_workdir
,$(1))/$(7)names.inc
) \
124 $(call gb_CustomTarget_get_workdir
,$(1))/$(2)/token
/$(4).hxx \
125 $(if
$(6),$(call gb_CustomTarget_get_workdir
,$(1))/misc
/$(6)) \
129 # vim: set noet sw=4: