LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2018, 06:29 PM   #1
Andy Alt
Member
 
Registered: Jun 2004
Location: Minnesota, USA
Distribution: Slackware64-stable, Manjaro, Debian64 stable
Posts: 528

Rep: Reputation: 167Reputation: 167
When building using a Makefile, O2 and g are being added automatically


On Debian 9, when I build this program using make, -g and O2 are being added to the gcc flags automatically. If I manually add -g and -O0 on this line (and re-run automake), it appears 2 times for each file during the build process. So during the build I'd see.. "-g -g -O2 -O0"

If I use `CFLAGS="-O0 -g" ../configure' then the "duplicates" go away.

My goal is to specify any desired flags in Makefile.am and not have any appear from nowhere.

I'm the maintainer for the program, btw.

There's a "Travis" build log at https://travis-ci.org/theimpossiblea...454774151#L553

Last edited by Andy Alt; 11-13-2018 at 06:54 PM.
 
Old 11-14-2018, 02:11 PM   #2
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by Andy Alt View Post
On Debian 9, when I build this program using make, -g and O2 are being added to the gcc flags automatically.
As far as I remember "make" uses some default value for CFLAGS if the makefile doesn't supply one itself. So just define any value for CFLAGS yourself in the makefile or define it into the environment (make will pick up that value too).
 
Old 11-14-2018, 03:46 PM   #3
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
I suspect the default is coming from the AC_PROG_CC macro in configure.ac

https://www.gnu.org/software/autocon...-Compiler.html
Quote:
If you do not like the default insert the line ‘: ${CFLAGS=""}’ after AC_INIT and before AC_PROG_CC to select an empty default instead.
Give that a go and see how you get on.
 
2 members found this post helpful.
Old 11-15-2018, 10:29 PM   #4
Andy Alt
Member
 
Registered: Jun 2004
Location: Minnesota, USA
Distribution: Slackware64-stable, Manjaro, Debian64 stable
Posts: 528

Original Poster
Rep: Reputation: 167Reputation: 167
Quote:
insert the line ‘: ${CFLAGS=""}’ after AC_INIT and before AC_PROG_CC
That worked!

Just for the record, before I added that line, I tried removing AC_PROG_CC but the flags still showed up (so they are apparently coming from another source as well).
 
Old 06-29-2019, 01:10 AM   #5
Andy Alt
Member
 
Registered: Jun 2004
Location: Minnesota, USA
Distribution: Slackware64-stable, Manjaro, Debian64 stable
Posts: 528

Original Poster
Rep: Reputation: 167Reputation: 167
This thread from the GNU autoconf archive has some extra, relevant information about this topic.
 
  


Reply

Tags
automake



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to prevent a route being automatically added to an static-IP'd interface triley831 Linux - Networking 1 09-27-2018 09:19 AM
make: Warning: Both `makefile' and `Makefile' exist ? malli42108 Solaris / OpenSolaris 5 10-24-2009 09:09 AM
Help: Added HDD gives no added free space? LouArnold Linux - Hardware 5 10-12-2009 11:27 AM
automake, makefile, makefile.in and makefile.am Fond_of_Opensource Linux - Newbie 1 09-12-2006 08:35 PM
what is the meaning of Makefile,Makefile.am,Makefile.in cynthia_thomas Linux - General 3 12-08-2005 05:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration