help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: GNU make help on patsubst


From: Li, Jerry
Subject: RE: GNU make help on patsubst
Date: Tue, 7 Aug 2001 18:08:18 -0400

Hi, Paul:

thanks a lot. By taking your implementation of BSLASH plus mine, I have made
it work as the following:

RM := erase /s/q
WORK_DIR = $(CURDIR)
ORG = $(WORK_DIR)/classes
BSLASH := \\#
FSLASH := /

NEW = $(subst $(FSLASH), $(BSLASH),$(ORG)) # do not use patsubst function

echo:
        @echo $(ORG)
        @echo $(NEW)

clean:
        $(RM) $(ORG)

My trick is that using function subst instead of patsubst.

If we do not replace / with \, RM will not work on Windows NT.

Jerry

-----Original Message-----
From: Paul D. Smith [mailto:address@hidden
Sent: Tuesday, August 07, 2001 11:36 AM
To: Li, Jerry
Cc: address@hidden
Subject: Re: GNU make help on patsubst


%% "Li, Jerry" <address@hidden> writes:

  lj> Is there any way to replace / with \ in D:/myWorkingDir/src/test
  lj> on Windows NT?

  lj> I have tried $(patsubst /,\, D:/myWorkingDir/src/test), but it does
not
  lj> work.

You have to hide the backslash from make.  Put it into a variable; that
in itself is tricky:

  BSLASH := \\#

then you can use:

  $(patsubst /,$(BSLASH),D:/myWorkingDir/src/test)

Note that you will not, in general, be able to use the backslash value
as either a target or a prerequisite, but you can translate them when
necessary in the command scripts.  It shouldn't _usually_ be necessary,
as most Windows tools will handle forward slashes equally well.  It's
only command.com based tools that won't, IIRC.

-- 
----------------------------------------------------------------------------
---
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad
Scientist



reply via email to

[Prev in Thread] Current Thread [Next in Thread]