bugmake - Bugs: bug #841, dollar signs in target filenames...

 
 

bug #841: dollar signs in target filenames confuse make

Submitted by:  None
Submitted on:  Thu 11 Jul 2002 08:22:17 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.79.1Operating System: Any
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 11 Jul 2002 10:06:02 PM UTC, comment #1:

[ This is not really a bug, it's more a question of how to use make--these kinds of things are most productively discussed on one of the mailing lists, not through the bug tracking system. Thx. ]

It is not make that's confused, it's the commands that make invokes. If you properly escape the $'s by doubling them in the make syntax, then they will be passed to whatever interpreter make invokes properly.

If your interpreter (by default, the Bourne shell /bin/sh) also treats some characters as special, whether it be $ or any other character, then that's up to you to handle in your rules. Make does not and cannot contain a complete parser for your interpreter, so it cannot know which characters are special and how to treat them. If you replace "$", which just happens to be special to make, with "*", which is not special to make but still special to the shell, you'll see the dilemma.

Using backslashes is only one way to handle special characters in the shell; a much simpler way is to use quotes. For example, try:

$$foo:
touch '$@'

This works regardless of where the $ is. If you don't want to do that, then you should use subst rather than complex dir/notdir stuff:

foo/$$foo:
touch $(subst $$,\$$,$@)

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu 11 Jul 2002 08:22:17 PM UTC, original submission:

If I have a target

all: $$foo

then the rule to build '$foo' would normally look like

$$foo:
touch $@

except this doesn't work. touch gets simply $foo and tries
to expand it, which doesn't work. The workaround is to use

$$foo:
touch \$@

but this doesn't work if we want to build foo/$$foo, in
which case the workaround becomes

foo/$$foo:
touch $(dir $@)/\$(notdir $@)

Seems like there ought to be a better way.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 11 Jul 2002 10:06:02 PM UTCpsmithStatusNone=>(Error - Not Found)
  Assigned toNone=>NA
  Open/ClosedOpen=>(Error - Not Found)
  Closed on-=>-

Back to the top


Powered by Savane 3.1-cleanup1