Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.3 Variables Used by Implicit Rules

The commands in built-in implicit rules make liberal use of certain predefined variables. You can alter these variables in the makefile, with arguments to make, or in the environment to alter how the implicit rules work without redefining the rules themselves. You can cancel all variables used by implicit rules with the `-R' or `--no-builtin-variables' option.

For example, the command used to compile a C source file actually says `$(CC) -c $(CFLAGS) $(CPPFLAGS)'. The default values of the variables used are `cc' and nothing, resulting in the command `cc -c'. By redefining `CC' to `ncc', you could cause `ncc' to be used for all C compilations performed by the implicit rule. By redefining `CFLAGS' to be `-g', you could pass the `-g' option to each compilation. All implicit rules that do C compilation use `$(CC)' to get the program name for the compiler and all include `$(CFLAGS)' among the arguments given to the compiler.

The variables used in implicit rules fall into two classes: those that are names of programs (like CC) and those that contain arguments for the programs (like CFLAGS). (The "name of a program" may also contain some command arguments, but it must start with an actual executable program name.) If a variable value contains more than one argument, separate them with spaces.

Here is a table of variables used as names of programs in built-in rules:

AR
Archive-maintaining program; default `ar'.

AS
Program for doing assembly; default `as'.

CC
Program for compiling C programs; default `cc'.

CXX
Program for compiling C++ programs; default `g++'.

CO
Program for extracting a file from RCS; default `co'.

CPP
Program for running the C preprocessor, with results to standard output; default `$(CC) -E'.

FC
Program for compiling or preprocessing Fortran and Ratfor programs; default `f77'.

GET
Program for extracting a file from SCCS; default `get'.

LEX
Program to use to turn Lex grammars into C programs or Ratfor programs; default `lex'.

PC
Program for compiling Pascal programs; default `pc'.

YACC
Program to use to turn Yacc grammars into C programs; default `yacc'.

YACCR
Program to use to turn Yacc grammars into Ratfor programs; default `yacc -r'.

MAKEINFO
Program to convert a Texinfo source file into an Info file; default `makeinfo'.

TEX
Program to make TeX DVI files from TeX source; default `tex'.

TEXI2DVI
Program to make TeX DVI files from Texinfo source; default `texi2dvi'.

WEAVE
Program to translate Web into TeX; default `weave'.

CWEAVE
Program to translate C Web into TeX; default `cweave'.

TANGLE
Program to translate Web into Pascal; default `tangle'.

CTANGLE
Program to translate C Web into C; default `ctangle'.

RM
Command to remove a file; default `rm -f'.

Here is a table of variables whose values are additional arguments for the programs above. The default values for all of these is the empty string, unless otherwise noted.

ARFLAGS
Flags to give the archive-maintaining program; default `rv'.

ASFLAGS
Extra flags to give to the assembler (when explicitly invoked on a `.s' or `.S' file).

CFLAGS
Extra flags to give to the C compiler.

CXXFLAGS
Extra flags to give to the C++ compiler.

COFLAGS
Extra flags to give to the RCS co program.

CPPFLAGS
Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers).

FFLAGS
Extra flags to give to the Fortran compiler.

GFLAGS
Extra flags to give to the SCCS get program.

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker, `ld'.

LFLAGS
Extra flags to give to Lex.

PFLAGS
Extra flags to give to the Pascal compiler.

RFLAGS
Extra flags to give to the Fortran compiler for Ratfor programs.

YFLAGS
Extra flags to give to Yacc.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

 
 
  Published under the terms of the GNU General Public License Design by Interspire