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 />

The MAKE macro provides a way to override the -n option and execute selected<br />

commands in a makefile. When MAKE is used in a command, make will always execute<br />

that command, even if -n has been given in the invocation. The variable may be set to<br />

any value or command sequence.<br />

The MAKEFLAGS macro contains one or more make options and can be used in<br />

invocations of make from within a makefile. You may assign any make options to<br />

MAKEFLAGS except -f, -p, and -d. If you do not assign a value to the macro, make<br />

automatically assigns the current options to it, i.e., the options given in the current<br />

invocation.<br />

The MAKE and MAKEFLAGS macros, together with the -n option, are typically used to<br />

debug makefiles that generate entire software systems. For example, in the following<br />

makefile, setting MAKE to "make" and invoking this file with the -n option displays all<br />

the commands used to generate the programs progl, prog2, and prog3 without actually<br />

executing them.<br />

system : prog 1 prog2 prog3<br />

@echo System complete.<br />

prog 1 : prog 1.c<br />

$(MAKE) $(MAKE FLAGS) prog 1<br />

prog2 : prog2.c<br />

$(MAKE) $(MAKEFLAGS) prog2<br />

prog3 : prog3.c<br />

$(MAKE) $(MAKEFLAGS) prog3<br />

Using the Built-In Rules<br />

make provides a set of built-in dependency lines, called built-in rules, that<br />

automatically check the targets and dependents given in a makefile and create up-todate<br />

versions of these files if necessary. The built-in rules are identical to user-defined<br />

dependency lines except that they use the suffix of the file name as the target or<br />

dependent instead of the file name itself. For example, make automatically assumes<br />

that all files with the suffix .o have dependent files with the suffixes .c and .s.<br />

When no explicit dependency line is given in a makefile for a given file, make<br />

automatically checks the default dependents of the file, forming the name of the<br />

dependents by removing the suffix of the given file and appending the predefined<br />

dependent suffixes. If the given file is out of date with respect to these default<br />

dependents, make searches for a built-in rule that defines how to create an up to date<br />

version of the file and executes it. There are built-in rules for the following files:<br />

.o Object file<br />

.c C source file<br />

.r Ratfor source file<br />

.f Fortran source file<br />

4-8

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

Saved successfully!

Ooh no, something went wrong!