Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-18-2008, 05:02 PM   #1
Registered: May 2006
Location: Leipzig, Germany
Distribution: Kanotix 64
Posts: 45

Rep: Reputation: 15
makefile subdirectory target


i have the following problem

my working dir is /dir for example

i have a makefile in this directory, called "target" for example:

target: dep1 dep2

the problem is as follows:

there is a subdirectory in /dir called /dir/subdir (for example)

my target "target" in /dir depends on subtarget "subtarget" in /dir/subdir to be "made"

however, this "intuitive" approach does NOT work:

target: /dir/subdir/subtarget

can some one please help me?


Old 08-18-2008, 06:25 PM   #2
Senior Member
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
does the thing in /dir/subdir have a makefile?

if so, without getting too fancy, this should work:

target: /dir/subdir/subtarget source_file
	g++ source_file -o $@

	make -C /dir/subdir


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using user input to create target using Makefile makaveli_0000 Linux - General 0 07-02-2007 04:01 PM
duplicated definition for a target in Makefile George2 Programming 2 05-07-2006 05:01 AM
strange target name containing % in Makefile George2 Programming 2 04-25-2006 07:28 AM
Trying to install kwvdial ,no target specified an no makefile found mtnhigh Linux - Software 0 09-27-2004 02:38 PM
No rule to make target `/mkspecs/default/qmake.conf', needed by `Makefile'. Stop Julianus Linux - General 0 12-21-2003 08:17 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:24 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration