help-make
[Top][All Lists]
Advanced

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

Prerequisites in subdirectories


From: Ahmet Gökçe
Subject: Prerequisites in subdirectories
Date: Wed, 21 Aug 2013 03:05:11 +0200

Hello everybody,

I use some tools which create outputs on subdirectories. If I want to use
the created files in subsequent rules, I must run make for the second time
that these prerequisites can be found.

Example:
second: first
   @ls $<

first: | dir
   @touch dir/$@

dir:
   mkdir -p $@

VPATH=dir

clean::
   $(RM) -r dir

If I run make for the first time:
mkdir -p dir
touch dir/first
ls first
ls: cannot access first: No such file or directory

.. and second time:
ls dir/first
dir/first
.. voila!


1) Why does the make need two steps?
2) If it is a normal behavior, why did the make let the upmost rule run in
the first run even the prerequisite 'first' didn't exist? (ls first)

Kind Regards,
Gökçe


reply via email to

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