problem with make file and all

Programming, for all ages and all languages.
Post Reply
psnix
Member
Member
Posts: 50
Joined: Fri Oct 24, 2008 12:34 pm

problem with make file and all

Post by psnix »

hi
how can i talk to "make" all sources are in the an address like ../kernel in the "all"?

all: $(SOURCES) link
Selenic
Member
Member
Posts: 123
Joined: Sat Jan 23, 2010 2:56 pm

Re: problem with make file and all

Post by Selenic »

pswin wrote:how can i talk to "make" all sources are in the an address like ../kernel in the "all"?
I'm assuming that by this you mean "How do you tell make to run the makefile in another directory"

In that case, you just use the -C option to make (if running it from the command line) or do a 'recursive make', where one of the lines is "$(MAKE) -C [directory]" ($(MAKE) is always set to the exact make you're using, even if it's not standard make)

On the other hand, recursive make is considered harmful - basically, it tends to make it more complicated to maintain, causes unnecessary rebuilds and makes parallel builds more difficult (a legitimate example is binutils: each tool within it is built separately by a recursive make. It then does autoconf and another three or four levels of recursive make for *each* tool. Ow ow ow)
Hangin10
Member
Member
Posts: 162
Joined: Wed Feb 27, 2008 12:40 am

Re: problem with make file and all

Post by Hangin10 »

If you want to collect a list of all the source files in a directory, there is a makefile tutorial on the wiki that covers this (and more too! :) ).
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: problem with make file and all

Post by Solar »

...and it is found here: Makefile
Every good solution is obvious once you've found it.
Post Reply