LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-17-2009, 12:06 PM   #1
silentray
LQ Newbie
 
Registered: Oct 2006
Location: London
Distribution: Gentoo 2008.0
Posts: 23

Rep: Reputation: 15
Makefile question


Hi all,

I am new to Makefile. The question is:

I have a large number of .c files in a directory other than the directory where Makefile resides. The structure is like:

----/
|
|---- build
| |
| |--- linux
| |
| |- Makefile
|
|-----src
| |
| |--- *.c

In the Makefile, I have a list of .c files defined as:

SRCS=file1.c file2.c ..... file100.c

The Makefile was in the same directory with all the .c files and the following line works.

%(CC) $(CFLAG) -c $(SRCS)

However, as the Makefile is moved to the new directory. It cannot find those source file any more.

My question is how I should define the path so that Makefile can find all the .c files in the src directory.

I don't want to add the path name manually to each .c file. There must be a standard way to doing this.

Can anyone help me?

Regards,
Ray

Last edited by silentray; 12-17-2009 at 12:08 PM.
 
Old 12-18-2009, 04:51 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Use the cd command:
Code:
cd src
type 'man bash' for more informations about the cd command

Last edited by Agrouf; 12-18-2009 at 04:55 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Makefile question orgcandman Programming 3 02-27-2008 12:04 PM
g++ makefile question zahadumy Programming 4 03-25-2007 04:18 PM
Makefile question ar1 Programming 3 01-26-2006 07:06 AM
Question about makefile taureanyang Programming 1 03-25-2005 11:57 PM
makefile question blackzone Programming 2 12-20-2004 07:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration