help-make
[Top][All Lists]
Advanced

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

Re: Library dependency files


From: Erik Rull
Subject: Re: Library dependency files
Date: Wed, 28 Apr 2010 23:34:24 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 SeaMonkey/1.1.17

Todd Showalter wrote:
    We're case b, but the problem remains.  I'll try to give a more
concrete example:

    Say we've got an environment variable, $BUILD_NETWORK_SUPPORT, and
it's currently set to 0.  Within the makefile we have

CFLAGS+= -DBUILD_NETWORK_SUPPORT=$(BUILD_NETWORK_SUPPORT)

    Within a C file we have:

#if (BUILD_NETWORK_SUPPORT == 1)
#include "Network.h"
#else
#include "Network.Stub.h"
#endif

    Now say on the command line I do:

make
export BUILD_NETWORK_SUPPORT=1
make

    The second invocation of make will not detect the change, and the
dependencies will be wrong.


Simple solution:
- write down the current parameter settings that will be changed via Makefile parameters into a file (e.g. echo -en "$(CFLAGS)" > compile_settings.txt; syntax might be wrong, just to show what I want to express) - read the file and compare it to the "current" settings string. If different do a clean and then a make and sync the file with the most recent parameters

You just need a function in your makefile how to create the string and how to read the file and compare it and what to do if it has changed.

Should be possible to be solved with pure make.

Best regards,

Erik




reply via email to

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