help-make
[Top][All Lists]
Advanced

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

Re: circular includes cause infinite loop


From: Paul D. Smith
Subject: Re: circular includes cause infinite loop
Date: Wed, 23 Oct 2002 17:01:35 -0400

%% gk <address@hidden> writes:

  g> I'm using Gnu make 3.79.1 I've noticed that there is no test for
  g> circularity of include statements, like there is for circular
  g> dependencies.  I think it would be a nice feature to add.

Unlike prerequisites, circular includes could be done without looping
infinitely (because you can use preprocessor statements to control
this).

  g> --- Makefile:
  g> include Makefile2

  g> --- Makefile2:
  g> include Makefile

  g> Infinite loop results.

  g> How should this be prevented?

The same way as it's done in C:

  $ cat MyMakefile.mk
  ifndef __MY_MAKEFILE
  __MY_MAKEFILE := 1

    ...contents...

  endif


In 3.80 I suppose you could test the MAKEFILE_LIST variable to see if
the file is already included, and not include it if it has been.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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