Visit Our UNIX and Linux User Community

MAKE utility

Thread Tools Search this Thread
Top Forums Programming MAKE utility
# 1  
Old 06-27-2005
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

Victor Vinod
# 2  
Old 06-27-2005
# 3  
Old 06-28-2005
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:
myfile main.o sec.o
-o myfile main.o sec.o
.main.c stdio.h
-c main.c
.sec.c stdio.h
-c sec.
The contents of main.c file is

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

The contents of sec.o is

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


Victor vinod

Last edited by victorvvk; 06-28-2005 at 01:28 AM.. Reason: added twice
# 4  
Old 06-29-2005
PHP Code:
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
# 5  
Old 06-30-2005
Thanks you very much
even after the change it is still giving the same problem

victor vinod kumar

Previous Thread | Next Thread
Test Your Knowledge in Computers #201
Difficulty: Easy
Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

A make-like build utility based on Lua

xmake is a make-like build utility based on lua. (Link to project site: xmake) The project focuses on making development and building easier and provides many features (.e.g package, install, plugin, macro, action, option, task ...), so that any developer can quickly pick it up and enjoy the... (1 Reply)
Discussion started by: waruqi
1 Replies

2. UNIX for Dummies Questions & Answers

Make Utility Question

Hello, I'm a recent convert to UNIX and I'm attempting to understand exactly how the make utility is working under the hood. Now, I understand that each rule has a target, dependencies, and update command, but the thing I'm confused about is exactly how the utility is determining when to... (1 Reply)
Discussion started by: kramer_102
1 Replies

3. Programming

make utility

Hi, Could someone tell me why make utility is mostly preferred for compilation and generating executable in UNIX rather than any user created scripts which contains commands for compilation? (2 Replies)
Discussion started by: naan
2 Replies

4. Programming

Help with a C program that acts like the make utility

Hi, I'm trying to create a C program that functions like the make utility in UNIX for personal use. My program would read in from a generic makefile and execute whatever is in that makefile but I'm not sure as to where I should start coding. I would appreciate any help. Thanks. (1 Reply)
Discussion started by: kratos.
1 Replies

5. UNIX for Dummies Questions & Answers

How to print something in make utility

Hi want to know the syntax of printing something (value or variable) in GNU make utility. I give this in the Makefile: echo "Hi" OR @echo "Hi" But I only get error this when I run make (at the line where I have echo): Makefile:9: *** missing separator. Stop. Whats the problem? How can... (2 Replies)
Discussion started by: radiatejava
2 Replies

6. Solaris

Make utility - some Qs togurus..

(Sorry for previous not on enlish! I did not realized it is english forum. ) I am looking for help with Make utility. I could not get help from the 'man' pages. 1. About Macro (as a variable): It is clear about defining any macro in beginning or in command line, but isn't it no way to redefine... (0 Replies)
Discussion started by: alex_5161
0 Replies

7. UNIX for Dummies Questions & Answers

is there kind of good utility that convert make files to dsp?

Hello all im looking for some kind of utility that convert make files to dsp files is there any kind of tool/script that does this job? thanks (1 Reply)
Discussion started by: umen
1 Replies

8. Solaris

Make utility

Hi Guys, I m very confused about the make/makefile utility in all unix. 1) My questions is why we need make. 2) Why some source code needs to complile. 3) I download the Bind 9 from I use pkgadd -d to install the bind. I 'm struck here becasue I can't find /etc/named.conf... (2 Replies)
Discussion started by: bigmoon
2 Replies

9. Programming

Make utility

When we run the make utility , make compiles only those files which are undergone changes(other files which have not undergone any changes are not recompiled) The Following quotes says When you run the make utility, it examines the modification times of files and determines what needs to be... (4 Replies)
Discussion started by: victorvvk
4 Replies

10. Programming

Using make utility to create an mini-app

The following is my makefile. When I run "make", it gives me a bunch of error. I've compiled each file separately and there are no compilation errors. The target is "monprc". Have a look below: monprc: monprc.o monrep.o dsz.o cc -o monprc monprc.o monrep.o dsz.o monprc.o: monprc.c... (1 Reply)
Discussion started by: Yifan_Guo
1 Replies

Featured Tech Videos