[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to handle ':' in filenames?
From: |
John Dill |
Subject: |
Re: How to handle ':' in filenames? |
Date: |
Fri, 18 Mar 2011 15:20:34 -0400 |
>
>On Thu, Mar 17, 2011 at 1:08 PM, Lane Schwartz <address@hidden> wrote:
>> On Wed, Mar 16, 2011 at 10:29 PM, Peng Yu <address@hidden> wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to handle filenames with ':' in it. But neither of the
>>> following two ways work. Could anybody let me know if there is a way
>>> to hand filenames with ':' using make?
>>>
>>> .PHONY: all
>>>
>>> colon:=:
>>> foo:=abc_xyz.txt
>>> bar:=$(subst _,$(colon),$(foo))
>>>
>>> all: $(bar)
>>>
>>> $(bar):
>>> touch $@
>>>
>>> #Neither the above nor the below works.
>>> #all: abc$(colon)xyz.txt
>>> #
>>> #abc$(colon)xyz.txt:
>>> # touch $@
>>
>>
>> Do you have existing files (which have colons in their names) that you wish
>> to list as dependencies?
>>
>> Or do you wish to create new files which should have colons in their names?
>
>The example that I show is only for creating files with colons. But I
>want to handle both cases.
I don't have access to a system that supports colons in the name, but what
about something like this (not tested explicitly with colons)?
all: $(if $(wildcard abc$(colon)xyz.txt,,abc_xyz.txt)
abc_xyz.txt:
touch $(subst _,$(colon),$@)
Unfortunately, the $(wildcard) just checks for existence, but not
'up-to-date-ness'. Not sure if this is powerful enough to be useful to you.
Best regards,
John D.
<<winmail.dat>>