bug-make
[Top][All Lists]
Advanced

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

vpath isn't honored when implicit rules are used


From: Andre Morozov
Subject: vpath isn't honored when implicit rules are used
Date: Wed, 7 Aug 2002 15:16:07 -0400

Hi,

The following makefile builds the test.o file in the specified directory (i.e. build), but fails to build the final target (i.e. test.exe) the first time make is executed because vpath somehow is ignored. However, when make is executed the second time, make finds the test.o and proceeds with test.exe normally.

Makefile:

vpath %.o build

SRCS = test.cpp
OBJS = $(SRCS:.cpp=.o)

%.o : %.cpp
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o build/$@

all: test.exe

test.exe: $(OBJS)
echo "Dir: $(?D); File: $(?F)"
$(CC) -o build/$@ $?

clean:
rm build/test.exe
rm build/test.o


Output:

[test]$ make
cc -c test.cpp -o build/test.o
echo "Dir: .; File: test.o"
Dir: .; File: test.o
cc -o build/test.exe test.o
cc: test.o: No such file or directory
cc: No input files
make: *** [test.exe] Error 1
[test]$ make
echo "Dir: build; File: test.o"
Dir: build; File: test.o
cc -o build/test.exe build/test.o
build/test.o: In function `LogonTest(void)':
build/test.o(.text+0x155): warning: setlogin is not implemented and will always fail

The version of the make utility is reported as:

GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i386-redhat-linux-gnu
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.

If you have any further questions, please don't hesitate to ask.

Best Regards,
Andre Morozov

reply via email to

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