Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-28-2004, 02:23 PM   #1
Registered: Jul 2004
Location: Spain
Posts: 111

Rep: Reputation: 20
What is CFLAGS variable used in Makefiles for?

Hello there, i noticed a variable called CFLAGS inside Makefiles, it differs from other variables, so, what is it for?

Thanks in advance.
Old 12-28-2004, 02:54 PM   #2
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
Its for passing flags to the C compiler. Things like -ansi ( use ANSI standard C ) -W ( Turn on Warnings ) -Wall ( Report all warnings ) and many others.

There's also CPPFLAGS and CXXFLAGS, mainly used for C++.
Old 12-28-2004, 03:35 PM   #3
Registered: Jul 2004
Location: Spain
Posts: 111

Original Poster
Rep: Reputation: 20
Yeah, so i must store all gcc flags i want to use in CFLAGS assigning flags with the = ,and then, adding more ones with the += operator. Thanks.
Old 12-28-2004, 06:03 PM   #4
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You don't have to, you can add them directly to the commands. CFLAGS is good when you need one set of options for all files (like optimization, warinings etc).
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Is it possible to add a "DESTDIR" variable in makefiles that don't have it ? nasty_daemon Programming 2 11-25-2005 02:24 PM
cflags exodist Linux - Software 2 01-14-2005 08:44 PM
Using CFLAGS and other options vexer Linux From Scratch 7 08-18-2004 10:04 AM
CFLAGS environment variable for PIV fineass Linux - Software 1 08-16-2004 03:58 PM
CFLAGS library -l and -i abs Programming 2 04-11-2004 11:03 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:11 PM.

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