make - " " /P 2.1 make 1988 make, , . 1. make [1], , . , - (), make . - , . - , . - : , - , , , .. Make-, - . shell. - Make- make - shell , . , make , . , Make- , - . - , make, , :  -> make ->  ->  - ,  , - make "" , " , ". , make - . , cat : - /bin/cat - ./src/cmd/cat/cat.c - ./man/man1/cat.1 - ./src/cmd/cat/Makefile ./src/cmd/cat/Makefile cat - . make ( 200 ) - 3 - . 2. Make- make , Make-. Make- , . - . , a b c d e f E. , - , A, B, C D. - , - . - , - , . Make- (x,y) , - x. x - , , - , y () , x. t(x,y). t(x,y) /\ E / \ | /----\ | || t(E,D ) | t(E,C) || ----------------------- || | | || D C || t(D,A) | t(D,B) | || ---------------- | || | | | || A B | || | | t(C,e)| || t(A,a)| t(A,b) t(B,c)| t(B,d) t(C,d)| || ------------ ------------ ------- || | | | | | | || | | | | | | || a b c d e f || - 4 - x y - ; x y - . t(x,y) - ( ) . make Make- , . , - . Make-e , . . . - E - , D C - E. D - , A B - D. , A - , a b - A. - .  -. - "" , , , , - "" - , , - ( ). Make-, - . : E : D C # E D C cat D C > E # 1 D : A B # D A B cat A B > D # 2 A : a b # A a, b cat a b > A # 3 B : c d # B c, d cat c d > B # 4 C : e f # C e, f cat e f > C # 5 clean clear: -rm -f A B C D E 6 . . : , - 5 - (), , - , (), .  . : . - shell. Make- - ( 8 ) - - . , # , . - . Make- Makefile, Make- . , Make- Makefile, a, b, c d. A, B, C D , make -  A, B, C D. - Make-, , .. make. Make-: E : D C cat D C > E D C , E "", D C, make - -  . - D / C, D / C, . , E, - make - E. , D / C, D / C , , make - - E. Make-: D : A B cat A B > D A, B D - , Make- ( D ). A / B, A / C, . , - D, - Make-. , A / B, A / B , - 6 - , Make-. Make-: A : a b cat a b > A a b . - . A, , . . Make-: B : c d cat c d > B , - . Make-: C : e f cat e f > C e f . - . C, , . . make . , , D, % make D C D, % make C D , - Make-. , make Make- . , - Make-. - 7 - , make. - , / . - Make- ( ). - . , (clean clear), , : % make clean % make clear A, B, C, D E. shell : sh -c _ sh ( - 0), ( ) make . . 6- : "-", - rm. Make- . Make- shell, . . Makefile : - 8 - SRC1 = a b # SRC2 = c d SRC3 = e f SRC4 = A B C D E : D C cat D C > E D : A B cat A B > D A : $(SRC1) # A SRC1 cat $(SRC1) > A B : $(SRC2) # B SRC2 cat $(SRC2) > B C : $(SRC3) # C SRC3 cat $(SRC3) > C clean clear: -rm -f $(SRC4) Make- - , SRC . , $(SRC1). Make-. make - . , .o .c ( ) .s ( ). . , a.c, b.c, c.c d.s, , pro- gram. a.c, b.c c.c # include program.h .. program.h. Make- 3 program: a.o b.o c.o d.o cc a.o b.o c.o d.o -o program a.o b.o c.o: program.h make program. : - 9 - cc -c a.c cc -c b.c cc -c c.c as - -o d.o d.s cc a.o b.o c.o d.o -o program , - .c .s, Make- , . , , make e program.h, : cc -c a.c cc -c b.c cc -c c.c cc a.o b.o c.o d.o -o program Make- b.c, : cc -c b.c cc a.o b.o c.o d.o -o program , , , c.o, make c.o Make-; . 3. Make - Make. .  , "_", ([...], ?, *), / "."  =  . , . $() ${} $ - 10 - . - $ , $$.  , # . - # , .   . - \ , .  ,  , . . _ _ . _ - . ._._: _ . Make- - , , - : .SUFFIXES: _ _ :[:] _ _. _ - . _ _ _. _ [_] _. _ - . - / . _ , - . _ , , _ ( , Make-). _ [_] [#] _. _ - . - 11 - "*", "?", [...], - / . _ , Make- , - . _ , , _ ( , Make- ). _ [#] ............... _ [#] _. - Shell. ''__shell _. _ - ";". _ : ''____shell 1 ''@___shell 2 ''-___shell 3 ''-@__shell 4 ; 0, make - . - ; 0, make . ; 0, make . ; - 0, make . ( ) . sh : sh -c __shell - . - 12 - _ : @ ; ? , _. . _ : * __; @ __._; <&lt; __._. 4. Make- / make . , - , Make-. : @, - _; - ?, - _, - _. "@" "?" . Make-, . - make - Make-. - , ; - , - Make-. - Make- , - Make- - , . - , . , A = $B B = $A Make-. - shell. , - 13 - : -rw-r--r-- 1 user 15658 6 16:03 1.m -rw-r--r-- 1 user 2158 8 16:38 2.m -rw-r--r-- 1 user 5185 9 17:38 3.m -rw-r--r-- 1 user 4068 28 20:56 6.m -rw-r--r-- 1 user 100 9 14:30 f2 -rw-r--r-- 1 user 66 9 17:42 f3 Make- Makefile : A = * B = f? C = [0-9].* aaa : echo $A echo $B echo $C make -s : 1.m 2.m 3.m 6.m f2 f3 f2 f3 1.m 2.m 3.m 6.m Make- - . - . : A = * B = [pg]* C = f?r* DIR1 = . DIR2 = /etc DIR3 = /usr/bin aaa : echo ${DIR1}/$A echo ${DIR2}/$B echo ${DIR3}/$C : ./1.m ./2.m ./3.m ./6.m ./f2 ./f3 /etc/getty /etc/group /etc/passwd /usr/bin/fgrep , - . , Makefile - 14 - = ${} = = = , . = = = , . = $() $() = , , . t = . x = . = d e : ${} echo ' ' $@ echo '$$? - :' $? echo '$$@ - :' $@ echo ' : ' $() echo '. : ' $() echo ' ' ${} : b c echo ' ' $@ echo '$$? - :' $? echo '$$@ - :' $@ echo ' ' ${}: ${} echo ' ' $@ echo '$$? - :' $? echo '$$@ - :' $@ echo ' : ' ${} echo $t echo $x echo ' ' b: c: d: e: , $ , , $() ${} - . b, c, d e "?". , make -s, : - 15 - $? - : b c $@ - : $? - : d e $@ - : : , . . . $? - : $@ - : :, . . : , , . . make -s = , . : $? - : b c $@ - : $? - : d e $@ - : : , . . . $? - : $@ - : : , . . : , , . 5. Make- : ; ; ; - 16 - / ; , make, - Make-. , Make-, . . , - . : - , - . , , (- ) . , , . , Make- monitor.c : monitor.h , monitor.c monitor.h. monitor.h , monitor.o, monitor.h , make . Make- , , , . , . _ : , , _ . : __ : _ <---| 1 | __ : _ <---| 2 | _ <---| 4 | __ : _ <---| 3 | _ . : - 17 - __ :: _ <---| 1 | _ <---| 2 | __ :: _ <---| 3 | _ <---| 4 | __ :: _ <---| 5 | _ <---| 6 | 6. Make- make Make-. - : .SILENT - ; .IGNORE - ; .DEFAULT - ; .PRECIOUS - . .SILENT .IGNORE Make- , -s -i, DEFAULT PRECIOUS Make-. - Make-: aa: bb echo $@ bb: echo $@ ppp # sort e # e : echo bb bb ppp # sh: ppp: *** 1 . make . , . : -s make; Make- SILENT; - 18 - @. - . - ''@_ SILENT. aa: bb echo $@ bb: echo $@ ppp # sort e # e .SILENT: : bb sh: ppp: *** 1 . make . - (Make- ): -i make ; Make- IGNORE; "-". , , : ''-_ SILENT IGNORE. - 19 - aa: bb echo $@ bb: echo $@ ppp # sort e # e .SILENT: .IGNORE: : bb sh: ppp: *** 1 () sort: e *** 1 () aa DEFAULT . DEFAULT , , , : - 20 - aa: bb echo $@ bb: a b c d echo $@ ppp # sort e # e .SILENT: .IGNORE: .DEFAULT: echo .DEFAULT $@ : .DEFAULT a .DEFAULT b .DEFAULT c .DEFAULT d bb sh: ppp: *** 1 () sort: e *** 1 () aa Make- . , ( - ) . , , . , PRECIOUS, - : aaa: file sort file > $@ .PRECIOUS: Make- CTRL/C, $@ . 7. Make- - . - , Make-, . make . - 21 - . , ._1  ._2, - : ._2 : ._1   , , - , , . , *.c *.o , , , . make - ._1._2: _ .SUFFIXES: ._1 ._2 Make- , , ._1, , - ._2. - , - . SUFFIXES , . . , Make- . : @ - _a (._2); <&lt; - _a (._1); * - . . , *.c *.k. *.t, - result. , *.c file.h ( #include file.h). - : - 22 - result | .t | -------- | | .c .k , , : - 23 - result: d.t a.t b.t c.t echo ' ' $@ echo ' $$@ - ' $@ echo ' $$? - ' $? touch $@ .k.t : echo ' .k.t :' echo ' $$* - ' $* echo ' $$@ - ' $@ echo ' $$? - ' $? echo ' $$< - ' $< touch $@ .c.t : echo ' .c.t :' echo ' $$* - ' $* echo ' $$@ - ' $@ echo ' $$? - ' $? echo ' $$< - ' $< touch $@ a.c b.c c.c : file.h .SUFFIXES: .t .c .k make -rs : .k.t : $* - d $@ - d.t $? - d.k $< - d.k .c.t :