xref: /trunk/main/solenv/gbuild/Tempfile.mk (revision 7f3d5d1d)
1d71964d5SAndrew Rist# *************************************************************
2d71964d5SAndrew Rist#
3d71964d5SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4d71964d5SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5d71964d5SAndrew Rist#  distributed with this work for additional information
6d71964d5SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7d71964d5SAndrew Rist#  to you under the Apache License, Version 2.0 (the
8d71964d5SAndrew Rist#  "License"); you may not use this file except in compliance
9d71964d5SAndrew Rist#  with the License.  You may obtain a copy of the License at
10d71964d5SAndrew Rist#
11d71964d5SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12d71964d5SAndrew Rist#
13d71964d5SAndrew Rist#  Unless required by applicable law or agreed to in writing,
14d71964d5SAndrew Rist#  software distributed under the License is distributed on an
15d71964d5SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d71964d5SAndrew Rist#  KIND, either express or implied.  See the License for the
17d71964d5SAndrew Rist#  specific language governing permissions and limitations
18d71964d5SAndrew Rist#  under the License.
19d71964d5SAndrew Rist#
20d71964d5SAndrew Rist# *************************************************************
21cdf0e10cSrcweir# Write string to temporary file by chopping into pieces that
22cdf0e10cSrcweir# fit the commandline
23cdf0e10cSrcweir# parameters: filename, maxitems (for one write), string
24cdf0e10cSrcweir# returns: filename
25cdf0e10cSrcweirdefine var2file
26cdf0e10cSrcweir$(strip $(1)
27cdf0e10cSrcweir$(eval gb_var2file_helpervar := $$(shell printf "%s" "" > $(1) ))\
28cdf0e10cSrcweir$(foreach item,$(3),$(eval gb_var2file_curblock += $(item)
29cdf0e10cSrcweir    ifeq ($$(words $$(gb_var2file_curblock)),$(2))
30*7f3d5d1dSmseidel        gb_var2file_helpervar := $$(shell printf " %s" "$$(gb_var2file_curblock)" >> $(1) )
31cdf0e10cSrcweir        gb_var2file_curblock :=
32cdf0e10cSrcweir    endif
33cdf0e10cSrcweir    ))\
34cdf0e10cSrcweir    $(eval gb_var2file_helpervar := $(shell echo " "$(gb_var2file_curblock) >> $(1) )
35cdf0e10cSrcweir        gb_var2file_curblock :=
36cdf0e10cSrcweir    ))
37cdf0e10cSrcweirendef
38cdf0e10cSrcweir
39f0a50dfaSPedro Giffunidefine var2filecr
40f0a50dfaSPedro Giffuni$(strip $(1)
41f0a50dfaSPedro Giffuni$(foreach item,$(strip $(3)),$(eval gb_var2file_curblock += $(item)
42f0a50dfaSPedro Giffuni    ifeq ($$(words $$(gb_var2file_curblock)),$(2))
43f0a50dfaSPedro Giffuni        gb_var2file_helpervar :=$$(shell echo $$(gb_var2file_curblock) >> $(1) )
44f0a50dfaSPedro Giffuni        gb_var2file_curblock :=
45f0a50dfaSPedro Giffuni    endif
46f0a50dfaSPedro Giffuni    )) \
47f0a50dfaSPedro Giffuni	)
48f0a50dfaSPedro Giffuniendef
49f0a50dfaSPedro Giffuni
50