%!PS %%Version: 3.3.2 %%DocumentFonts: (atend) %%Pages: (atend) %%EndComments % % Version 3.3.2 prologue for troff files. % /#copies 1 store /aspectratio 1 def /formsperpage 1 def /landscape false def /linewidth .3 def /magnification 1 def /margin 0 def /orientation 0 def /resolution 720 def /rotation 1 def /xoffset 0 def /yoffset 0 def /roundpage true def /useclippath true def /pagebbox [0 0 612 792] def /R /Times-Roman def /I /Times-Italic def /B /Times-Bold def /BI /Times-BoldItalic def /H /Helvetica def /HI /Helvetica-Oblique def /HB /Helvetica-Bold def /HX /Helvetica-BoldOblique def /CW /Courier def /CO /Courier def /CI /Courier-Oblique def /CB /Courier-Bold def /CX /Courier-BoldOblique def /PA /Palatino-Roman def /PI /Palatino-Italic def /PB /Palatino-Bold def /PX /Palatino-BoldItalic def /Hr /Helvetica-Narrow def /Hi /Helvetica-Narrow-Oblique def /Hb /Helvetica-Narrow-Bold def /Hx /Helvetica-Narrow-BoldOblique def /KR /Bookman-Light def /KI /Bookman-LightItalic def /KB /Bookman-Demi def /KX /Bookman-DemiItalic def /AR /AvantGarde-Book def /AI /AvantGarde-BookOblique def /AB /AvantGarde-Demi def /AX /AvantGarde-DemiOblique def /NR /NewCenturySchlbk-Roman def /NI /NewCenturySchlbk-Italic def /NB /NewCenturySchlbk-Bold def /NX /NewCenturySchlbk-BoldItalic def /ZD /ZapfDingbats def /ZI /ZapfChancery-MediumItalic def /S /S def /S1 /S1 def /GR /Symbol def /inch {72 mul} bind def /min {2 copy gt {exch} if pop} bind def /show {show} bind def % so later references don't bind /widthshow {widthshow} bind def /stringwidth {stringwidth} bind def /setup { counttomark 2 idiv {def} repeat pop landscape {/orientation 90 orientation add def} if /scaling 72 resolution div def linewidth setlinewidth 1 setlinecap pagedimensions xcenter ycenter translate orientation rotation mul rotate width 2 div neg height 2 div translate xoffset inch yoffset inch neg translate margin 2 div dup neg translate magnification dup aspectratio mul scale scaling scaling scale addmetrics 0 0 moveto } def /pagedimensions { useclippath userdict /gotpagebbox known not and { /pagebbox [clippath pathbbox newpath] def roundpage currentdict /roundpagebbox known and {roundpagebbox} if } if pagebbox aload pop 4 -1 roll exch 4 1 roll 4 copy landscape {4 2 roll} if sub /width exch def sub /height exch def add 2 div /xcenter exch def add 2 div /ycenter exch def userdict /gotpagebbox true put } def /addmetrics { /Symbol /S null Sdefs cf /Times-Roman /S1 StandardEncoding dup length array copy S1defs cf } def /pagesetup { /page exch def currentdict /pagedict known currentdict page known and { page load pagedict exch get cvx exec } if } def /decodingdefs [ {counttomark 2 idiv {y moveto show} repeat} {neg /y exch def counttomark 2 idiv {y moveto show} repeat} {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} {counttomark 2 idiv {y moveto show} repeat} {neg setfunnytext} ] def /setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def /w {neg moveto show} bind def /m {neg dup /y exch def moveto} bind def /done {/lastpage where {pop lastpage} if} def /f { dup /font exch def findfont exch dup /ptsize exch def scaling div dup /size exch def scalefont setfont linewidth ptsize mul scaling 10 mul div setlinewidth /spacewidth ( ) stringwidth pop def } bind def /changefont { /fontheight exch def /fontslant exch def currentfont [ 1 0 fontheight ptsize div fontslant sin mul fontslant cos div fontheight ptsize div 0 0 ] makefont setfont } bind def /sf {f} bind def /cf { dup length 2 idiv /entries exch def /chtab exch def /newencoding exch def /newfont exch def findfont dup length 1 add dict /newdict exch def {1 index /FID ne {newdict 3 1 roll put}{pop pop} ifelse} forall newencoding type /arraytype eq {newdict /Encoding newencoding put} if newdict /Metrics entries dict put newdict /Metrics get begin chtab aload pop 1 1 entries {pop def} for newfont newdict definefont pop end } bind def % % A few arrays used to adjust reference points and character widths in some % of the printer resident fonts. If square roots are too high try changing % the lines describing /radical and /radicalex to, % % /radical [0 -75 550 0] % /radicalex [-50 -75 500 0] % % Move braceleftbt a bit - default PostScript character is off a bit. % /Sdefs [ /bracketlefttp [201 500] /bracketleftbt [201 500] /bracketrighttp [-81 380] /bracketrightbt [-83 380] /braceleftbt [203 490] /bracketrightex [220 -125 500 0] /radical [0 0 550 0] /radicalex [-50 0 500 0] /parenleftex [-20 -170 0 0] /integral [100 -50 500 0] /infinity [10 -75 730 0] ] def /S1defs [ /underscore [0 80 500 0] /endash [7 90 650 0] ] def % % Tries to round clipping path dimensions, as stored in array pagebbox, so they % match one of the known sizes in the papersizes array. Lower left coordinates % are always set to 0. % /roundpagebbox { 7 dict begin /papersizes [8.5 inch 11 inch 14 inch 17 inch] def /mappapersize { /val exch def /slop .5 inch def /diff slop def /j 0 def 0 1 papersizes length 1 sub { /i exch def papersizes i get val sub abs dup diff le {/diff exch def /j i def} {pop} ifelse } for diff slop lt {papersizes j get} {val} ifelse } def pagebbox 0 0 put pagebbox 1 0 put pagebbox dup 2 get mappapersize 2 exch put pagebbox dup 3 get mappapersize 3 exch put end } bind def %%EndProlog %%BeginSetup mark /linewidth 0.5 def /#copies 1 store /landscape false def /resolution 720 def % % Encoding vector and redefinition of findfont for the ISO Latin1 standard. % The 18 characters missing from ROM based fonts on older printers are noted % below. % /ISOLatin1Encoding [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /minus /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space /exclamdown /cent /sterling /currency /yen /brokenbar % missing /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree % missing /plusminus % missing /twosuperior % missing /threesuperior % missing /acute /mu % missing /paragraph /periodcentered /cedilla /onesuperior % missing /ordmasculine /guillemotright /onequarter % missing /onehalf % missing /threequarters % missing /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth % missing /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply % missing /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute % missing /Thorn % missing /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth % missing /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide % missing /oslash /ugrave /uacute /ucircumflex /udieresis /yacute % missing /thorn % missing /ydieresis ] def /NewFontDirectory FontDirectory maxlength dict def % % Apparently no guarantee findfont is defined in systemdict so the obvious % % systemdict /findfont get exec % % can generate an error. So far the only exception is a VT600 (version 48.0). % userdict /@RealFindfont known not { userdict begin /@RealFindfont systemdict begin /findfont load end def end } if /findfont { dup NewFontDirectory exch known not { dup %dup systemdict /findfont get exec % not always in systemdict dup userdict /@RealFindfont get exec dup /Encoding get StandardEncoding eq { dup length dict begin {1 index /FID ne {def}{pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /DummyFontName exch definefont } if NewFontDirectory 3 1 roll put } if NewFontDirectory exch get } bind def setup 2 setdecoding %%EndSetup %%Page: 1 1 /saveobj save def mark 1 pagesetup 12 B f (Plan 9 Mkfiles)2 742 1 2509 1220 t 10 I f (R. Flandrena)1 533 1 2613 1480 t 10 B f (Introduction)720 2140 w 10 R f ( called)1 276(Every Plan 9 source directory contains a file,)7 1880 2 720 2296 t 10 CW f (mkfile)2914 2296 w 10 R f (, specifying the rules for building the exe\255)7 1766 1 3274 2296 t ( is the product of the directory.)6 1288(cutable or library that)3 892 2 720 2416 t 10 I f (Mk)2959 2416 w 10 R f (\(1\) interprets the rules in the file, calculates the)8 1954 1 3086 2416 t (dependencies and executes an)3 1217 1 720 2536 t 10 I f (rc)1970 2536 w 10 R f ( are supplied)2 528( necessary components)2 936( If)1 124(\(1\) script to construct the product.)5 1399 4 2053 2536 t ( first executed to build the)5 1116(by subtending or neighboring directories, the mkfiles in those directories are)10 3204 2 720 2656 t (components before the local construction proceeds.)5 2051 1 720 2776 t ( one of four types of product: a single executable, several exe\255)11 2548(Most application source directories produce)4 1772 2 720 2932 t ( for building each)3 710( generic mkfiles define the normal rules)6 1603( Four)1 241(cutables, a local library, or a system library.)7 1766 4 720 3052 t ( need only list the components and include the appropriate generic)10 2751( simplest mkfiles)2 702( The)1 214(type of product.)2 653 4 720 3172 t ( augment, modify or override)4 1185( complex mkfiles may supply additional rules to)7 1958( More)1 270(mkfile to do the work.)4 907 4 720 3292 t (the generic rules.)2 684 1 720 3412 t 10 B f (Using a Mkfile)2 628 1 720 3652 t 10 R f (To build a product, change to the directory containing its source and invoke)12 3074 1 720 3808 t 10 I f (mk)3823 3808 w 10 R f (with the appropriate target)3 1071 1 3969 3808 t ( mkfiles provide the following standard targets:)6 1898( All)1 178(as an argument.)2 629 3 720 3928 t 10 CW f (all)720 4108 w 10 R f ( If)1 125(Build a local version of the product or products for the current architecture.)12 3115 2 1590 4108 t ( program, the result is stored in file)7 1411(the product is a single)4 885 2 1590 4228 t 10 CW f ($O.out.)3912 4228 w 10 R f (If the direc\255)2 472 1 4358 4228 t (tory produces multiple executables, they are stored in the files named)10 3240 1 1590 4348 t 10 CW f ($O.)1590 4468 w 10 I f (progname)1770 4468 w 10 CW f (,)2175 4468 w 10 R f (where)2278 4468 w 10 I f (progname)2564 4468 w 10 R f ( product)1 347( A)1 139( name of each executable.)4 1100(is the)1 232 4 3012 4468 t ( built for a different architecture by prefacing the)8 2107(may be)1 309 2 1590 4588 t 10 CW f (mk)4050 4588 w 10 R f (command with)1 616 1 4214 4588 t 10 CW f (objtype=)1590 4708 w 10 I f (architecture)2070 4708 w 10 R f (, where)1 305 1 2558 4708 t 10 I f (architecture)2900 4708 w 10 R f ( target architec\255)2 647(is the name of the)4 758 2 3425 4708 t ( producing system libraries always operate directly on the)8 2539(ture. Directories)1 701 2 1590 4828 t (installed version of the library; in this case the target)9 2199 1 1590 4948 t 10 CW f (all)3825 4948 w 10 R f ( to the)2 270(is equivalent)1 519 2 4041 4948 t (target)1590 5068 w 10 CW f (install)1842 5068 w 10 R f (.)2262 5068 w 10 CW f (install)720 5188 w 10 R f (Build and install the product or products for the current architecture.)10 2731 1 1590 5188 t 10 CW f (installall)720 5308 w 10 R f (Build and install the product or products for all architectures.)9 2441 1 1590 5308 t 10 CW f (clean)720 5428 w 10 R f ( process.)1 358(Rid the directory and its subdirectories of the by\255products of the build)11 2882 2 1590 5428 t ( easily reproduced \(e.g., object files,)5 1479(Intermediate files that are)3 1043 2 1590 5548 t 10 CW f (yacc)4143 5548 w 10 R f (intermedi\255)4414 5548 w ( such)1 219( intermediates,)1 598( Complicated)1 571(ates, target executables\) are always removed.)5 1852 4 1590 5668 t (as local libraries, are usually preserved.)5 1576 1 1590 5788 t 10 CW f (nuke)720 5908 w 10 R f ( target)1 256( This)1 232(Remove all intermediates from the directory and any subdirectories.)8 2752 3 1590 5908 t (guarantees that a subsequent build is performed from scratch.)8 2453 1 1590 6028 t (If no target is specified on the)6 1216 1 720 6244 t 10 CW f (mk)1965 6244 w 10 R f (command line, the)2 749 1 2114 6244 t 10 CW f (all)2892 6244 w 10 R f ( a directory produc\255)3 804( In)1 138( default.)1 332(target is built by)3 665 4 3101 6244 t (ing multiple executables, there is no default target.)7 2022 1 720 6364 t ( be supplied by each generic mkfile or by the)9 1835(In addition to the five standard targets, additional targets may)9 2485 2 720 6520 t (directory's mkfile.)1 743 1 720 6640 t cleartomark showpage saveobj restore %%EndPage: 1 1 %%Page: 2 2 /saveobj save def mark 2 pagesetup 10 R f (\255 2 \255)2 166 1 2797 480 t 10 B f (Creating a Mkfile)2 760 1 720 840 t 10 R f ( Failing)1 340( to build a new mkfile is to copy and modify an existing mkfile of the same type.)17 3333(The easiest way)2 647 3 720 996 t ( mkfile)1 291(that, it is usually possible to create a new mkfile with minimal effort, since the appropriate generic)16 4029 2 720 1116 t ( and most common cases, the new mkfile need only)9 2073( the simplest)2 506( In)1 133(predefines the rules that do all the work.)7 1608 4 720 1236 t (set a couple of variables and include the appropriate architecture\255specific and generic mkfiles.)12 3753 1 720 1356 t ( containing commonly used rules for building a product:)8 2310(There are four generic mkfiles)4 1236 2 720 1632 t 10 CW f (mkone)4298 1632 w 10 R f (,)4598 1632 w 10 CW f (mkmany)4655 1632 w 10 R f (,)5015 1632 w 10 CW f (mklib)720 1752 w 10 R f (, and)1 208 1 1020 1752 t 10 CW f (mksyslib)1267 1752 w 10 R f ( object)1 282( rules perform such actions as compiling C source files, loading)10 2684(. These)1 327 3 1747 1752 t ( and installing executables in the)5 1382(files, archiving libraries,)2 1004 2 720 1872 t 10 CW f (bin)3146 1872 w 10 R f (directory of the appropriate architecture.)4 1674 1 3366 1872 t (The generic mkfiles are stored in directory)6 1755 1 720 1992 t 10 CW f (/sys/src/cmd.)2509 1992 w 10 R f (Mkfile)3323 1992 w 10 CW f (mkone)3629 1992 w 10 R f (builds a single executable,)3 1078 1 3962 1992 t 10 CW f (mkmany)720 2112 w 10 R f (builds several executables from the source in a single directory, and)10 2828 1 1117 2112 t 10 CW f (mklib)3982 2112 w 10 R f (and)4319 2112 w 10 CW f (mksyslib)4535 2112 w 10 R f (,)5015 2112 w ( are driven by the values)5 998( rules in the generic mkfiles)5 1137( The)1 210(maintain local and system libraries, respectively.)5 1975 4 720 2232 t ( are supplied by the gen\255)5 1009(of variables, some of which must be set by the product mkfile and some of which)15 3311 2 720 2352 t ( in the latter class include:)5 1046( Variables)1 432(eric mkfile.)1 460 3 720 2472 t 10 I f (Variable Default Meaning)2 1365 1 1840 2652 t 10 CW f (CFLAGS \255w)1 750 1 1830 2832 t 10 R f (C compiler flags)2 666 1 2850 2832 t 10 CW f (LDFLAGS)1770 2952 w 10 R f (Loader flags)1 501 1 2850 2952 t 10 CW f (YFLAGS \255d)1 750 1 1830 3072 t 10 R f (Yacc flags)1 423 1 2850 3072 t 10 CW f (AFLAGS)1830 3192 w 10 R f (Assembler flags)1 646 1 2850 3192 t ( may be empty)3 609( Any)1 228( set by the product mkfile and used by the generic mkfile.)11 2368(The following variables are)3 1115 4 720 3408 t (depending on the specific product being made.)6 1866 1 720 3528 t 10 CW f (TARG)1545 3708 w 10 R f (Name\(s\) of the executable\(s\) to be built)6 1585 1 2415 3708 t 10 CW f (LIB)1545 3828 w 10 R f (Library name\(s\))1 645 1 2415 3828 t 10 CW f (OFILES)1545 3948 w 10 R f (Object files used in build)4 1005 1 2415 3948 t 10 CW f (HFILES)1545 4068 w 10 R f (Common header files)2 860 1 2415 4068 t 10 CW f (YFILES Yacc)1 1110 1 1545 4188 t 10 R f (input files)1 403 1 2680 4188 t 10 CW f (BIN)1545 4308 w 10 R f (Directory where executables are installed)4 1650 1 2415 4308 t 10 B f (Mkfile Organization)1 875 1 720 4608 t 10 R f (All mkfiles share the following common structure:)6 2026 1 720 4764 t 9 CW f ( definitions)1 648( $stem.db)6 1998 1 1440 6828 t cleartomark showpage saveobj restore %%EndPage: 3 3 %%Page: 4 4 /saveobj save def mark 4 pagesetup 10 R f (\255 4 \255)2 166 1 2797 480 t 10 B f (Mkmany)720 840 w 10 R f (The)720 996 w 10 CW f (mkmany)912 996 w 10 R f ( differs from the)3 690( It)1 124( from the files in a directory.)6 1223(generic mkfile builds several executables)4 1694 4 1309 996 t (operation of)1 501 1 720 1116 t 10 CW f (mkone)1262 1116 w 10 R f (in three respects:)2 708 1 1603 1116 t 10 CW f (TARG)2352 1116 w 10 R f ( there is no default)4 803(specifies the names of all executables,)5 1604 2 2633 1116 t (command\255line target, and additional rules allow a single executable to be built or installed.)13 3626 1 720 1236 t (The)720 1392 w 10 CW f (TARG)910 1392 w 10 R f ( the)1 158( rules assume)2 558( The)1 215(variable specifies the names of all executables produced by the mkfile.)10 2924 4 1185 1392 t (name of each executable is also the name of the file containing its)12 2676 1 720 1512 t 10 CW f (main)3424 1512 w 10 R f (function.)3692 1512 w 10 CW f (OFILES)4103 1512 w 10 R f (specifies files)1 549 1 4491 1512 t ( the mkfile:)2 461( Consider)1 411(containing common subroutines loaded with all executables.)6 2417 3 720 1632 t 9 CW f (