bugmake - Bugs: bug #30794, Interpreting backslash in pattern...

 
 

bug #30794: Interpreting backslash in pattern rules is weird

Submitted by:  Krzysztof Malinowski <raspy>
Submitted on:  Tue 17 Aug 2010 10:32:55 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Wont FixPrivacy: Public
Assigned to: Eli Zaretskii <eliz>Open/Closed: Closed
Component Version: 3.82Operating System: MS Windows
Fixed Release: NoneTriage Status: Major Effort

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 10 Sep 2012 05:12:40 AM UTC, comment #2:

Based on Eli's comment it seems that this situation is unlikely to improve. For this any many other reasons we strongly urge everyone to use forward slashes as directory separators when writing makefiles.

If something changes please add a comment to the bug and I'll be happy to reopen it.

Paul D. Smith <psmith>
Project Administrator
Fri 27 Aug 2010 03:18:02 PM UTC, comment #1:

The problem with a backslash in pattern rules is that file-name patterns are matched by the `glob' function, and the backslash has a special meaning in `glob'. Handling backslashes in Windows file names without breaking the special meaning of the backslash is tricky at best, and on top of that, I think glob.c is taken from gnulib, so any changes there should be submitted to gnulib maintainers.

Patches to fix this are welcome. If you or someone else would like to submit such a patch, I will try (with Paul's help) to get it into Make via gnulib. Failing that, I'm afraid this limitation will stay with us.

Eli Zaretskii <eliz>
Project MemberIn charge of this item.
Tue 17 Aug 2010 10:32:55 AM UTC, original submission:

Suppose the following test2.mk makefile:

backslash := $(subst /,\,/)

obj$(backslash)%.obj: src$(backslash)%.c
xcopy $< $@

Invoking make with target like obj\foo.obj fails to find a rule. Note also that in generated dump left backslash is eaten, while the right one is not:

$> make -f test2.mk obj\foo.obj -dpr
# GNU Make 3.82
# Built for Windows32
[...]
Reading makefiles...
Reading makefile `test2.mk'...
Updating makefiles....
[...]
Updating goal targets....
Considering target file `obj\foo.o'.
File `obj\foo.o' does not exist.
Looking for an implicit rule for `obj\foo.o'.
No implicit rule found for `obj\foo.o'.
Finished prerequisites of target file `obj\foo.o'.
Must remake target `obj\foo.o'.
make: *** No rule to make target `obj\foo.o'. Stop.

# Make data base, printed on Tue Aug 17 12:22:29 2010

# Variables
[...]
# makefile (from `test2.mk', line 1)
backslash := \
[...]
# Implicit Rules

# No implicit rules.

# Files

# Not a target:
.SUFFIXES:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.

obj%.obj: src\%.c
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# recipe to execute (from `test2.mk', line 4):
xcopy $< $@

# Not a target:
obj\foo.o:
# Command line target.
# Implicit rule search has been done.
# File does not exist.
# File has not been updated.
[...]

Krzysztof Malinowski <raspy>

 

(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

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by eliz (Posted a comment)
  • -unavailable- added by raspy (Submitted the item)
  •  

    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
    Mon 10 Sep 2012 05:12:40 AM UTCpsmithStatusNone=>Wont Fix
      Open/ClosedOpen=>Closed
    Fri 27 Aug 2010 03:18:02 PM UTCelizAssigned toNone=>eliz
      Triage StatusNone=>Major Effort

    Back to the top


    Powered by Savane 3.1-cleanup1