09.06.2013 Views

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

make: Program Maintainer <strong>XENIX</strong> Programming<br />

If a dependency line is too long, you can continue it by typing a backslash (\)<br />

immediately followed by a newline character.<br />

The makefile should be kept in the same directory as the given source files. For<br />

convenience, the file names makefile, Makefile, s.makefile, and s.Makefile are provided<br />

as default file names used by make if no explicit name is given at invocation. You may<br />

use one of these names for your makefile or choose one of your own. If the file name<br />

begins with the s. prefix, make assumes that it is an sees file and invokes the<br />

appropriate sees command to retrieve the latest version of the file.<br />

To illustrate dependency lines, consider the following example. A program named prog<br />

is made by linking three object files, x.o, y.o, and z.o. These object files are created by<br />

compiling the e language source files x.c, y.c, and z.c. Furthermore, the files x.c and<br />

y.c contain the line<br />

#include "defs"<br />

This means that prog depends on the three object files, the object files depend on the e<br />

source files, and two of the source files depend on the include file defs. You can<br />

represent these relationships in a makefile with the following lines<br />

prog : x.o y.o z.o<br />

cc x.o y.o z.o -o prog<br />

x.o: x.c defs<br />

cc -c x.c<br />

y.o: y.c defs<br />

cc -c y.c<br />

z.o: z.c<br />

cc -c z.c<br />

In the first dependency line, prog is the target file and x.o, y.o, and z.o are its<br />

dependents. The command sequence<br />

cc x.o y.o z.o -o prog<br />

on the next line tells how to create prog if it is out of date. The program is out of date<br />

if any one of its dependents has been modified since prog was last created.<br />

The second, third, and fourth dependency lines have the same form, with the x.o, y.o,<br />

and z.o files as targets and x.c, y.c, z.c, and defs files as dependents. Each dependency<br />

line has one command sequence that defines how to update the given target file.<br />

4-2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!