cmakefileconfiguregnu-autogen

CFLAGS in configure script


I usually use an IDE whenever I write my own code. I don't know very much about make, configure scripts, etc.

I'm working on a large and complicated existing project now, and the steps to build are:

./autogen.sh
./configure
make

I wrote my own C files and added them to Makefile.am. I then repeat this process to build.

Everything is fine, except for one thing. I want to build without any compiler options like -Wall. I was told that using CFLAGS like this would give me what I want:

./configure CFLAGS=-O0

It doesn't seem to work, because the compiler still uses the -Wall option. I can manually remove all occurances of -Wall from the CFLAGS="..." in the configure script. This is annoying but it works. But then when I execute

./autogen.sh

The configure script is reset with all of the -Walls (and other CLFAGS I don't want) back in their original places. (I'm not sure but I think I have to run autogen.sh every time I add new files to Makefile.am.)

Is there a better way deal with this?


Solution

  • The simplest way might be to do it when actually building, using make:

    make CFLAGS=-O0
    

    That's only temporary for that build though, it won't be permanent.