The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Make utility - some Qs togurus.. alex_5161 SUN Solaris 0 01-30-2007 09:17 AM
is there kind of good utility that convert make files to dsp? umen UNIX for Dummies Questions & Answers 1 10-04-2006 04:09 PM
Make utility bigmoon SUN Solaris 2 10-10-2005 05:48 PM
Make utility victorvvk High Level Programming 4 06-24-2005 09:40 PM
Using make utility to create an mini-app Yifan_Guo High Level Programming 1 03-19-2005 02:35 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 06-27-2005
Registered User
 

Join Date: Mar 2005
Location: Hyderabad, india
Posts: 32
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
Reply With Quote
Forum Sponsor
  #2  
Old 06-27-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,274
VPATH=/home/user1/projects
Reply With Quote
  #3  
Old 06-27-2005
Registered User
 

Join Date: Mar 2005
Location: Hyderabad, india
Posts: 32
make utility

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

PHP Code:
VPATH=/usr/include
myfile main.o sec.o
        cc 
-o myfile main.o sec.o
main
.main.c stdio.h
        cc 
-c main.c
sec
.sec.c stdio.h
        cc 
-c sec.
The contents of main.c file is

PHP Code:
main()
{
        
printf("HEllo this is from main");
        
mynextprog();

The contents of sec.o is

PHP Code:
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

Last edited by victorvvk; 06-27-2005 at 09:28 PM. Reason: added twice
Reply With Quote
  #4  
Old 06-29-2005
Registered User
 

Join Date: Mar 2005
Location: Mumbai, India
Posts: 12
Quote:
PHP Code:
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

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
Reply With Quote
  #5  
Old 06-30-2005
Registered User
 

Join Date: Mar 2005
Location: Hyderabad, india
Posts: 32
Thanks you very much
even after the change it is still giving the same problem

regards
victor vinod kumar
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0