[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
More on VPATH
From: |
Bgh Ello |
Subject: |
More on VPATH |
Date: |
Mon, 20 Feb 2012 19:25:56 -0800 (PST) |
Thanks for your help on my previous question, especially the comments
on automatic rules. I'll experiment with those in due course. For now, I
have added some include files. hello.cpp and inc1.h are in dir1, and inc2.h
in dir2. The makefile is now
VPATH = dir1 dir2
CC = g++
OPTS = -c -O2 -Wall
OBJS = hello.o
hello : $(OBJS)
$(CC) -o $@ $(OBJS)
hello.o : hello.cpp inc1.h inc2.h
$(CC) $(OPTS) $< -o $@
and the output of make is now
g++ -c -O2 -Wall dir1/hello.cpp -o hello.o
dir1/hello.cpp:6:18: fatal error: inc2.h: No such file or directory
compilation terminated.
make: *** [hello.o] Error 1
I don't understand why make doesn't find the prerequisite dir2/inc2.h.
Any help would be most appreciated.
- More on VPATH,
Bgh Ello <=