home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!ut-emx!slcs.slb.com!aa.cad.slb.com!bl.cad.slb.com!coach!shibuya
- From: shibuya@mailhost.bl.cad.slb.com (Hiroto Shibuya)
- Newsgroups: comp.unix.questions
- Subject: GNU make 3.62 VPATH question
- Message-ID: <SHIBUYA.92Sep15122320@chute.mailhost.bl.cad.slb.com>
- Date: 15 Sep 92 17:23:20 GMT
- Sender: usenet@mailhost.bl.cad.slb.com (USENET Administrator)
- Reply-To: shibuya@mailhost.bl.cad.slb.com
- Distribution: comp
- Organization: Schlumberger Technologies CAD/CAM Division
- Lines: 75
-
- Didn't get any response on gnu.util.bugs so try it here. I don't
- think it is Unix question but can't see anywhere more approprite.
- Question concerning VPATH, vpath with GNU make 3.62 on
- DECstation/Ultrix 4.2.
-
- Following is what I want to do.
-
- ./old/foo
- /foo.c
- /foo.o
- /file1.c
- /file1.o
- /file2.c
- /file2.o
- /makefile
-
- ./new/file1.c
- /makefile
-
- There is directory ./old and ./new. ./old contains all old sources
- and objects and exectables. In the separate directory ./new, I want
- to copy a file from old directory, modify it and create new "foo" with
- the new module. So I want make to compile new/file1.c and link new/foo
- out of old/foo.c, new/file1.o and old/file.o. I tried the following
- simple makefile.
-
- #
- # test VPATH
- #
- VPATH = ../old
-
- OBJ = foo.o file1.o file2.o
-
- foo : $(OBJ)
- cc -o $@ $^
-
- With this make file, if I say make, it simply says,
-
- gmake: `../old/foo' is up to date.
-
- So I specify abosolute path for the target foo.
-
- VPATH = ../old
- FOO = /xx/xx/xx/new/foo
-
- OBJ = foo.o file1.o file2.o
-
- $(FOO) : $(OBJ)
- cc -o $(FOO) $^
-
- Then it make foo as follows.
-
- cc -o /xx/xx/xx/new/foo ../old/main.o \
- ../old/file1.o ../old/file2.o
-
- ignoring the new/file1.c.
-
- If I say "gmake file1.o", it says
-
- gmake: `../old/file1.o' is up to date.
-
- If I say "make file1.o" then it compiles file1.c. After new/file1.o is
- created. Then if I say "gmake", it links with the new object.
-
- cc -o /xx/xx/xx/new/foo ../old/main.o \
- file1.o ../old/file2.o
-
- It seems that after Gmake finds the target in ../old, it doesn't go
- looking for the source in the current directory. What am I doing
- wrong? Or am I misunderstanding VPATH?
- --
- Hiroto Shibuya
-
- Schlumberger Technologies
- CAD/CAM Division
-