I have a Mac Powerbook (Al, Mac OS X 10.4.8) and I cannot get VPATH to
work in make so I wonder what I am doing wrong. I am trying to compile
a file (general.c) in a directory listed in VPATH, but I get an error
that the file cannot be found. loulibs.mak is my makefile in a
different directory from general.c. Here it is:
VPATH=/Users/louispecora/Code/general/
general.o: loulibs.mak general.c general.h
g++ -g -c -D_X_ -D$(RANGE) -D$(DEBUG) -o general.o general.c
--- I get the following error when I do make -f loulibs.mak
louispec% make -f loulibs.mak
g++ -g -c -D_X_ -D_RANGE_ -D_DEBUG_ -o general.o general.c
powerpc-apple-darwin8-g++-4.0.1: general.c: No such file or directory
powerpc-apple-darwin8-g++-4.0.1: no input files
make: *** [general.o] Error 1
Exit 2
--- Does anyone know what I am doing wrong?
Thanks for any help.
-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Paul Russell - 25 Mar 2007 22:21 GMT
> I have a Mac Powerbook (Al, Mac OS X 10.4.8) and I cannot get VPATH to
> work in make so I wonder what I am doing wrong. I am trying to compile
[quoted text clipped - 21 lines]
>
> -- Lou Pecora (my views are my own) REMOVE THIS to email me.
I think you don't want the trailing /, although it shouldn't actually
matter, but try it anyway.
Paul
Lou Pecora - 25 Mar 2007 22:58 GMT
> I think you don't want the trailing /, although it shouldn't actually
> matter, but try it anyway.
>
> Paul
Thanks, but that didn't work.
-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Paul Russell - 25 Mar 2007 22:25 GMT
> I have a Mac Powerbook (Al, Mac OS X 10.4.8) and I cannot get VPATH to
> work in make so I wonder what I am doing wrong. I am trying to compile
[quoted text clipped - 21 lines]
>
> -- Lou Pecora (my views are my own) REMOVE THIS to email me.
Oh, and try changing this:
> general.o: loulibs.mak general.c general.h
> g++ -g -c -D_X_ -D$(RANGE) -D$(DEBUG) -o general.o general.c
to this:
general.o: general.c general.h loulibs.mak
g++ -g -c -D_X_ -D$(RANGE) -D$(DEBUG) -o $@ $<
Paul
Lou Pecora - 25 Mar 2007 23:05 GMT
> Oh, and try changing this:
>
[quoted text clipped - 7 lines]
>
> Paul
Well, that seemed to get something different:
louispec% make -f loulibs.mak
g++ -g -c -D_X_ -D_RANGE_ -D_DEBUG_ -o intermediatefiles/general.o
loulibs.mak
powerpc-apple-darwin8-g++-4.0.1: loulibs.mak: linker input file unused
because linking not done
cp general.h /Users/louispecora/inc/
cp: general.h: No such file or directory
make: *** [intermediatefiles/general.o] Error 1
Exit 2
The cp command leads to trouble since make cannot find general.h (same
directory as general.c which is seemed to find). I'm not sure what the
linker statement means. And I certainly don't understand -o $@ $< . I
will google VPATH again and see if I can find explanation. Thanks.
-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Paul Russell - 26 Mar 2007 09:29 GMT
>> Oh, and try changing this:
>>
[quoted text clipped - 23 lines]
> linker statement means. And I certainly don't understand -o $@ $< . I
> will google VPATH again and see if I can find explanation. Thanks.
OK - it sounds like that fixed the VPATH issue (you can ignore the
linker warning for now) but there's another problem in your Makefile
because you're trying to use cp to do something odd with a header file.
You'll probably need to post more of the Makefile if you need help
fixing this part too.
Paul
Bob Harris - 25 Mar 2007 23:42 GMT
> I have a Mac Powerbook (Al, Mac OS X 10.4.8) and I cannot get VPATH to
> work in make so I wonder what I am doing wrong. I am trying to compile
[quoted text clipped - 21 lines]
>
> -- Lou Pecora (my views are my own) REMOVE THIS to email me.
have you tried lowercase vpath ?
vpath %.c /Users/louispecorda/Code/general/
vpath %.h /Users/louispecorda/Code/general/
NOTE: I am not claiming this will work. I have used lowercase
vpath in Linux and Windows builds, and I'm just extrapolating that
it might work on a MacOSX system.
Bob Harris
Lou Pecora - 26 Mar 2007 12:55 GMT
> have you tried lowercase vpath ?
>
[quoted text clipped - 6 lines]
>
> Bob Harris
Haven't tried it, but I will. Thanks. Linux and MacOSX are close on
somethings so it might work.
-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Lou Pecora - 26 Mar 2007 16:53 GMT
> have you tried lowercase vpath ?
>
[quoted text clipped - 6 lines]
>
> Bob Harris
I think I am better off using VPATH since there are other files with
different names in the dependencies that will not be pointed to by %.
I did get VPATH to work... sort of. Still having some problems with the
linker finding intermediate files. Not sure why. I'll continue to
wrestle with it.
Thanks.
-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Paul Floyd - 26 Mar 2007 21:41 GMT
> have you tried lowercase vpath ?
>
> vpath %.c /Users/louispecorda/Code/general/
> vpath %.h /Users/louispecorda/Code/general/
Isn't vpath specific to GNU make? As such, not a very good thing. My
comments in my previous post re VPATH also apply to vpath.
A bientot
Paul
Paul Floyd - 26 Mar 2007 21:39 GMT
> I have a Mac Powerbook (Al, Mac OS X 10.4.8) and I cannot get VPATH to
> work in make so I wonder what I am doing wrong. I am trying to compile
[quoted text clipped - 3 lines]
>
> VPATH=/Users/louispecora/Code/general/
I think that this is wrong. I believe that VPATH should contain paths
that are _relative_ to your build directory.
VPATH=general
> general.o: loulibs.mak general.c general.h
> g++ -g -c -D_X_ -D$(RANGE) -D$(DEBUG) -o general.o general.c
I wouldn't hard code those options. Personally, I would stick to the
builtin suffix rule:
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
%.o: %.cpp
# commands to execute (built-in):
$(COMPILE.cpp) $(OUTPUT_OPTION) $<
and I'd add my custom options to CPPFLAGS.
A bientot
Paul
Lou Pecora - 27 Mar 2007 15:39 GMT
> > VPATH=/Users/louispecora/Code/general/
>
> I think that this is wrong. I believe that VPATH should contain paths
> that are _relative_ to your build directory.
>
> VPATH=general
Hmmm. Wrong? It works for me. I like the full paths since I can use
them in any make from any directory on my machine. But maybe there is
something in the relative paths that has an advantage. I don't see it.
Sorry.
> > general.o: loulibs.mak general.c general.h
> > g++ -g -c -D_X_ -D$(RANGE) -D$(DEBUG) -o general.o general.c
[quoted text clipped - 11 lines]
> A bientot
> Paul
Yes, I changed my hard coding of the compile command to using the
symbols of VPATH method: -o $@ $< . That seems to work well.
Thanks.
-- Lou Pecora (my views are my own) REMOVE THIS to email me.