[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
prevent date/time modification to update targets
From: |
Cristian Zoicas |
Subject: |
prevent date/time modification to update targets |
Date: |
Wed, 17 Sep 2003 16:19:00 +0200 (MEST) |
Hello all
I would like to know if it is possible to specify a prerequisite
for a target and for this prerequisite only its existence matters
when updating the target ( the modification time is ignored ).
In fact I want to create the following within my makefile:
out_directory
out_directory/file1.o
out_directory/file2.o
So I created the following makefile:
all: out_directory/file1.o out_directory/file2.o
out_directory/file1.o: source_file1.c out_directory
$(CC) -o $@ -c $<
out_directory/file2.o: source_file2.c out_directory
$(CC) -o $@ -c $<
out_directory:
mkdir $@
For the first time when you run make all works ok. When you run it the
second time 'file1.o' will be rebuilt even if source_file1.c was not
changed.
this is because when you run make for the first time, the creation of
out_directory/file2.o changes the modification time of out_directory
and when you run it for the second time this triggers the compilation
of source_file1.c
Any help is welcomed.
cristian zoicas
- prevent date/time modification to update targets,
Cristian Zoicas <=