bug-make
[Top][All Lists]
Advanced

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

Re: Change in behaviour of subst from 3.80 to 3.81 ??


From: Jamie Allsop
Subject: Re: Change in behaviour of subst from 3.80 to 3.81 ??
Date: Sat, 08 May 2004 11:13:37 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4

Jamie Allsop wrote:

Hi,

(Windows 2k/XP(tested on both), Cygwin, make 3.80 and make 3.81 beta)

I have a make file that works fine 3.80 but not in 3.81. I have already
posted one issue in a previous post. This is another issue relating to
the same file.


The post entitled "Windows path names and multiple targets.. bug in make 3.81?" is the one I am referring to. The post did not appear and I re-posted... so it is not a previous post but a following post :)

I have a make file with the following elements, first I read in a
Windows environment variable and fix the windows path slashes...

MAKE_COMPATIBLE_ENVVAR1 = $(subst \,/,$(ENVVAR1))

I have sources located off this location on my hard drive so I can write:

PROJECT = MyProgram.exe

SOURCES = mainsourcefile.cpp \
   $(MAKE_COMPATIBLE_ENVVAR1)/sourcedir/dir1/sourcefile1.cpp \
   $(MAKE_COMPATIBLE_ENVVAR1)/sourcedir/dir1/sourcefile2.cpp \
   $(MAKE_COMPATIBLE_ENVVAR1)/sourcedir/dir2/sourcefile3.cpp

OBJFILES = $(subst .cpp,.obj,$(SOURCES))

Assuming I have a variable defined as LINKER_DIRECTIVE (this was a
mistake in my previous post...) and COMPILER_DIRECTIVE I can write the
rules:

$(PROJECT) : $(OBJFILES)
    $(LINKER_DIRECTIVE)

$(OBJFILES) : %.obj : %.cpp
    $(COMPILER_DIRECTIVE)

My problem is in the LINKER_DIRECTIVE.

I am using Borland's ilink32 linker and I define LINKER_DIRECTIVE as:

LINKER = $(ILINK32)

LINKER_ALLOBJ = c0w32.obj sysinit.obj $(ILINK32OBJFILES)

LINKER_PARAMETERS = $(LFLAGS) \
                    $(ILINK32LIBPATHS) \
                    $(LINKER_ALLOBJ), \
                    $(PROJECT),, \
                    $(LINKER_ALLLIB),, \
                    $(LINKER_ALLRES)

LINKER_DIRECTIVE = $(LINKER) $(LINKER_PARAMETERS)

ilink32 uses the '+' sign to concatenate libpats and obj files so that
long lines can be passed to the linker. Only ILINK32OBJFILES and
ILINK32LIBPATHS are of interest, the rest are striaghtforward variable
sustitutions.

ILINK32OBJFILES is defined as:

ILINK32OBJFILES = $(subst /,\, $(subst \,+,$(OBJFILES)))

ILINK32LIBPATHS is similarly defined as:

ILINK32LIBPATHS = $(subst /,\, $(subst \,+,$(LIBPATHS)))

If we only consider ILINK32OBJFILES then as far as I understand the
following substitution results:

Given $(OBJFILES) is something like this:

OBJFILES = mainsourcefile.obj \
   $(MAKE_COMPATIBLE_ENVVAR1)/sourcedir/dir1/sourcefile1.obj \
   $(MAKE_COMPATIBLE_ENVVAR1)/sourcedir/dir1/sourcefile2.obj \
   $(MAKE_COMPATIBLE_ENVVAR1)/sourcedir/dir2/sourcefile3.obj

assuming $(MAKE_COMPATIBLE_ENVVAR1) expands to 'D:/cvscheckout' we have

OBJFILES = mainsourcefile.obj \
   D:/cvscheckout/sourcedir/dir1/sourcefile1.obj \
   D:/cvscheckout/sourcedir/dir1/sourcefile2.obj \
   D:/cvscheckout/sourcedir/dir2/sourcefile3.obj

then ILINK32OBJFILES will be this, after substitution,

ILINK32OBJFILES = mainsourcefile.obj +
   D:\cvscheckout\sourcedir\dir1\sourcefile1.obj +
   D:\cvscheckout\sourcedir\dir1\sourcefile2.obj +
   D:\cvscheckout\sourcedir\dir2\sourcefile3.obj

When this is passed to the linker using make 3.80 the linker happily
sees all the files and performs the link as expected.

However when the same is passed to the linker using make 3.81 the linker
chokes and says that it cannot find the file (for example),

"
..
Turbo Incremental Link 5.64 Copyright (c) 1997-2002 Borland
Fatal: Unable to open file 'D:cvscheckoutsourcedirdir1sourcefile1.obj'
"

The first file mainsourcefile.obj appears to be found ok. The files do
exist and it works ok in 3.80. (fails in 3.79)

Has there been a change in how subst works in 3.81? Is this a regression?

Thanks for your help,

Jamie





reply via email to

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