help-make
[Top][All Lists]
Advanced

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

Re: include question


From: Paul D. Smith
Subject: Re: include question
Date: Thu, 9 Dec 2004 12:23:55 -0500

%% "Dill, John" <address@hidden> writes:

  dj> I have a question about the include directive.  I have two files,
  dj> where one includes the other.  In each of these files, they both
  dj> include a common file.  Is that common file included twice?

Yes.  Just like C.

  dj> I have a few makefile functions that I've implemented which build
  dj> off of each other, and I have tended to include every file for
  dj> which a user-defined function is used.  But I find this is
  dj> affecting the make response time, in the realm of seconds now on a
  dj> slower machine.  My guess is that this can be due to multiple
  dj> inclusion of the same files.  Is this a possibility?

Could be.

You can use the same tricks with make that have been used with C for 30
years:

    $ cat defs.mk

    ifndef _defs.mk
    _defs.mk := 1

        ...

    endif

If you don't even want to try reading the file at all when it's already
been included, you have to put the ifndef around the include statement:

    ifndef _defs.mk
    include defs.mk
    endif

-- 
-------------------------------------------------------------------------------
 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]