Chapter 10: Using Implicit Rules 113
Compiling C++ programs
n.o is made automatically from n.cc, n.cpp, or n.C with a recipe of the form
‘$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c’. We encourage you to use the suffix
‘.cc’ for C++ source files instead of ‘.C’.
Compiling Pascal programs
n.o is made automatically from n.p with the recipe ‘$(PC) $(PFLAGS) -c’.
Compiling Fortran and Ratfor programs
n.o is made automatically from n.r, n.F or n.f by running the Fortran com-
piler. The precise recipe used is as follows:
‘.f’ ‘$(FC) $(FFLAGS) -c’.
‘.F’ ‘$(FC) $(FFLAGS) $(CPPFLAGS) -c’.
‘.r’ ‘$(FC) $(FFLAGS) $(RFLAGS) -c’.
Preprocessing Fortran and Ratfor programs
n.f is made automatically from n.r or n.F. This rule runs just the preprocessor
to convert a Ratfor or preprocessable Fortran program into a strict Fortran
program. The precise recipe used is as follows:
‘.F’ ‘$(FC) $(CPPFLAGS) $(FFLAGS) -F’.
‘.r’ ‘$(FC) $(FFLAGS) $(RFLAGS) -F’.
Compiling Modula-2 programs
n.sym is made from n.def with a recipe of the form ‘$(M2C)
$(M2FLAGS) $(DEFFLAGS)’. n.o is made from n.mod; the form is:
‘$(M2C) $(M2FLAGS) $(MODFLAGS)’.
Assembling and preprocessing assembler programs
n.o is made automatically from n.s by running the assembler, as. The precise
recipe is ‘$(AS) $(ASFLAGS)’.
n.s is made automatically from n.S by running the C preprocessor, cpp. The
precise recipe is ‘$(CPP) $(CPPFLAGS)’.
Linking a single object file
n is made automatically from n.o by running the linker (usu-
ally called ld) via the C compiler. The precise recipe used is
‘$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)’.
This rule does the right thing for a simple program with only one source file. It
will also do the right thing if there are multiple object files (presumably coming
from various other source files), one of which has a name matching that of the
executable file. Thus,
x: y.o z.o
when x.c, y.c and z.c all exist will execute:
Comentários a estes Manuais