[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: prevent date/time modification to update targets
From: |
Paul D. Smith |
Subject: |
Re: prevent date/time modification to update targets |
Date: |
Wed, 17 Sep 2003 10:50:17 -0400 |
%% Cristian Zoicas <address@hidden> 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 <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