|
|
1.1 root 1: .\" @(#)make 6.1 (Berkeley) 5/4/86
2: .\"
3: .EH 'PS1:12-%''Make \(em A Program for Maintaining Computer Programs'
4: .OH 'Make \(em A Program for Maintaining Computer Programs''PS1:12-%'
5: .....TR 57
6: .\".RP
7: .de IT
8: .if n .ul
9: \&\\$3\f2\\$1\fR\^\&\\$2
10: ..
11: .TL
12: Make \(em A Program for Maintaining Computer Programs
13: .AU
14: S. I. Feldman
15: .AI
16: .MH
17: .AB
18: .PP
19: In a programming project, it is easy to lose track of which files need
20: to be reprocessed or recompiled after a change is made in some part of the source.
21: .I Make
22: provides a simple mechanism for maintaining up-to-date versions of programs that result
23: from many operations on a number of files.
24: It is possible to tell
25: .I Make
26: the sequence of commands that create certain files,
27: and the list of files that require other files to be current before the operations can be done.
28: Whenever a change is made in any part of the program,
29: the
30: .I Make
31: command will create the proper files simply, correctly,
32: and with a minimum amount of effort.
33: .PP
34: The basic operation of
35: .I Make
36: is to find the name of a needed target in the description, ensure that all of the files on which it depends exist and
37: are up to date, and then create the target if it has not been modified since its generators were.
38: The description file really defines the graph of dependencies;
39: .I Make
40: does a depth-first search of this graph
41: to determine what work is really necessary.
42: .PP
43: .I Make
44: also provides a simple macro substitution facility
45: and the ability to encapsulate commands in a single file
46: for convenient administration.
47: .sp 2
48: Revised April, 1986
49: .AE
50: .SH
51: Introduction
52: .PP
53: It is common practice to divide large programs into smaller, more manageable pieces.
54: The pieces may require quite different treatments:
55: some may need to be run through a macro processor, some may need to be processed by
56: a sophisticated program generator (e.g., Yacc[1] or Lex[2]).
57: The outputs of these generators may then have to be compiled with special options and with
58: certain definitions and declarations.
59: The code resulting from these transformations may then need to be loaded together with
60: certain libraries under the control of special options.
61: Related maintenance activities involve running complicated test scripts
62: and installing validated modules.
63: Unfortunately, it is very easy for a programmer to forget which files depend on which others,
64: which files have been modified recently, and the exact sequence of operations
65: needed to make or exercise a new version of the program.
66: After a long editing session, one may easily lose track of which files have been changed
67: and which object modules are still valid,
68: since a change to a declaration can obsolete a dozen other files.
69: Forgetting to compile a routine that has been changed or that uses changed declarations will result in
70: a program that will not work, and a bug that can be very hard to track down.
71: On the other hand, recompiling everything in sight just to be safe is very wasteful.
72: .PP
73: The program described in this report mechanizes many of the activities of program development
74: and maintenance.
75: If the information on inter-file dependences and command sequences is stored in a file, the simple command
76: .DS
77: make
78: .DE
79: is frequently sufficient to update the interesting files,
80: regardless of the number that have been edited since the last ``make''.
81: In most cases, the description file is easy to write and changes infrequently.
82: It is usually easier to type the
83: .IT make
84: command than to issue even one of the needed operations, so the typical cycle of program development operations becomes
85: .DS
86: think \(em edit \(em \fImake\fR \(em test . . .
87: .DE
88: .PP
89: .IT Make
90: is most useful for medium-sized programming projects;
91: it does not solve the problems of maintaining multiple source versions
92: or of describing huge programs.
93: .IT Make
94: was designed for use on Unix, but a version runs on GCOS.
95: .SH
96: Basic Features
97: .PP
98: The basic operation of
99: .IT make
100: is to update a target file by ensuring
101: that all of the files on which it depends exist and are up to date,
102: then creating the target if it has not been modified since its dependents were.
103: .IT Make
104: does a depth-first search of the graph of dependences.
105: The operation of the command depends on the ability to find the date and time
106: that a file was last modified.
107: .PP
108: To illustrate, let us consider a simple example:
109: A program named
110: .IT prog
111: is made by compiling and loading three C-language files
112: .IT x.c ,
113: .IT y.c ,
114: and
115: .IT z.c
116: with the
117: .IT lS
118: library.
119: By convention, the output of the C compilations will be found in files named
120: .IT x.o ,
121: .IT y.o ,
122: and
123: .IT z.o .
124: Assume that the files
125: .IT x.c
126: and
127: .IT y.c
128: share some declarations in a file named
129: .IT defs ,
130: but that
131: .IT z.c
132: does not.
133: That is,
134: .IT x.c
135: and
136: .IT y.c
137: have the line
138: .DS
139: #include "defs"
140: .DE
141: The following text describes the relationships and operations:
142: .DS
143: prog : x.o y.o z.o
144: cc x.o y.o z.o \-lS \-o prog
145: .sp .5
146: x.o y.o : defs
147: .DE
148: If this information were stored in a file named
149: .IT makefile ,
150: the command
151: .DS
152: make
153: .DE
154: would perform the operations needed to recreate
155: .IT prog
156: after any changes had been made to any of the four source files
157: .IT x.c ,
158: .IT y.c ,
159: .IT z.c ,
160: or
161: .IT defs .
162: .PP
163: .IT Make
164: operates using three sources of information:
165: a user-supplied description file (as above),
166: file names and ``last-modified'' times from the file system,
167: and built-in rules to bridge some of the gaps.
168: In our example, the first line says that
169: .IT prog
170: depends on three ``\fI.o\fR'' files.
171: Once these object files are current, the second line describes how to load them to create
172: .IT prog .
173: The third line says that
174: .IT x.o
175: and
176: .IT y.o
177: depend on the file
178: .IT defs .
179: From the file system,
180: .IT make
181: discovers that there are three ``\fI.c\fR'' files corresponding to the needed ``\fI.o\fR'' files,
182: and uses built-in information on how to generate an object from a source file
183: (\fIi.e.,\fR issue a ``cc\ \-c'' command).
184: .PP
185: The following long-winded description file is equivalent to the one above, but
186: takes no advantage of
187: .IT make 's
188: innate knowledge:
189: .DS
190: prog : x.o y.o z.o
191: cc x.o y.o z.o \-lS \-o prog
192: .sp .3
193: x.o : x.c defs
194: cc \-c x.c
195: y.o : y.c defs
196: cc \-c y.c
197: z.o : z.c
198: cc \-c z.c
199: .DE
200: .PP
201: If none of the source or object files had changed since the last time
202: .IT prog
203: was made, all of the files would be current, and
204: the command
205: .DS
206: make
207: .DE
208: would just announce this fact and stop.
209: If, however, the
210: .IT defs
211: file had been edited,
212: .IT x.c
213: and
214: .IT y.c
215: (but not
216: .IT z.c )
217: would be recompiled, and then
218: .IT prog
219: would be created from the new ``\fI.o\fR'' files.
220: If only the file
221: .IT y.c
222: had changed, only it would be recompiled, but it would still be necessary to reload
223: .IT prog .
224: .PP
225: If no target name is given on the
226: .IT make
227: command line, the first target mentioned in the description is created;
228: otherwise the specified targets are made.
229: The command
230: .DS
231: make x.o
232: .DE
233: would recompile
234: .IT x.o
235: if
236: .IT x.c
237: or
238: .IT defs
239: had changed.
240: .PP
241: If the file exists after the commands are executed,
242: its time of last modification is used in further decisions;
243: otherwise the current time is used.
244: It is often quite useful to include rules with mnemonic names and commands that do not
245: actually produce a file with that name.
246: These entries can take advantage of
247: .IT make 's
248: ability to generate files and substitute macros.
249: Thus, an entry
250: ``save''
251: might be included to copy a certain set of files, or an entry
252: ``cleanup''
253: might be used to throw away unneeded intermediate files.
254: In other cases one may maintain a zero-length file purely to keep track
255: of the time at which certain actions were performed.
256: This technique is useful for maintaining remote archives and listings.
257: .PP
258: .IT Make
259: has a simple macro mechanism for substituting in dependency lines and command strings.
260: Macros are defined by command arguments or description file lines with embedded equal signs.
261: A macro is invoked by preceding the name by a dollar sign;
262: macro names longer than one character must be parenthesized.
263: The name of the macro is either the single character after the dollar sign or a name inside parentheses.
264: The following are valid macro invocations:
265: .DS
266: $(CFLAGS)
267: $2
268: $(xy)
269: $Z
270: $(Z)
271: .DE
272: The last two invocations are identical.
273: $$ is a dollar sign.
274: All of these macros are assigned values during input, as shown below.
275: Four special macros change values during the execution of the command:
276: $\(**, $@, $?, and $<.
277: They will be discussed later.
278: The following fragment shows the use:
279: .DS
280: OBJECTS = x.o y.o z.o
281: LIBES = \-lS
282: prog: $(OBJECTS)
283: cc $(OBJECTS) $(LIBES) \-o prog
284: . . .
285: .DE
286: The command
287: .DS
288: make
289: .DE
290: loads the three object files with the
291: .IT lS
292: library. The command
293: .DS
294: make "LIBES= \-ll \-lS"
295: .DE
296: loads them with both the Lex (``\-ll'') and the Standard (``\-lS'') libraries,
297: since macro definitions on the command line override definitions in the description.
298: (It is necessary to quote arguments with embedded blanks in
299: .UX
300: commands.)
301: .PP
302: The following sections detail the form of description files and the command line,
303: and discuss options and built-in rules in more detail.
304: .SH
305: Description Files and Substitutions
306: .PP
307: A description file contains three types of information:
308: macro definitions,
309: dependency information,
310: and executable commands.
311: There is also a comment convention:
312: all characters after a sharp (#) are ignored, as is the sharp itself.
313: Blank lines and lines beginning with a sharp are totally ignored.
314: If a non-comment line is too long, it can be continued using a backslash.
315: If the last character of a line is a backslash, the backslash, newline,
316: and following blanks and tabs are replaced by a single blank.
317: .PP
318: A macro definition is a line containing an equal sign not preceded by a colon or a tab.
319: The name (string of letters and digits) to the left of the equal sign
320: (trailing blanks and tabs are stripped) is assigned the string of characters following the equal sign
321: (leading blanks and tabs are stripped.)
322: The following are valid macro definitions:
323: .DS
324: 2 = xyz
325: abc = \-ll \-ly \-lS
326: LIBES =
327: .DE
328: The last definition assigns LIBES the null string.
329: A macro that is never explicitly defined has the null string as value.
330: Macro definitions may also appear on the
331: .IT make
332: command line (see below).
333: .PP
334: Other lines give information about target files.
335: The general form of an entry is:
336: .DS
337: target1 [target2 . . .] :[:] [dependent1 . . .] [; commands] [# . . .]
338: [\fI(tab)\fR commands] [# . . .]
339: . . .
340: .DE
341: Items inside brackets may be omitted.
342: Targets and dependents are strings of letters, digits, periods, and slashes.
343: (Shell metacharacters ``\(**'' and ``?'' are expanded.)
344: A command is any string of characters not including a sharp (except in quotes)
345: or newline.
346: Commands may appear either after a semicolon on a dependency line
347: or on lines beginning with a tab immediately following a dependency line.
348: .PP
349: A dependency line may have either a single or a double colon.
350: A target name may appear on more than one dependency line, but all of those lines must be of the
351: same (single or double colon) type.
352: .IP 1.
353: For the usual single-colon case,
354: at most one of these dependency lines may have a command sequence associated with it.
355: If the target is out of date with any of the dependents on any of the lines,
356: and a command sequence is specified (even a null one following a semicolon or tab),
357: it is executed; otherwise a default creation rule may be invoked.
358: .IP 2.
359: In the double-colon case, a command sequence may be associated with each dependency line;
360: if the target is out of date with any of the files on a particular line, the associated
361: commands are executed.
362: A built-in rule may also be executed.
363: This detailed form is of particular value in updating archive-type files.
364: .PP
365: If a target must be created, the sequence of commands is executed.
366: Normally, each command line is printed and then
367: passed to a separate invocation of the Shell after substituting for macros.
368: (The printing is suppressed in silent mode or if the command line begins with an @ sign).
369: .IT Make
370: normally stops if any command signals an error by returning a non-zero error code.
371: (Errors are ignored if the ``\-i'' flags has been specified on the
372: .IT make
373: command line,
374: if the fake target name ``.IGNORE'' appears in the description file,
375: or if the command string in the description file begins with a hyphen.
376: Some
377: .UX
378: commands return meaningless status).
379: Because each command line is passed to a separate invocation of the Shell,
380: care must be taken with certain commands (e.g., \fIcd\fR and Shell control commands) that have meaning only
381: within a single Shell process;
382: the results are forgotten before the next line is executed.
383: .PP
384: Before issuing any command, certain macros are set.
385: $@ is set to the name of the file to be ``made''.
386: $? is set to the string of names that were found to be younger than the target.
387: If the command was generated by an implicit rule (see below),
388: $< is the name of the related file that caused the action, and
389: $\(** is the prefix shared by the current and the dependent file names.
390: .PP
391: If a file must be made but there are no explicit commands or relevant
392: built-in rules,
393: the commands associated with the name ``.DEFAULT'' are used.
394: If there is no such name,
395: .IT make
396: prints a message and stops.
397: .SH
398: Command Usage
399: .PP
400: The
401: .IT make
402: command takes four kinds of arguments:
403: macro definitions, flags, description file names, and target file names.
404: .DS
405: make [ flags ] [ macro definitions ] [ targets ]
406: .DE
407: The following summary of the operation of the command explains how these arguments are interpreted.
408: .PP
409: First, all macro definition arguments (arguments with embedded equal signs) are analyzed
410: and the assignments made.
411: Command-line macros override corresponding definitions found in the description files.
412: .PP
413: Next, the flag arguments are examined.
414: The permissible flags are
415: .IP \-i
416: Ignore error codes returned by invoked commands.
417: This mode is entered if the fake target name ``.IGNORE'' appears in the description file.
418: .IP \-s
419: Silent mode. Do not print command lines before executing.
420: This mode is also entered if the fake target name ``.SILENT'' appears in the description file.
421: .IP \-r
422: Do not use the built-in rules.
423: .IP \-n
424: No execute mode. Print commands, but do not execute them.
425: Even lines beginning with an ``@'' sign are printed.
426: .IP \-t
427: Touch the target files (causing them to be up to date) rather than issue the usual commands.
428: .IP \-q
429: Question.
430: The
431: .IT make
432: command returns a zero or non-zero status code depending on whether the target file
433: is or is not up to date.
434: .IP \-p
435: Print out the complete set of macro definitions and target descriptions
436: .IP \-d
437: Debug mode. Print out detailed information on files and times examined.
438: .IP \-f
439: Description file name. The next argument is assumed to be the name of a description file.
440: A file name of ``\-'' denotes the standard input.
441: If there are no ``\-f\|'' arguments, the file named
442: .IT makefile
443: or
444: .IT Makefile
445: in the current directory is read.
446: The contents of the description files override the built-in rules if they are present).
447: .PP
448: Finally, the remaining arguments are assumed to be the names of targets to be made;
449: they are done in left to right order.
450: If there are no such arguments, the first name in the description files that does not
451: begin with a period is ``made''.
452: .SH
453: Implicit Rules
454: .PP
455: The
456: .ul
457: make
458: program uses a table of interesting suffixes and a set
459: of transformation rules to supply default dependency
460: information and implied commands.
461: (The Appendix describes these tables and means of overriding
462: them.)
463: The default suffix list is:
464: .KS
465: .sp
466: .nf
467: .ta 0.5i 1.5i
468: \fI.o\fR Object file
469: \fI.c\fR C source file
470: \fI.e\fR Efl source file
471: \fI.r\fR Ratfor source file
472: \fI.f\fR Fortran source file
473: \fI.s\fR Assembler source file
474: \fI.y\fR Yacc-C source grammar
475: \fI.yr\fR Yacc-Ratfor source grammar
476: \fI.ye\fR Yacc-Efl source grammar
477: \fI.l\fR Lex source grammar
478: .fi
479: .sp
480: .KE
481: The following diagram summarizes the default transformation paths.
482: If there are two paths connecting a pair of suffixes, the longer
483: one is used only if the intermediate file exists or is
484: named in the description.
485: .KS
486: .sp
487: .ft I
488: .ta 2i
489: .o
490: .sp 2
491: .ta 0.75i 1.25i 1.6i 2.1i
492: .c .r .e .f .s .y .yr .ye .l .d
493: .sp 2
494: .ta 0.6i 1.25i 1.6i
495: .y .l .yr .ye
496: .ft R
497: .sp
498: .KE
499: .PP
500: If the file
501: .ul
502: x.o
503: were needed and there were an
504: .ul
505: x.c
506: in the description or directory, it would be compiled.
507: If there were also an
508: .IT x.l ,
509: that grammar would be run through Lex before compiling the result.
510: However, if there were no
511: .ul
512: x.c
513: but there were an
514: .IT x.l ,
515: .IT make
516: would discard the intermediate C-language file and use the
517: direct link in the graph above.
518: .PP
519: It is possible to change the names of some of the compilers used in the
520: default, or the flag arguments with which they are invoked by knowing
521: the macro names used.
522: The compiler names are the macros AS, CC, RC, EC, YACC, YACCR, YACCE, and LEX.
523: The command
524: .DS
525: make CC=newcc
526: .DE
527: will cause the ``newcc'' command to be used instead of the
528: usual C compiler.
529: The macros CFLAGS, RFLAGS, EFLAGS, YFLAGS, and LFLAGS may be set to
530: cause these commands to be issued with optional flags.
531: Thus,
532: .DS
533: make "CFLAGS=\|\(miO"
534: .DE
535: causes the optimizing C compiler to be used.
536: .PP
537: Another special macro is `VPATH'.
538: The ``VPATH'' macro should be set to a list of directories separated by colons.
539: When
540: .I make
541: searches for a file as a result of a dependency relation, it will
542: first search the current directory and then each of the directories on the
543: ``VPATH'' list.
544: If the file is found, the actual path to the file will be used, rather than
545: just the filename.
546: If ``VPATH'' is not defined, then only the current directory is searched.
547: Note that ``VPATH'' is intended to act like the System V ``VPATH'' support,
548: but there is no guarantee that it functions identically.
549: .PP
550: One use for ``VPATH'' is when one has several programs that compile from the
551: same source.
552: The source can be kept in one directory and each set of
553: object files (along with a separate
554: .IR makefile )
555: would be in a separate subdirectory.
556: The ``VPATH'' macro would point to the source directory in this case.
557: .SH
558: Example
559: .PP
560: As an example of the use of
561: .ul
562: make,
563: we will present the description file used to maintain
564: the
565: .ul
566: make
567: command itself.
568: The code for
569: .ul
570: make
571: is spread over a number of C source files and a Yacc grammar.
572: The description file contains:
573: .DS
574: # Description file for the Make command
575: .sp .3
576: P = und \-3 | opr \-r2 # send to GCOS to be printed
577: FILES = Makefile version.c defs main.c doname.c misc.c files.c dosys.c\
578: gram.y lex.c gcos.c
579: OBJECTS = version.o main.o doname.o misc.o files.o dosys.o gram.o
580: LIBES= \-lS
581: LINT = lint \-p
582: CFLAGS = \-O
583: .sp .3
584: make: $(OBJECTS)
585: cc $(CFLAGS) $(OBJECTS) $(LIBES) \-o make
586: size make
587: .sp .3
588: $(OBJECTS): defs
589: gram.o: lex.c
590: .sp .3
591: cleanup:
592: -rm *.o gram.c
593: -du
594: .sp .3
595: install:
596: @size make /usr/bin/make
597: cp make /usr/bin/make ; rm make
598: .sp .3
599: print: $(FILES) # print recently changed files
600: pr $? | $P
601: touch print
602: .sp .3
603: test:
604: make \-dp | grep \-v TIME >1zap
605: /usr/bin/make \-dp | grep \-v TIME >2zap
606: diff 1zap 2zap
607: rm 1zap 2zap
608: .sp .3
609: lint : dosys.c doname.c files.c main.c misc.c version.c gram.c
610: $(LINT) dosys.c doname.c files.c main.c misc.c version.c gram.c
611: rm gram.c
612: .sp .3
613: arch:
614: ar uv /sys/source/s2/make.a $(FILES)
615: .DE
616: .IT Make
617: usually prints out each command before issuing it.
618: The following output results from typing the simple command
619: .DS
620: make
621: .DE
622: in a directory containing only the source and description file:
623: .DS
624: cc \-c version.c
625: cc \-c main.c
626: cc \-c doname.c
627: cc \-c misc.c
628: cc \-c files.c
629: cc \-c dosys.c
630: yacc gram.y
631: mv y.tab.c gram.c
632: cc \-c gram.c
633: cc version.o main.o doname.o misc.o files.o dosys.o gram.o \-lS \-o make
634: 13188+3348+3044 = 19580b = 046174b
635: .DE
636: Although none of the source files or grammars were mentioned
637: by name in the description file,
638: .IT make
639: found them using its suffix rules and issued the needed commands.
640: The string of digits results from the ``size make''
641: command; the printing of the command line itself was
642: suppressed by an @ sign.
643: The @ sign on the
644: .IT size
645: command in the description file suppressed the printing of the command,
646: so only the sizes are written.
647: .PP
648: The last few entries in the description file are useful maintenance sequences.
649: The ``print'' entry prints only the files that have been changed since the last
650: ``make print'' command.
651: A zero-length file
652: .IT print
653: is maintained to keep track of the time of the printing;
654: the $? macro in the command line then picks up only the names of the files
655: changed since
656: .IT print
657: was touched.
658: The printed output can be sent to a different printer or to a file by changing the definition of the
659: .IT P
660: macro:
661: .DS
662: make print "P = opr \-sp"
663: \fIor\fR
664: make print "P= cat >zap"
665: .DE
666: .SH
667: Suggestions and Warnings
668: .PP
669: The most common difficulties arise from
670: .IT make 's
671: specific meaning of dependency.
672: If file
673: .IT x.c
674: has a ``#include "defs"''
675: line, then the object file
676: .IT x.o
677: depends on
678: .IT defs ;
679: the source file
680: .IT x.c
681: does not.
682: (If
683: .IT defs
684: is changed, it is not necessary to do anything
685: to the file
686: .IT x.c ,
687: while it is necessary to recreate
688: .IT x.o .)
689: .PP
690: To discover what
691: .IT make
692: would do, the ``\-n'' option is very useful.
693: The command
694: .DS
695: make \-n
696: .DE
697: orders
698: .IT make
699: to print out the commands it would issue without actually taking the time to execute them.
700: If a change to a file is absolutely certain to be benign
701: (e.g., adding a new definition to an include file),
702: the ``\-t'' (touch) option
703: can save a lot of time:
704: instead of issuing a large number of superfluous recompilations,
705: .IT make
706: updates the modification times on the affected file.
707: Thus, the command
708: .DS
709: make \-ts
710: .DE
711: (``touch silently'') causes the relevant files to appear up to date.
712: Obvious care is necessary, since this mode of operation subverts
713: the intention of
714: .IT make
715: and destroys all memory of the previous relationships.
716: .PP
717: The debugging flag (``\-d'') causes
718: .IT make
719: to print out a very detailed description of what it is doing, including the
720: file times. The output is verbose, and recommended only as a last resort.
721: .SH
722: Acknowledgments
723: .PP
724: I would like to thank S. C. Johnson for suggesting this approach
725: to program maintenance control.
726: I would like to thank S. C. Johnson and H. Gajewska for being
727: the prime guinea pigs during development of
728: .IT make .
729: .SH
730: References
731: .IP 1.
732: S. C. Johnson,
733: ``Yacc \(em Yet Another Compiler-Compiler'',
734: Bell Laboratories
735: Computing Science Technical Report #32,
736: July 1978.
737: .IP 2.
738: M. E. Lesk,
739: ``Lex \(em A Lexical Analyzer Generator'',
740: Computing Science Technical Report #39,
741: October 1975.
742: .bp
743: .SH
744: Appendix. Suffixes and Transformation Rules
745: .PP
746: The
747: .ul
748: make
749: program itself does not know what file name suffixes are interesting
750: or how to transform a file with one suffix into a file with another
751: suffix.
752: This information is stored in an internal table that has the form of a description file.
753: If the ``\-r'' flag is used, this table is not used.
754: .PP
755: The list of suffixes is actually the dependency list for the name
756: ``.SUFFIXES'';
757: .ul
758: make
759: looks for a file with any of the suffixes on the list.
760: If such a file exists, and if there is a transformation
761: rule for that combination,
762: .ul
763: make
764: acts as described earlier.
765: The transformation rule names are the concatenation of the
766: two suffixes.
767: The name of the rule to transform a ``\fI.r\fR'' file to a ``\fI.o\fR'' file
768: is thus ``\fI.r.o\fR''.
769: If the rule is present and no explicit command sequence
770: has been given in the user's description files, the command
771: sequence for the rule ``.r.o'' is used.
772: If a command is generated by using one of these suffixing rules,
773: the macro $\(** is given the value of the stem
774: (everything but the suffix) of the name of the file to be made,
775: and the macro $< is the name of the dependent that caused the action.
776: .PP
777: The order of the suffix list is significant, since it is scanned from
778: left to right, and the first name that is formed that has both a file
779: and a rule associated with it is used.
780: If new names are to be appended, the user can just add an entry for
781: ``.SUFFIXES'' in his own description file; the dependents will be added to the usual list.
782: A ``.SUFFIXES'' line without any dependents deletes the current list.
783: (It is necessary to clear the current list if the order of names is to be changed).
784: .PP
785: The following is an excerpt from the default rules file:
786: .DS
787: .ta .5i 1i
788: .SUFFIXES : .o .c .e .r .f .y .yr .ye .l .s
789: YACC=yacc
790: YACCR=yacc \-r
791: YACCE=yacc \-e
792: YFLAGS=
793: LEX=lex
794: LFLAGS=
795: CC=cc
796: AS=as \-
797: CFLAGS=
798: RC=ec
799: RFLAGS=
800: EC=ec
801: EFLAGS=
802: FFLAGS=
803: .c.o :
804: $(CC) $(CFLAGS) \-c $<
805: .e.o .r.o .f.o :
806: $(EC) $(RFLAGS) $(EFLAGS) $(FFLAGS) \-c $<
807: .s.o :
808: $(AS) \-o $@ $<
809: .y.o :
810: $(YACC) $(YFLAGS) $<
811: $(CC) $(CFLAGS) \-c y.tab.c
812: rm y.tab.c
813: mv y.tab.o $@
814: .y.c :
815: $(YACC) $(YFLAGS) $<
816: mv y.tab.c $@
817: .DE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.