Re: File.basename() and mkmf.rb

From: Charles Mills <cmills@...>
Date: 2004-05-27 19:09:49 UTC
List: ruby-core #2954
On May 26, 2004, at 4:43 PM, nobu.nokada@softhome.net wrote:

> Hi,
>
> At Thu, 27 May 2004 04:34:36 +0900,
> Charles Mills wrote in [ruby-core:02952]:
>> My problem is that I have files with multiple extensions (ie.
>> 'file.y.c').  I have added rules for these files in ./depends and
>> changed 'SRC_EXT', but the line:
>>      804       $objs.push(File.basename(f, ".*") << "." << $OBJEXT)
>> doesn't do what I want so I just generate $objs myself.
>
> make can deal with it?
>
Yes make can deal with it.  For example this works fine (on gnu make):
###
RACC=racc
RACCFLAGS=

.SUFFIXES : .y.rb .rb

.y.rb.rb :
         $(RACC) $(RACCFLAGS) $< -o $*.rb
###
I could see how that could confuse make though.  I guess having two 
extensions is a pretty bad idea in general though.  The 'y.rb' 
extension lets the text editor know that its a ruby file not a yacc 
file though.  I guess 'yrb' could be used instead.

>> File.basename(f, ".*") only gets rid of the first suffix, not both or
>> all suffixes.  Is this by design?
>
> I think so.
> -- 
> Nobu Nakada
>


In This Thread