Intel XENIX 286 Programmers Guide (86) - Tenox.tc
Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc
XENIX Programming make: Program Maintainer If a change to a file is absolutely certain to be benign (e.g., adding a new definition to an include file), the -t (touch) option can save a lot of time: instead of issuing a large nu mber of superfluous recompilations, make updates the modification times on the affected file. Thus, the command make -ts which stands for touch silently, causes the relevant files to appear up to date. The debugging option -d causes make to print out a very detailed description of what it is doing, including the file times. The output is verbose and is recommended only as a last resort. Using make: An Example As an example of the use of make, examine the makefile used to maintain the make program itself. The code for make is spread over a number of C source files and a yacc grammar. #Description fi le for the make command # Macro definiti ons below P = lpr FILES = Makefile vers.c defs main.c doname.c misc.c files.c dosys.c\ gram.y lex.c OBJECTS = vers.o main.o ... dosys.o gram.o LIBES = LINT = lint -p CFLAGS = -0 #targets: dependents ##ITAB > actions make: ${OBJECTS) cc $(CFLAGS) $(OBJECTS) $(LIBES) -o make size make ${OBJECTS): defs gram.o: lex.c cleanup: -rm *.o gram.c -du install: @size make /usr/bin/make cp make /usr/bin/make ; rm make 4-13
make: Program Maintainer print: $(FILES) # print recently changed files pr $? I $P touch print test: make -dp I grep -v TIME > 1 zap /usr/bin/make -dp I grep -v TIME >2zap diff 1 zap 2zap rm 1 zap 2zap lint : dosys.c doname.c fi les.c main.c misc.c vers.c gram.c $(LINT) dosys.c doname.c fi les.c main.c misc.c vers .. c gram.c rm gram.c arch: ar uv /sys/source/s2/make.a $(FILES) XENIX Programming make usually prints out each command before issuing it. The following output results from typing the simple command make in a directory containing only the make source and makefile: cc -c vers.c cc -c main.c cc -c doname.c cc -c misc.c cc -c files.c cc -c dosys.c yacc gram.y mv y.tab.c gram.c cc -c gram.c cc vers.o main.o ... dosys.o gram.o -o make 13188+3348 + 3044 = 19580b = 0461 74b Although none of the source files or grammars was mentioned by name in the makefile, make found them by using its suffix rules and issued the needed commands. The string of digits results from the size make command. The last few targets in the makefile are useful maintenance sequences. The print target prints only the files that have been changed since the last make print command. A zerolength file print is maintained to keep track of the time of the printing; the $? macro in the command line then picks up only the names of the files changed since print was touched. The printed output can be sent to a different printer or to a file by changing the definition of the P macro. 4-14
- Page 13 and 14: Table of Contents TABLES TABLE TITL
- Page 15 and 16: Introduction XENIX Programming 10.
- Page 17 and 18: cc: C Compiler XENIX Programming Cr
- Page 19 and 20: cc: C Compiler XENIX Programming Th
- Page 21 and 22: cc: C Compiler XENIX Programming Th
- Page 23 and 24: cc: C Compiler XENIX Programming Cr
- Page 25 and 26: cc: C Compiler XENIX Programming Th
- Page 27 and 28: cc: C Compiler XENIX Programming Co
- Page 29 and 30: cc: C Compiler XENIX Programming Sa
- Page 31 and 32: cc: C Compiler XENIX Programming Us
- Page 33 and 34: cc: C Compiler XENIX Programming Wh
- Page 35 and 36: cc: C Compiler XENIX Programming Co
- Page 37 and 38: cc: C Compiler XENIX Programming d
- Page 39 and 40: cc: C Compiler XENIX Programming Se
- Page 41 and 42: lint: C Program Checker XENIX Progr
- Page 43 and 44: lint: C Program Checker XENIX Progr
- Page 45 and 46: lint: C Program Checker XENIX Progr
- Page 47 and 48: lint: C Program Checker XENIX Progr
- Page 49 and 50: lint: C Program Checker XENIX Progr
- Page 51 and 52: lint: C Program Checker XENIX Progr
- Page 53 and 54: make: Program Maintainer XENIX Prog
- Page 55 and 56: make: Program Maintainer XENIX Prog
- Page 57 and 58: make: Program Maintainer XENIX Prog
- Page 59 and 60: make: Program Maintainer XENIX Prog
- Page 61 and 62: make: Program Maintainer XENIX Prog
- Page 63: make: Program Maintainer XENIX Prog
- Page 67 and 68: SCCS: Source Code Control System XE
- Page 69 and 70: SCCS: Source Code Control System XE
- Page 71 and 72: SCCS: Source Code Control System XE
- Page 73 and 74: SCCS: Source Code Control System XE
- Page 75 and 76: SCCS: Source Code Control System XE
- Page 77 and 78: SCCS: Source Code Control System XE
- Page 79 and 80: SCCS: Source Code Control System XE
- Page 81 and 82: SCCS: Source Code Control System XE
- Page 83 and 84: SCCS: Source Code Control System XE
- Page 85 and 86: SCCS: Source Code Control System XE
- Page 87 and 88: SCCS: Source Code Control System XE
- Page 89 and 90: SCCS: Source Code Control System XE
- Page 91 and 92: SCCS: Source Code Control System XE
- Page 93 and 94: SCCS: Source Code Control System XE
- Page 95 and 96: SCCS: Source Code Control System XE
- Page 98 and 99: CHAPTER 6 adb: PROGRAM DEBUGGER adb
- Page 100 and 101: XENIX Programming adb: Program Debu
- Page 102 and 103: XENIX Programming adb: Program Debu
- Page 104 and 105: XENIX Programming adb: Program Debu
- Page 106 and 107: XENIX Programming adb: Program Debu
- Page 108 and 109: XENIX Programming adb: Program Debu
- Page 110 and 111: XENIX Programming adb: Program Debu
- Page 112 and 113: XENIX Programming adb: Program Debu
make: Program Maintainer<br />
print: $(FILES) # print recently changed files<br />
pr $? I $P<br />
touch print<br />
test:<br />
make -dp I grep -v TIME > 1 zap<br />
/usr/bin/make -dp I grep -v TIME >2zap<br />
diff 1 zap 2zap<br />
rm 1 zap 2zap<br />
lint : dosys.c doname.c fi les.c main.c misc.c vers.c gram.c<br />
$(LINT) dosys.c doname.c fi les.c main.c misc.c vers .. c gram.c<br />
rm gram.c<br />
arch:<br />
ar uv /sys/source/s2/make.a $(FILES)<br />
<strong>XENIX</strong> Programming<br />
make usually prints out each command before issuing it. The following output results<br />
from typing the simple command<br />
make<br />
in a directory containing only the make source and makefile:<br />
cc -c vers.c<br />
cc -c main.c<br />
cc -c doname.c<br />
cc -c misc.c<br />
cc -c files.c<br />
cc -c dosys.c<br />
yacc gram.y<br />
mv y.tab.c gram.c<br />
cc -c gram.c<br />
cc vers.o main.o ... dosys.o gram.o -o make<br />
13188+3348 + 3044 = 19580b = 0461 74b<br />
Although none of the source files or grammars was mentioned by name in the makefile,<br />
make found them by using its suffix rules and issued the needed commands. The string<br />
of digits results from the size make command.<br />
The last few targets in the makefile are useful maintenance sequences. The print target<br />
prints only the files that have been changed since the last make print command. A zerolength<br />
file print is maintained to keep track of the time of the printing; the $? macro in<br />
the command line then picks up only the names of the files changed since print was<br />
touched. The printed output can be sent to a different printer or to a file by changing<br />
the definition of the P macro.<br />
4-14