After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664304 - make: Allow specifying make flags
make: Allow specifying make flags
Status: RESOLVED FIXED
Product: jhbuild
Classification: Infrastructure
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Jhbuild maintainers
Jhbuild QA
Depends on:
Blocks:
 
 
Reported: 2011-11-17 22:19 UTC by Colin Walters
Modified: 2012-02-19 23:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
make: Allow specifying make flags (1.36 KB, patch)
2011-11-17 22:19 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2011-11-17 22:19:39 UTC
Usage:  jhbuild make CFLAGS='-g -O0'
Comment 1 Colin Walters 2011-11-17 22:19:41 UTC
Created attachment 201625 [details] [review]
make: Allow specifying make flags
Comment 2 Craig Keogh 2011-11-21 01:26:29 UTC
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.
Comment 3 Colin Walters 2011-11-21 15:43:30 UTC
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...
Comment 4 Craig Keogh 2011-11-27 10:01:17 UTC
(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.
Comment 5 Colin Walters 2011-12-02 20:11:28 UTC
(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?
Comment 6 Craig Keogh 2011-12-08 11:35:13 UTC
(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.
Comment 7 Colin Walters 2011-12-20 17:24:50 UTC
(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)
Comment 8 Colin Walters 2011-12-20 20:13:34 UTC
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 9 Craig Keogh 2012-02-19 11:34:06 UTC
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.
Comment 10 Colin Walters 2012-02-19 23:57:35 UTC
Attachment 201625 [details] pushed as f786b9f - make: Allow specifying make flags