help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing directory to submake


From: Russell
Subject: Re: Passing directory to submake
Date: Sun, 20 Oct 2002 22:05:45 +1000

"Paul D. Smith" wrote:
> 
> %% Russell <address@hidden> writes:
> 
>   r> I thought i'd solve it using a pattern rule in each subdirectory:
> 
>   r> %.o: %.c %.h
>   r>   $(CC) $(CFLAGS) -o $@ $<
> 
>   r> However, when a file matching %.o does not exist,
>   r> make gives an error: *** No targets. Stop.
> 
>   r> How can i get 'make' do the command and create that .o file?
> 
> I don't understand the question.  Make prints "no targets" if you don't
> ask it to build anything.  If you have no explicit targets in your
> makefile (for example, if the above implicit (pattern) rule is all the
> makefile contains), and you don't specify any targets to build on the
> command line (e.g., "make foo.o"), then make doesn't know what you want
> it to do.
> 
> It does not simply root around in the directory looking for files that
> could possibly match the pattern rule and build them.  You have to tell
> it what you want built.

Hi,

After a 'clean' operation, all the .o files get deleted, which
means rules like: %.o : %.c  will complain because there's no
target .o files. How is this problem usually avoided?

What's the best book on GNU Make? I'd like something that explains
how large recursive makefile systems work.

I'm trying to make something where if you do 'make' in a
subdirectory, it will call 'make' from the top directory,
use global project rules and commands, then run 'make' in
the subdirectory. Calling 'make' directly in the top
directory should do all the 'submakes' then a final
build and link process.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]