help-make
[Top][All Lists]
Advanced

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

Pattern rules and directory structure


From: Nicolai Stange
Subject: Pattern rules and directory structure
Date: Mon, 31 Oct 2011 09:47:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

Hello everybody,

suppose, I've got the following directory layout and the Makefile
`test.mk' attached:

--8<---------------cut here---------------start------------->8---
address@hidden:~$ find lib
lib
lib/.deps
lib/blah
lib/test.f90
address@hidden:~$ 
--8<---------------cut here---------------end--------------->8---


The following works:
--8<---------------cut here---------------start------------->8---
address@hidden:~$ cd lib
address@hidden:~/lib$ LC_ALL=C make -r -f ~/test.mk .deps/test.fmc
echo ".deps/test.fmc : test.f90" 
.deps/test.fmc : test.f90
address@hidden:~/lib$ 
--8<---------------cut here---------------end--------------->8---


But with ~/ being the cwd, it won't:
--8<---------------cut here---------------start------------->8---
address@hidden:~/lib$ cd ~/
address@hidden:~$ LC_ALL=C make -r -df ~/test.mk lib/.deps/test.fmc
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu
Reading makefiles...
Reading makefile `/home/nic/test.mk'...
Updating makefiles....
 Considering target file `/home/nic/test.mk'.
  Looking for an implicit rule for `/home/nic/test.mk'.
  No implicit rule found for `/home/nic/test.mk'.
  Finished prerequisites of target file `/home/nic/test.mk'.
 No need to remake target `/home/nic/test.mk'.
Updating goal targets....
Considering target file `lib/.deps/test.fmc'.
 File `lib/.deps/test.fmc' does not exist.
 Looking for an implicit rule for `lib/.deps/test.fmc'.
 No implicit rule found for `lib/.deps/test.fmc'.
 Finished prerequisites of target file `lib/.deps/test.fmc'.
Must remake target `lib/.deps/test.fmc'.
make: *** No rule to make target `lib/.deps/test.fmc'.  Stop.
address@hidden:~$
--8<---------------cut here---------------end--------------->8---

Any hints on how to make pattern rules work with having targets and
prerequisites within different (sub)directories?

Thank you very much!

Nicolai
.deps/%.fmc: %.f90
        echo "$@ : $<" 

reply via email to

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