Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-17-2009, 01:06 PM   #1
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
| |
| |--- *.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?


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

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

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


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 01:04 PM
g++ makefile question zahadumy Programming 4 03-25-2007 05:18 PM
Makefile question ar1 Programming 3 01-26-2006 08:06 AM
Question about makefile taureanyang Programming 1 03-26-2005 12:57 AM
makefile question blackzone Programming 2 12-20-2004 08:03 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:33 AM.

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