MAKE utility

I wrote a makefile, every thing is working fine,

But One of the C header files which is created by me is kept in a different folder other than the current directory,

I have given this PATH to VPATH Variable

Example :- VPATH = /home/user1/projects/victor.h

It gives an error as : file not found

This is the defination of VPATH is

The value of the make variable VPATH specifies a list of directories that make should search.

What basically i want is, how do i specify make to search for the file in the path which i have specified in the VPATH.

what is the correct syntax for specifying the value in the VPATH

Regards
Victor Vinod

VPATH=/home/user1/projects

Hi jim ,

its great its working fine with the path specified in the VPATH variable
now when i run make it is giving the following error.

[user1@scmtest mk4]$ make
cc -c main.c
cc -c sec.o
cc: sec.o: No such file or directory
cc: no input files
make: *** [sec.o] Error 1
[user1@scmtest mk4]$

The contents of makefile is

VPATH=/usr/include
myfile : main.o sec.o
        cc -o myfile main.o sec.o
main.o : main.c stdio.h
        cc -c main.c
sec.o : sec.c stdio.h
        cc -c sec.o

The contents of main.c file is

main()
{
        printf("HEllo this is from main");
        mynextprog();
}

The contents of sec.o is

mynextprog()
{
printf("helllo this is from my next prog");
printf("Bye bye");
}

even though sec.o is existing it says cc: sec.o: No such file or directory

but when i compile and create the sec.o separately , it is working fine. with the following error message
cc -o myfile main.o sec.o

this means the next rule after stdio.h statement is not bieng executed. if i create the obj file seperately it is working fine
My Question is

1) is it possible to include stdio.h file in the make without including it in the source code file.?

Thanks Jim

Regards

Victor vinod

Error message is because you are using cc -c sec.o instead of sec.c,here sec.o file is not being created.

change the last line of your makefile as cc -c sec.c

Thanks you very much
even after the change it is still giving the same problem

regards
victor vinod kumar