Hi,

I was having errors with my Makefiles (for Objective Caml), and I could 
pinpoint the problem with the attached very simple Makefile.

Basically (please see the attached Makefile), I use a:

-include fake.depend

statement to include a dependencies makefile 'fake.depend', but this included 
makefile does not exists and cannot be made.  Indeed, fake.depend can be made 
from fake.c, but fake.c does not exist, and it isn't the target of any rule 
-- explicit or implicit).

So I expected make to simply ignore fake.depend (as explained in GNU make's 
manual).

However, it seems that make still wants to make fake.c, as fake.c is the 
prerequisite of another explicit rule (dummy-fake), even though this rule 
shouldn't be used at all in the make process.

I believe that this is a bug, but if it isn't, then I guess the manual should 
be more precise on this subject.

Thanks a lot,

Gregoire Sutre.

-- 
Grégoire Sutre                         Bureau 211
[EMAIL PROTECTED]                         LaBRI - CNRS UMR 5800
http://www.labri.fr/~sutre             Domaine Universitaire
Tel: +33 5 56 84 33 36                 351, cours de la Libération
Fax: +33 5 56 84 66 69                 33405 Talence Cedex, FRANCE
# Strange GNU make behavior?
#
# Assume that:
# - there is a file real.c in the directory,
# - but there is no file fake.c in the directory
#
# Then make complains saying:
#
# make: *** No rule to make target `fake.c', needed by `fake.depend'.  Stop.
#
# But if we remove fake.c from the prerequisites of target dummy-fake, then
# everything works fine (fake.depend is ignored since we can't build it,
# which is what we wanted).
#
# This is odd, since the rule "dummy-fake: fake.c" isn't used at all


all: dummy-real

dummy-real: real.c
dummy-fake: fake.c

%.depend : %.c
	touch $@

# Dependencies

-include real.depend
-include fake.depend

Reply via email to