What options should be set in Make variables CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'd like to understand how gcc options be used in Make variables.

In Option Summary of the man page of gcc, I see many sections about
options, like the following. What should be in CFLAGS, CXXFLAGS,
CPPFLAGS and LDFLAGS, respectively?

For example, should -g be used in CPPFLAGS or both CFLAGS and
CXXFLAGS? Should it be used with LDFLAGS? What about -O2? Thanks.

       Overall Options
       C Language Options
       C++ Language Options
       Objective-C and Objective-C++ Language Options
       Language Independent Options
       Warning Options
       C and Objective-C-only Warning Options
       Debugging Options
       Optimization Options
       Preprocessor Options
       Linker Options
       Directory Options
       Machine Dependent Options
           AArch64 Options -mabi=name  -mbig-endian  -mlittle-endian
           Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
           ARC Options -mbarrel-shifter -mcpu=cpu -mA6 -mARC600 -mA7 -mARC700
           ARM Options -mapcs-frame  -mno-apcs-frame -mabi=name
           AVR Options -mmcu=mcu -maccumulate-args -mbranch-cost=cost
           Blackfin Options -mcpu=cpu[-sirevision] -msim
           C6X Options -mbig-endian  -mlittle-endian -march=cpu -msim
           CRIS Options -mcpu=cpu  -march=cpu  -mtune=cpu -mmax-stack-frame=n
           CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
           Darwin Options -all_load  -allowable_client  -arch
           DEC Alpha Options -mno-fp-regs  -msoft-float -mieee
           FR30 Options -msmall-model -mno-lsim
           FRV Options -mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 -mhard-float
           GNU/Linux Options -mglibc -muclibc -mbionic -mandroid
           H8/300 Options -mrelax  -mh  -ms  -mn  -mexr -mno-exr  -mint32
           HPPA Options -march=architecture-type -mdisable-fpregs
           IA-64 Options -mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld
           LM32 Options -mbarrel-shift-enabled -mdivide-enabled
           M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
           M32C Options -mcpu=cpu -msim -memregs=number
           M680x0 Options -march=arch  -mcpu=cpu  -mtune=tune -m68000  -m68020
           MCore Options -mhardlit  -mno-hardlit  -mdiv  -mno-div
           MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops -mc=n
           MicroBlaze Options -msoft-float -mhard-float -msmall-divides
           MIPS Options -EL  -EB  -march=arch  -mtune=arch -mips1  -mips2
           MMIX Options -mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon
           MN10300 Options -mmult-bug  -mno-mult-bug -mno-am33 -mam33 -mam33-2
           Moxie Options -meb -mel -mmul.x -mno-crt0
           MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
           NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
           Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt -mel -meb
           Nvidia PTX Options -m32 -m64 -mmainkernel
           PDP-11 Options -mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45
           picoChip Options -mae=ae_type -mvliw-lookahead=N
           PowerPC Options See RS/6000 and PowerPC Options.
           RL78 Options -msim -mmul=none -mmul=g13 -mmul=rl78 -m64bit-doubles
           RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
           RX Options -m64bit-doubles  -m32bit-doubles  -fpu  -nofpu -mcpu=
           S/390 and zSeries Options -mtune=cpu-type  -march=cpu-type
           Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
           SH Options -m1  -m2  -m2e -m2a-nofpu -m2a-single-only -m2a-single
           Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
           SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
           SPU Options -mwarn-reloc -merror-reloc -msafe-dma -munsafe-dma
           System V Options -Qy  -Qn  -YP,paths  -Ym,dir
           TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian
           TILEPro Options -mcpu=cpu -m32
           V850 Options -mlong-calls  -mno-long-calls  -mep  -mno-ep
           VAX Options -mg  -mgnu  -munix
           Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
           VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
           VxWorks Options -mrtp  -non-static  -Bstatic  -Bdynamic -Xbind-lazy
           x86 Options -mtune=cpu-type  -march=cpu-type -mtune-ctrl=feature-
           x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
           Xstormy16 Options -msim
           Xtensa Options -mconst16 -mno-const16 -mfused-madd  -mno-fused-madd
           zSeries Options See S/390 and zSeries Options.
       Code Generation Options
   Options Controlling the Kind of Output
           Options in file are separated by whitespace.  A whitespace
   Options Controlling C Dialect
   Options Controlling C++ Dialect
   Options Controlling Objective-C and Objective-C++ Dialects
   Options to Control Diagnostic Messages Formatting
   Options to Request or Suppress Warnings
       For further language-specific options also refer to C++ Dialect Options
       and Objective-C and Objective-C++ Dialect Options.
       specificity, the last one takes effect. Options enabled or disabled via
           Options and Objective-C and Objective-C++ Dialect Options.
   Options for Debugging Your Program or GCC
   Options That Control Optimization
       Options of the form -fflag specify machine-independent flags.  Most
   Options Controlling the Preprocessor
   Passing Options to the Assembler
   Options for Linking
   Options for Directory Search
       AArch64 Options
       Adapteva Epiphany Options
       ARC Options
       ARM Options
       AVR Options
       Blackfin Options
       C6X Options
       CRIS Options
       CR16 Options
       Darwin Options
       DEC Alpha Options
       FR30 Options
       FRV Options
       GNU/Linux Options
       H8/300 Options
       HPPA Options
       IA-64 Options
       LM32 Options
       M32C Options
       M32R/D Options
       M680x0 Options
       MCore Options
       MeP Options
       MicroBlaze Options
       MIPS Options
       MMIX Options
       MN10300 Options
       Moxie Options
       MSP430 Options
       NDS32 Options
       Nios II Options
       Nvidia PTX Options
       PDP-11 Options
       picoChip Options
       PowerPC Options
       RL78 Options
       IBM RS/6000 and PowerPC Options
       RX Options
       S/390 and zSeries Options
       Score Options
       SH Options
       Solaris 2 Options
       SPARC Options
       SPU Options
       Options for System V
       TILE-Gx Options
       TILEPro Options
       V850 Options
       VAX Options
       Visium Options
       VMS Options
       VxWorks Options
       Options specific to the target hardware are listed with the other
       x86 Options
       x86 Windows Options
       See also under x86 Options for standard options.
       Xstormy16 Options
       Xtensa Options
       zSeries Options
   Options for Code Generation Conventions

-- 
Regards,
Peng



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux