%% Cristian Zoicas <[EMAIL PROTECTED]> writes:

  cz> In fact I want to create the following within my makefile:

  cz> out_directory
  cz> out_directory/file1.o
  cz> out_directory/file2.o

  cz> So I created the following makefile:

  cz> all: out_directory/file1.o out_directory/file2.o

  cz> out_directory/file1.o: source_file1.c out_directory
  cz>    $(CC) -o $@ -c $<

  cz> out_directory/file2.o: source_file2.c out_directory
  cz>          $(CC) -o $@ -c $<

  cz> out_directory:
  cz>   mkdir $@

It's always a bad idea to have directories as prerequisites, IMO.  What
I recommend is create the directory first, by putting something like
this in your makefile:

  __dummy := $(shell [ -d out_directory ] || mkdir out_directory)

Because of the :=, this gets executed when the makefile is read in, well
before any of the rules are invoked.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          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


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to