help-make
[Top][All Lists]
Advanced

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

Re: Passing directory to submake


From: Paul D. Smith
Subject: Re: Passing directory to submake
Date: Sat, 19 Oct 2002 09:58:59 -0400

%% 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.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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