[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fatal errors for missing include files.
From: |
Noel Yap |
Subject: |
Re: fatal errors for missing include files. |
Date: |
Mon, 30 Aug 2004 08:18:41 -0400 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040212) |
If you don't want the include to be an error, use -include. For example:
-include foo.mk
Of course, if GNU make isn't able to build foo.mk for any reason, it's still
not an error.
HTH,
Noel
Ian Dunbar wrote:
> Hi,
>
> I am not totally sure if this is a bug or not. Make's non-fatal warnings
> about missing include files seem to become fatal errors when you include
> another file from the "includee". I have reduced it to an example as
> follows:
>
> ~> cat > Makefile
> default:
>
> %.mk: %.prj
> cp $< $@
>
> include sub.mk
>
> ~> cat > sub.prj
> include subsub.mk
>
> ~> cat > subsub.prj
> # empty
>
> ~> make
> Makefile:6: sub.mk: No such file or directory
> cp sub.prj sub.mk
> sub.mk:1: subsub.mk: No such file or directory
> cp subsub.prj subsub.mk
> make: Nothing to be done for `default'.
>
> So far so good, the behaviour is as I would expect. I checked the database,
> and your Bug#102 talks about those warning messages there, but while they
> are a bit ugly, and it would be nice if make didn't use the file it knows is
> out of date, they are not so big a deal.
>
> Now, I want to remove subsub from the project, so I do this:
>
> ~> rm subsub.*
> ~> cat > sub.prj
> # empty
>
> ~> make
> sub.mk:1: subsub.mk: No such file or directory
> make: *** No rule to make target `subsub.mk'. Stop.
>
> It gives a fatal error. I was going to say that this appears to be contrary
> to what the documentation says is the correct behaviour:
>
> "3.3 Including Other Makefiles ... If an included makefile cannot be found
> in any of these directories, a warning message is generated, but it is not
> an immediately fatal error; processing of the makefile containing the
> include continues. Once it has finished reading makefiles, make will try to
> remake any that are out of date or don't exist. ..."
>
> Actually though on second thought, maybe it doesn't contradict that
> statement. Has it passed the "no fatal errors" stage, and is now trying to
> generate all the submakefiles as required by the last part of the statement
> "... make will try to remake any that are out of date or don't exist"?
>
> Putting an order-only prerequisite into the original sub.prj will solve it
> if you rebuild everything.. I am not overly fond of this solution though
> becasue it is one more thing to maintain for each project. Still, it does
> work.
> ~> cat > sub.prj
> subsub.mk: | sub.mk
> include subsub.mk
>
> I don't know how I would have gotten around it before order only targets
> were introduced, so I am still inclinded to think it's a bug. In general,
> making the lowest file first seems like unusual behavour. Shouldn't make
> know that it should regenerate included files from the top down? It seems
> like it is implied by the functionality of the include keyword. Otherwise it
> could end up re-generating a lot of unneeded include files. Or is this
> intended behaviour? (why?)
>
> Best regards,
> Ian
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.745 / Virus Database: 497 - Release Date: 2004/08/27
>
>
> _______________________________________________
> Bug-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-make
>