www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/07/12:37:17

Message-ID: <040e01be2208$99ebc200$c7ec7bc1@nctserver.nct-active.com>
From: "Rick Gungadoo" <rick AT nct-active DOT com>
To: <djgpp AT delorie DOT com>
Subject: Help on VPATH
Date: Mon, 7 Dec 1998 17:39:52 -0000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3115.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

Hello,
    I'm having some problems with make and the use of VPATH. My project is
arranged such that the source files are in c:\project\src , my header files
are in c:\project\include  and my testing directory is c:\project\test and
this is where I have my makefile. BTW, I'm running on a dos box under Win95.
My makefile is :
-------------------------------------------------------------------------
cc=gcc
cflags=-Wall -g -pg -a
objects=file1.o file2.o file3.o file4.o file5.o
VPATH=../include/;../src/

prog.exe : $(objects)
 $(cc) -o prog.exe $(cflags) $(objects)

file1.o : file1.c header1.h header2.h header3.h
 $(cc) -c $(cflags) $< -o $@

file2.o : file2.c header2.h header3.h
 $(cc) -c $(cflags) $< -o $@

file3.o : file3.c header2.h header3.h
 $(cc) -c $(cflags) $< -o $@

file4.o : file4.c header2.h header3.h
 $(cc) -c $(cflags) $< -o $@

file5.o : file5.c header2.h header3.h
 $(cc) -c $(cflags) $< -o $@
--------------------------------------------------------------------
When I run the above makefile in the c:\project\test directory, I get the
following message

gcc -c -Wall -g -pg -a ../src/file1.c -o file1.o
make.exe: *** No rule to make target 'file2.c', needed by 'file2.o'.  Stop

It seems that after properly compiling my fisrt source file, i.e. file1.c,
for some reason make cannot find the other source files. I'm really lost as
to why the use of VPATH does not tell make where to look for the various
source and header files.
The same makefile builds my program without any problems when it is found in
the c:\project\src directory, but I would really like to know what going on
with these search paths. I'd really appreciate any help on this as this
problem has been a source of major frustration for the past week or so.
Thanks a lot in advance
Best regards,
Ya'qub

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019