Make doesn't support user CFLAGS

Using CVS version of SDL; if you don’t specify CFLAGS in the configure' command line but rather in themake’ command line, it overwrites the
Makefile’s CFLAGS, thus compilation is not possible (ie. the $INCLUDES
aren’t included.)

ie.
../HEAD/configure --prefix=/mingw && make' works…/HEAD/configure --prefix=/mingw CFLAGS="-O2" && make’ works
`…/HEAD/configure --prefix=/mingw && make CFLAGS="-O2"’ fails

This will also be true for LDFLAGS.

Julien

this is normal behavior …
CFLAGS="-O2" make
should work
-mikeOn Friday 10 March 2006 17:11, Julien Lecomte wrote:

Using CVS version of SDL; if you don’t specify CFLAGS in the configure' command line but rather in themake’ command line, it overwrites the
Makefile’s CFLAGS, thus compilation is not possible (ie. the $INCLUDES
aren’t included.)

Using CVS version of SDL; if you don’t specify CFLAGS in the configure' command line but rather in themake’ command line, it overwrites the
Makefile’s CFLAGS, thus compilation is not possible (ie. the $INCLUDES
aren’t included.)

this is normal behavior …

Please explain. I don’t consider that as ‘normal’.
When using configure and make, we expect some things to work, and `make
CFLAGS=…’ is one of them.

CFLAGS="-O2" make
should work

Well, it compiles without fuss because my CFLAGS are ignored: ie, if I
specify “-O1”, it isn’t even in the command line. It’s as if I had just
plainly done a `make’ with no flags:

$ CFLAGS="-O1" make /bin/sh ../SDLmain/build-scripts/mkinstalldirs build mkdir -p -- build /bin/sh ./libtool --mode=compile gcc -g -O2 -D_GNU_SOURCE=1 -Iinclude -I../SDLmain/include -c ../SDLmain/src/SDL.c -o build/SDL.lo mkdir build/.libs gcc -g -O2 -D_GNU_SOURCE=1 -Iinclude -I../SDLmain/include -c ../SDLmain/src/SDL.c -DDLL_EXPORT -DPIC -o build/.libs/SDL.o

BTW, some other problems (still under MinGW):

  • You can’t abort while configure is executing the part which generates
    dependencies (minor problem though)

  • If package is configured in other directory that source, and you `make
    distclean -i -k’ (see below), all the dependency files are still present
    afterwards (those '.#{number}_*_h files)

  • If package is configured in other directory that source, `make
    distclean’ fails:

$ make distclean <...snip...> rm -rf ../SDLmain/autom4te* find ../SDLmain \ -name '*~' -o -name '*.bak' -o -name '*.old' -o -name '*.rej' -o \ -name '.#*' \ -exec rm -f {} \; cp include/SDL_config.h.minimal include/SDL_config.h cp: cannot stat `include/SDL_config.h.minimal': No such file or directory make: *** [distclean] Error 1 On 11/03/2006 00:01, Mike Frysinger wrote: > On Friday 10 March 2006 17:11, Julien Lecomte wrote:

When using configure and make, we expect some things to work, and `make
CFLAGS=…’ is one of them.

Yep.

CFLAGS="-O2" make
should work

Nope.

Try what you originally said:
make CFLAGS="-O2"

  • If package is configured in other directory that source, and you `make
    distclean -i -k’ (see below), all the dependency files are still present
    afterwards (those '.#{number}_*_h files)

This is fixed in CVS, thanks!

  • If package is configured in other directory that source, `make
    distclean’ fails:

cp include/SDL_config.h.minimal include/SDL_config.h
cp: cannot stat `include/SDL_config.h.minimal’: No such file or directory

This is fixed in CVS as well.

Thanks!
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

BTW, some other problems (still under MinGW):

  • You can’t abort while configure is executing the part which generates
    dependencies (minor problem though)

On Windows, try using Ctrl-PAUSE/BREAK not Ctrl-C.On Sat, 2006-03-11 at 20:14 +0100, Julien Lecomte wrote:

On 11/03/2006 00:01, Mike Frysinger wrote:


John Skaller
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net

Organization: None
References:

When using configure and make, we expect some things to work, and `make
CFLAGS=…’ is one of them.

Yep.
Agreed.

CFLAGS="-O2" make
should work

Nope.
I think Mike confused `CFLAGS="-O2" ./configure && make’ (which, I do
recall, is deprecated) with the above line.

Try what you originally said:
make CFLAGS="-O2"
Well, no it doesn’t work (latest CVS). CFLAGS is hard scripted in the
Makefile generated by configure. So if you run `make CFLAGS="-O2"’, then
the Makefile CFLAGS are overwritten.
That means, that $(INCLUDES) are also overwritten. CFLAGS should be
separate from BUILD_CFLAGS, and BUILD_CFLAGS should be whatever SDL
strictly needs (without -g and -O2), plus CFLAGS.
ie:
CFLAGS = @CFLAGS@
BUILD_FLAGS = @BUILD_FLAGS@ $(CFLAGS)

This also requires to review the configure.in. Configure will
automatically set CFLAGS to “-g -O2”, so if we run `make CFLAGS="-O2"’,
only CFLAGS is overidden and BUILD_FLAGS stays valid.

I doubt I have time to review the configure script for you, but if I do
have the time, I’ll send you a patch.

BTW, dumb question, why would an end user want the dependencies to be
generated ? It just takes time, and usually isn’t needed for people who
just compile, make and then install (and never dev anything).

Julien

----- Original Message -----
Subject: Re: [SDL] Make doesn’t support user CFLAGS
Date: Sun, 12 Mar 2006 19:10:42 +0100
From: @Julien_Lecomte (Julien Lecomte)
Reply-To: @Julien_Lecomte
To: Sam Lantinga
On 11/03/2006 21:36, Sam Lantinga wrote:

That means, that $(INCLUDES) are also overwritten. CFLAGS should be
separate from BUILD_CFLAGS, and BUILD_CFLAGS should be whatever SDL
strictly needs (without -g and -O2), plus CFLAGS.
ie:
CFLAGS = @CFLAGS@
BUILD_FLAGS = @BUILD_FLAGS@ $(CFLAGS)

Unfortunately, CFLAGS needs to include most of the stuff in BUILD_FLAGS
for the configure script to work properly.

BTW, dumb question, why would an end user want the dependencies to be
generated ? It just takes time, and usually isn’t needed for people who
just compile, make and then install (and never dev anything).

To build objects in a separate directory from the source, I have to create
custom build rules for each of the source files. I generate dependencies
at the same time.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

This should be fixed in CVS, thanks!

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment