GNOME Bugzilla – Bug 664304
make: Allow specifying make flags
Last modified: 2012-02-19 23:57:38 UTC
Usage: jhbuild make CFLAGS='-g -O0'
Created attachment 201625 [details] [review] make: Allow specifying make flags
Review of attachment 201625 [details] [review]: Thank you for the report and patch. I had a look at a few modules. None of them allow changes CFLAGS at the make stage. CFLAGS must be set at the configure stage.
Hmm? Setting CFLAGS at the make stage is explicitly supported by the autotools: http://www.gnu.org/software/automake/manual/html_node/User-Variables.html#User-Variables http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html#Flag-Variables-Ordering It is also not uncommon to override a user variable at make-time. Many installers do this with prefix, but this can be useful with compiler flags too. For instance, if, while debugging a C++ project, you need to disable optimization in one specific object file, you can run something like rm file.o make CXXFLAGS=-O0 file.o make Also, it actually works here...
(In reply to comment #3) > Also, it actually works here... I tried atk, pango, dconf, libgpg-error, then gave up. None of them support setting CFLAGS at make.
(In reply to comment #4) > (In reply to comment #3) > > Also, it actually works here... > > I tried atk, pango, dconf, libgpg-error, then gave up. None of them support > setting CFLAGS at make. Can you give me the actual commands you tried, and the result?
(In reply to comment #5) > Can you give me the actual commands you tried, and the result? I have the following in .jhbuildrc: os.environ['CFLAGS'] = '-O0 -g' Build atk via 'jhbuild tinderbox'. # cd ~/gnome/atk # make clean # CFLAGS=-failfailfail make Build should fail. It doesn't.
(In reply to comment #6) > # CFLAGS=-failfailfail make > > Build should fail. It doesn't. You need to do: make CFLAGS=-failfailfail (Not the difference between make variables and environment variables)
To elaborate, the reason the os.environ setting in your jhbuildrc works is that "configure" will propagate defaults for CFLAGS from the Unix environment when run.
Comment on attachment 201625 [details] [review] make: Allow specifying make flags Patch is ok by me. I'm not a fan of using undocumented features from Python Standard Library, but pipes.quote seems stable from 2.3 thro 3.2.
Attachment 201625 [details] pushed as f786b9f - make: Allow specifying make flags