MMaakkee aanndd MMaakkeeffiilleess _L_a_s_t _E_d_i_t _M_a_r_c_h _2_3_, _1_9_9_2 Reg Quinton Computing and Communications Services The University of Western Ontario London, Ontario N6A 5B7 Canada 11.. HHiissttoorryy//GGooaallss Make is one of the original Unix tools for Software Engi- neering. By S.I. Feldman of AT&T Bell Labs circa 1975. But there are public domain versions (eg. GNU) and versions for other systems (eg. Vax/VMS). Related tools are the language compilers (cc, f77, lex, yacc, etc.) and shell programming tools (eg. awk, sed, cp, rm, etc.). You need to know how to use these. Important adjuncts are lint (source code checking for obvi- ous errors) ctags (locate functions, etc. in source code) and mkdepend. These are nice, and good programmers use them. Important, and related tools, are the software revision sys- tems SCCS (Source Code Control System -- this is a licenced product) and RCS (Revision Control System -- this is public domain and the recommended choice of CCS). You _o_u_g_h_t to use these. The idea is to automate and optimize the construction of programs/files -- ie. to leave enough _f_o_o_t _p_r_i_n_t_s so that others can follow. 11 UUWWOO//MMaakkee 11..11.. WWhheerree ttoo ssttaarrtt?? Like anything else (apart from the ccaatt and llss commands) mmaakkee can be frightening the first time you encounter it -- but it needn't be. You can learn about mmaakkee by: (1) Attend a course, like this one! Congratulations! (2) RTFM (read the f'ing manual). Available on aallll Unix systems. (3) Read more manuals: _M_a_k_e _-_- _A _P_r_o_g_r_a_m _f_o_r _M_a_i_n_t_a_i_n_i_n_g _C_o_m_p_u_t_e_r _P_r_o_g_r_a_m_s, by S.I. Feldman (in) BSD and Sys- tem V manauls. (4) Follow the examples set in comp.unix.sources, comp.misc.sources, /usr/src, etc. BBeewwaarree:: the exam- ples set in alt.sources are pretty bad -- tools are often distributed without decent Makefiles. (5) Start small and build on what you've done. (6) Start today, don't wait until later. It's easy once you get started. Compare with figuring out your VCR, digital watch, camera, etc. This takes a bit of time but isn't too bad once you get going. Figuring out how to use Makefiles will take some time, but it's time well spent. UUWWOO//MMaakkee 22 11..22.. AAnn eexxaammppllee These slides are produced by Make! [[11::1111ppmm ssuunnccoonn]] llss MMaakkeeffiillee RRCCSS RREEAADDMMEE ssiizziinngg sslliiddeess ttiittllee [[11::1111ppmm ssuunnccoonn]] ppaaggee RREEAADDMMEE TThhiiss iiss tthhee sslliiddeess ffoorr mmyy MMaakkeeffiillee ccoouurrssee.. TTyyppee ""mmaakkee"" ttoo pprroodduuccee aa ppoossttssccrriipptt vveerrssiioonn ssuuiittaabbllee ffoorr pprriinnttiinngg oonn aa llaasseerr pprriinntteerr.. RReegg QQuuiinnttoonn;; 3300--OOcctt--9900 [[11::1111ppmm ssuunnccoonn]] mmaakkee ggrrooffff --mmee --TTppss ssiizziinngg ttiittllee sslliiddeess >>ppaappeerr..ppss The goal is to be able to approach any software distribution and just type [[1111::3322aamm sshhaaddooww]] mmaakkee and/or [[1111::3322aamm ssuunnccoonn]] mmaakkee aallll _{_o_r _i_n_s_t_a_l_l_, _c_l_e_a_n_, _d_e_p_e_n_d_._._._} 33 UUWWOO//MMaakkee 11..33.. MMaakkeeffiilleess The rules for constructing targets are itemized in a MMaakkee-- ffiillee [[1111::2266aamm ssuunnccoonn]] llss MMaakkeeffiillee RRCCSS RREEAADDMMEE ssiizziinngg sslliiddeess ttiittllee All _g_o_o_d software distributions will have a Makefile and README to get you started. If you're going to install some- thing, it better have a manual as well. Any project you expect others to be involved with (eg. when you're away who fixes your problems?) better have both. _Y_o_u _h_a_v_e _t_o _l_e_a_v_e _f_o_o_t _p_r_i_n_t_s. The ideal README will tell you to do a few minor things (like change a macro definition for BIN, MAN, or etc) and then say "make". Any ongoing project should have be also managed with RCS (more on that another day) or SCCS. UUWWOO//MMaakkee 44 11..44.. MMaakkeeffiillee NNaammiinngg Make is going to look for a file called MMaakkeeffiillee, if not found then a file called mmaakkeeffiillee. Use the first (so the name stands out in listings). You can get away without any Makefile (but shouldn't)! Make has default rules it knows about. [[1122::0011ppmm jjuulliiaann]] llss pprriinntteennvv..cc [[1122::0011ppmm jjuulliiaann]] ppaaggee pprriinntteennvv..cc ##iinncclluuddee <> mmaaiinn((aarrggcc,,aarrggvv,,aarrggpp)) iinntt aarrggcc;; cchhaarr **aarrggvv[[]],,**aarrggpp[[]];; {{ cchhaarr ****eepp;; ffoorr ((eepp==aarrggpp;; **eepp;; eepp++++)) pprriinnttff((""%%ss\\nn"",,**eepp));; eexxiitt((00));; }} Do I have to resort to figuring out and using the C compiler (loader, assembler, etc) to build the executable? 55 UUWWOO//MMaakkee Even if you don't have a Makefile you can still use the make command: [[1122::0011ppmm jjuulliiaann]] mmaakkee pprriinntteennvv cccc pprriinntteennvv..cc --oo pprriinntteenn [[1122::0011ppmm jjuulliiaann]] ..//pprriinntteennvv EEDDIITTOORR==eemmaaccss HHOOMMEE==//uussrr//ppeeooppllee//gguurruu//rreeggggeerrss HHOOSSTT==jjuulliiaann..uuwwoo..ccaa NNNNTTPPSSEERRVVEERR==nneewwsshhoosstt..uuwwoo..ccaa OORRGGAANNIIZZAATTIIOONN==UUnniivveerrssiittyy ooff WWeesstteerrnn OOnnttaarriioo,, LLoonnddoonn _e_t_c_._._. Using a make command is much easier than figuring out how to run a compiler and fill in the right switches, etc. That can be delayed until later. In any case, make seems to know a lot about the C compiler that would be useful for the first time programmer. UUWWOO//MMaakkee 66 11..55.. MMaakkeeffiillee SSyynnttaaxx//SSeemmaannttiiccss ## ## $$AAuutthhoorr:: rreeggggeerrss $$ ## $$DDaattee:: 11999922//0022//1144 2211::0000::5588 $$ ## $$IIdd:: sslliiddeess,,vv 11..22 11999922//0022//1144 2211::0000::5588 rreeggggeerrss EExxpp $$ ## SSRRCCSS== ssiizziinngg ttiittllee sslliiddeess DDOOCC== //uussrr//ddoocc//mmaakkee..ccoouurrssee..ppss MMAACCRROOSS== --mmee PPSSRROOFFFF== ggrrooffff --TTppss DDIITTRROOFFFF== ggrrooffff --TTddvvii ppaappeerr..ppss:: $$((SSRRCCSS)) $$((PPSSRROOFFFF)) $$((MMAACCRROOSS)) $$((SSRRCCSS)) >>ppaappeerr..ppss ppaappeerr..ddvvii:: $$((SSRRCCSS)) $$((DDIITTRROOFFFF)) $$((MMAACCRROOSS)) $$((SSRRCCSS)) >>ppaappeerr..ddvvii pprreevviieeww:: ppaappeerr..ddvvii xxddvvii ppaappeerr..ddvvii iinnssttaallll:: ppaappeerr..ppss ppssnnuupp --pp22 ppaappeerr..ppss >>$$((DDOOCC)) cchhmmoodd aa++rr $$((DDOOCC)) cclleeaann:: --rrmm ccoorree **~~ ppaappeerr..ppss ppaappeerr..ddvvii 77 UUWWOO//MMaakkee This shouldn't look like magic. There's some comments, some macros defined (or variables), some dependency rules (make the paper if the sources have changed), and some commands to make things. UUWWOO//MMaakkee 88 11..66.. MMaakkeeffiillee ccoommppoonneennttss CCoommmmeennttss are any text beginning with the pound (#) sign: ## $$IIdd:: sslliiddeess,,vv 11..22 11999922//0022//1144 2211::0000::5588 rreeggggeerrss EExxpp $$ MMaaccrrooss. Make has a simple macro definition and substitution mechanism: MMAACCRROOSS== --mmee PPSSRROOFFFF== ggrrooffff --TTppss DDIITTRROOFFFF== ggrrooffff --TTddvvii TTaarrggeettss. You make a particular target (eg. mmaakkee aallll), in none specified then the first target found: ppaappeerr..ddvvii:: $$((SSRRCCSS)) $$((DDIITTRROOFFFF)) $$((MMAACCRROOSS)) $$((SSRRCCSS)) >>ppaappeerr..ddvvii The target is made if any of the dependent files have changed. CCoonnttiinnuuaattiioonn lliinneess. Use a back slash (\). This is important for long macros and/or rules -- more on this in a moment. 99 UUWWOO//MMaakkee 11..77.. MMaakkeeffiillee MMaaccrrooss Macros are defined in a Makefile as <>==<>; for example: CCFFLLAAGGSS== --OO --ssyyssttyyppee bbssdd4433 There are lots of default macros -- you should honor the existing naming conventions. To find out what rules/macros make is using type: [[11::2233ppmm ssuunnccoonn]] mmaakkee --pp _e_t_c_._._. UUSSEERR== rreeggggeerrss TTEERRMM== xxtteerrmm _e_t_c_._._. LLDD== lldd AASS== aass AARR== aarr FFCC== ff7777 CCCC== cccc _e_t_c_._._. UUWWOO//MMaakkee 1100 Note that your environment variables are exported into the make as macros. They will override the defaults. For exam- ple: [[22::3388ppmm jjuulliiaann]] llss pprriinntteennvv..cc [[22::3399ppmm jjuulliiaann]] sseetteennvv CCFFLLAAGGSS --OO [[22::3399ppmm jjuulliiaann]] sseetteennvv LLDDFFLLAAGGSS --ss [[22::4411ppmm jjuulliiaann]] mmaakkee pprriinntteennvv cccc --OO pprriinntteennvv..cc --ss --oo pprriinntteennvv Compare with our earlier example: [[1122::0011ppmm jjuulliiaann]] mmaakkee pprriinntteennvv cccc pprriinntteennvv..cc --oo pprriinntteennvv Alternatively, you can set macros on the make command line: [[33::4400ppmm jjuulliiaann]] mmaakkee ""CCFFLLAAGGSS== --OO"" ""LLDDFFLLAAGGSS==--ss"" pprriinntteennvv cccc --OO pprriinntteennvv..cc --ss --oo pprriinntteennvv Both of these are strategies you (generally) ought to avoid. But they can be handy. 1111 UUWWOO//MMaakkee A good example of importing a macro from the command line [[33::4400ppmm jjuulliiaann]] mmaakkee ""PPSSRROOFFFF==nnrrooffff"" This would make an nroff (ie. plain text) version of my slides. Another good example of importing a macro from the command line [[33::4400ppmm jjuulliiaann]] ssuu PPaasssswwoorrdd:: RRoooott:: mmaakkee ""OOWWNNEERR==rreeggggeerrss"" iinnssttaallll iinnssttaallll --cc --mm 775555 --oo rreeggggeerrss pprriinntteennvv //uussrr//llooccaall//bbiinn _e_t_c_._._. This strategy is a good method for making sure that programs are installed with the ownership tagged to a particular per- son. UUWWOO//MMaakkee 1122 Most install targets use the OWNER macro. But, browse the Makefile first to see how the install is done. Alterna- tively use mmaakkee --nn: RRoooott:: mmaakkee --nn ""OOWWNNEERR==rreeggggeerrss"" iinnssttaallll iinnssttaallll --cc --mm 775555 --oo rreeggggeerrss pprriinntteennvv //uussrr//llooccaall//bbiinn _e_t_c_._._. The --nn flag says: tell me what you would do (but don't do it). Ie. it displays the commands that would be executed. 1133 UUWWOO//MMaakkee You ccaannnnoott safely assume that everyone has the same environ- ment variables that you have. Therefore it is best to con- struct a Makefile and define your macros -- so that others can build things too. [[22::5533ppmm jjuulliiaann]] llss MMaakkeeffiillee pprriinntteennvv..cc [[22::5533ppmm jjuulliiaann]] ppaaggee MMaakkeeffiillee ## mmaakkee tthhee pprriinntteennvv ccoommmmaanndd CCFFLLAAGGSS== --OO LLDDFFLLAAGGSS== --ss CCCC==cccc pprriinntteennvv:: pprriinntteennvv..cc $$((CCCC)) $$((CCFFLLAAGGSS)) pprriinntteennvv..cc \\ $$((LLDDFFLLAAGGSS)) --oo pprriinntteennvv cclleeaann:: --rrmm pprriinntteennvv **~~ **..oo ccoorree [[22::5533ppmm jjuulliiaann]] mmaakkee cccc --OO pprriinntteennvv..cc --ss --oo pprriinntteennvv This Makefile constructed from the make defaults learned from make. UUWWOO//MMaakkee 1144 11..88.. CCoonnvveennttiioonnaall MMaaccrrooss There are lots of default macros (type "make -p" to print out the defaults). Most are pretty obvious from the rules in which they are used: AARR == aarr GGFFLLAAGGSS == GGEETT == ggeett AASSFFLLAAGGSS == MMAASS == mmaass AASS == aass FFCC == ff7777 CCFFLLAAGGSS == CCCC == cccc LLDDFFLLAAGGSS == LLDD == lldd LLFFLLAAGGSS == LLEEXX == lleexx YYFFLLAAGGSS == YYAACCCC == yyaacccc LLOOAADDLLIIBBSS == MMAAKKEE == mmaakkee MMAAKKEEAARRGGSS == ''SSHHEELLLL==//bbiinn//sshh'' SSHHEELLLL == //bbiinn//sshh MMAAKKEEFFLLAAGGSS == bb 1155 UUWWOO//MMaakkee 11..99.. SSppeecciiaall MMaaccrrooss Before issuing any command in a target rule set there are certain special macros predefined. (1) $$@@ is the name of the file to be made. (2) $$?? is the names of the changed dependents. So, for example, we could use a rule pprriinntteennvv:: pprriinntteennvv..cc $$((CCCC)) $$((CCFFLLAAGGSS)) $$?? $$((LLDDFFLLAAGGSS)) --oo $$@@ alternatively: pprriinntteennvv:: pprriinntteennvv..cc $$((CCCC)) $$((CCFFLLAAGGSS)) $$@@..cc $$((LLDDFFLLAAGGSS)) --oo $$@@ There are two more special macros used in _i_m_p_l_i_c_i_t _r_u_l_e_s (which we will discuss in a moment). They are: (1) $$<< the name of the related file that caused the action. (2) $$** the prefix shared by target and dependent files. UUWWOO//MMaakkee 1166 22.. MMaakkeeffiillee TTaarrggeett RRuulleess The general syntax of a Makefile Target Rule is _t_a_r_g_e_t [_t_a_r_g_e_t...] : [_d_e_p_e_n_d_e_n_t ....] [ _c_o_m_m_a_n_d ...] Items in brackets are optional, ellipsis means one or more. Note the ttaabb to preface each command is required (watch out emacs users!). The semantics is pretty simple. When you say "make target" make ffiinnddss the target rule that applies and, if any of the dependents are nneewweerr than the target, make eexxeeccuutteess the com- mands one at a time (after macro substitution). If any dependents have to be made, that happens first (so you have a recursion). A make will tteerrmmiinnaattee if any command returns a failure sta- tus. That's why you see rules like: cclleeaann:: --rrmm **..oo **~~ ccoorree ppaappeerr Make iiggnnoorreess the returned status on command lines that begin with a dash. eg. who cares if there is no core file? 1177 UUWWOO//MMaakkee Make will eecchhoo the commands, after macro substition to show you what's happening as it happens. Sometimes you might want to turn that off. For example: iinnssttaallll:: @@eecchhoo YYoouu mmuusstt bbee rroooott ttoo iinnssttaallll There's also a method for turning off all the echos. .SILENT: The pseudo target, .SILENT, if found will defeat the echo- ing. This is a bbaadd idea and should be used with care. Never trust a software distribution with the .SILENT target -- someone's up to no good if they're using it. Trojan horse perhaps? UUWWOO//MMaakkee 1188 22..11.. EExxaammppllee TTaarrggeett RRuulleess For example, to manage sources stored within RCS (sometimes you'll need to "check out" a source file): SSRRCCSS==xx..cc yy..cc zz..cc $$((SSRRCCSS)):: ccoo $$@@ To manage sources stored within SCCS (sometimes you'll need to "get" a source file): $$((SSRRCCSS)):: ssccccss ggeett $$@@ Alternativley, to manage sources stored within SCCS or RCS let's generalize with a macro that we can set as required. SSRRCCSS==xx..cc yy..cc zz..cc ## GGEETT== ssccccss ggeett GGEETT== ccoo $$((SSRRCCSS)):: $$((GGEETT)) $$@@ 1199 UUWWOO//MMaakkee For example, to construct a library of object files lliibb..aa:: xx..oo yy..oo zz..oo aarr rrvvuu lliibb..aa xx..oo yy..oo zz..oo rraannlliibb lliibb..aa Alternatively, to be a bit more fancy you could use: OOBBJJ==xx..oo yy..oo zz..oo AARR==aarr lliibb..aa:: $$((OOBBJJ)) $$((AARR)) rrvvuu $$@@ $$((OOBBJJ)) rraannlliibb $$@@ Since AR is a default macro already assigned to "ar" you can get away without defining it (but shouldn't). If you get used to using macros you'll be able to make a few rules that you can use over and over again. UUWWOO//MMaakkee 2200 For example, to construct a library in some other directory IINNCC==....//mmiisscc OOTTHHEERRSS==....//mmiisscc//lliibb..aa $$((OOTTHHEERRSS)):: ccdd $$((IINNCC));; mmaakkee lliibb..aa BBeewwaarree::, the following will not work (but you'd think it should) IINNCC==....//mmiisscc OOTTHHEERRSS==....//mmiisscc//lliibb..aa $$((OOTTHHEERRSS)):: ccdd $$((IINNCC)) mmaakkee lliibb..aa Each command in the target rule is executed in a separate shell. This makes for some interesting constructs and long continuation lines. For example, iinnssttaallll:: $$((lliibbss)) $$((ssppeecciiaall)) $$((ppuubblliicc)) $$((pprriivvaattee)) nnnnttpp__sseerrvveerr ffoorr ii iinn $$((ppuubblliicc));; ddoo \\ $$((iinnssttaallll)) --cc --mm 775555 $$$$ii $$((rrnnbbiinn))//$$ii;; \\ ddoonnee 2211 UUWWOO//MMaakkee To generate a tags file SSRRCCSS==xx..cc yy..cc zz..cc CCTTAAGGSS==ccttaaggss --xx >>ttaaggss ttaaggss:: $$((SSRRCCSS)) $${{CCTTAAGGSS}} $$((SSRRCCSS)) On large projects a tags file, that lists all functions and their invocations is a handy tool. (But I always use grep). To generate a listing of likely bugs in your problems lliinntt:: lliinntt $$((CCFFLLAAGGSS)) $$((SSRRCCSS)) Henry Spencer's first rule of programming is always use lint. Lint is a really good tool for finding those obvious bugs that slip into programs -- eg. type classes, bad argu- ment list, etc. (But I've never used it). UUWWOO//MMaakkee 2222 22..22.. AAllll::,, IInnssttaallll::,, CClleeaann::,,.... People have come to expect certain targets in Makefiles. You should always browse first, but it's reasonable to expect that the targets aallll (or just make), iinnssttaallll, and cclleeaann will be found. (1) mmaakkee aallll -- should compile everything so that you can do local testing before installing things. (2) mmaakkee iinnssttaallll -- should install things in the right places. BBuutt watch out that things are installed in the right place for _y_o_u_r _s_y_s_t_e_m. (3) mmaakkee cclleeaann -- should clean things up. Get rid of the executables, any temporary files, object files, etc. You may encounter other common targets, some have been already mentioned (tags and lint). 2233 UUWWOO//MMaakkee 33.. pprriinntteennvv MMaakkeeffiillee ## mmaakkee tthhee pprriinntteennvv ccoommmmaanndd,, RReegg QQuuiinnttoonn.. ## ## $$AAuutthhoorr:: rreeggggeerrss $$ ## $$DDaattee:: 11999922//0022//1144 2211::0000::5588 $$ ## $$IIdd:: sslliiddeess,,vv 11..22 11999922//0022//1144 2211::0000::5588 rreeggggeerrss EExxpp $$ OOWWNNEERR==bbiinn GGRROOUUPP==bbiinn CCTTAAGGSS== ccttaaggss --xx >>ttaaggss CCFFLLAAGGSS== --OO LLDDFFLLAAGGSS== --ss CCCC==cccc GGEETT==ccoo SSRRCCSS==pprriinntteennvv..cc OOBBJJSS==pprriinntteennvv..oo SSHHAARR==sshhaarr MMAANNDDIIRR==//uussrr//mmaann//mmaannll//pprriinntteennvv..ll BBIINNDDIIRR==//uussrr//llooccaall//bbiinn ## OOnn mmiippss ((aass lliifftteedd ffrroomm BBSSDD)) ##DDEEPPEENNDD== mmkkddeeppeenndd --cc ""$$((CCCC)) $$((CCFFLLAAGGSS))"" MMaakkeeffiillee ## OOrr tthhee XX1111 vveerrssiioonn ((aaggaaiinn,, aass lliifftteedd ffrroomm BBSSDD)) DDEEPPEENNDD== mmaakkeeddeeppeenndd $$((CCFFLLAAGGSS)) ## HHmmmmmm...... hhaavvee nneevveerr uusseedd mmkkmmkkff ##DDEEPPEENNDD == mmkkmmkkff UUWWOO//MMaakkee 2244 aallll:: pprriinntteennvv ## TToo ggeett tthhiinnggss oouutt ooff tthhee rreevviissiioonn ccoonnttrrooll ssyysstteemm $$((SSRRCCSS)):: $$((GGEETT)) $$@@ ## TToo mmaakkee aann oobbjjeecctt ffrroomm ssoouurrccee $$((CCCC)) $$((CCFFLLAAGGSS)) --cc $$**..cc ## TToo mmaakkee aann eexxeeccuuttaabbllee pprriinntteennvv:: $$((OOBBJJSS)) $$((CCCC)) $$((LLDDFFLLAAGGSS)) --oo $$@@ $$((OOBBJJSS)) ## TToo iinnssttaallll tthhiinnggss iinn tthhee rriigghhtt ppllaaccee iinnssttaallll:: pprriinntteennvv pprriinntteennvv..mmaann $$((IINNSSTTAALLLL)) --cc --oo $$((OOWWNNEERR)) --gg $$((GGRROOUUPP)) --mm 775555 pprriinntteennvv $$((BBIINNDDIIRR)) $$((IINNSSTTAALLLL)) --cc --oo $$((OOWWNNEERR)) --gg $$((GGRROOUUPP)) --mm 664444 pprriinntteennvv..mmaann $$((MMAANNDDIIRR)) ## wwhheerree aarree ffuunnccttiioonnss//pprroocceedduurreess?? ttaaggss:: $$((SSRRCCSS)) $$((CCTTAAGGSS)) $$((SSRRCCSS)) 2255 UUWWOO//MMaakkee ## wwhhaatt hhaavvee II ddoonnee wwrroonngg?? lliinntt:: $$((SSRRCCSS)) lliinntt $$((CCFFLLAAGGSS)) $$((SSRRCCSS)) ## wwhhaatt aarree tthhee ssoouurrccee ddeeppeennddeenncciieess ddeeppeenndd:: $$((SSRRCCSS)) $$((DDEEPPEENNDD)) $$((SSRRCCSS)) ## ttoo mmaakkee aa sshhaarr ddiissttrriibbuuttiioonn sshhaarr:: cclleeaann $$((SSHHAARR)) RREEAADDMMEE MMaakkeeffiillee pprriinntteennvv..mmaann $$((SSRRCCSS)) >>sshhaarr ## cclleeaann oouutt tthhee ddrroossss cclleeaann:: --rrmm pprriinntteennvv **~~ **..oo **..bbaakk ccoorree ttaaggss sshhaarr ## DDOO NNOOTT DDEELLEETTEE TTHHIISS LLIINNEE ---- mmaakkee ddeeppeenndd ddeeppeennddss oonn iitt.. pprriinntteennvv..oo:: //uussrr//iinncclluuddee//ssttddiioo..hh UUWWOO//MMaakkee 2266 33..11.. MMllnneett MMaakkeeffiillee ## $$AAuutthhoorr:: rreeggggeerrss $$ ## $$LLoocckkeerr:: $$ ## $$DDaattee:: 11999922//0022//1144 2211::0000::5588 $$ ## $$IIdd:: sslliiddeess,,vv 11..22 11999922//0022//1144 2211::0000::5588 rreeggggeerrss EExxpp $$ ## $$SSoouurrccee:: //uussrr//ssrrcc//uussrr..llooccaall//ddoocc//ccoouurrsseess//mmaakkee//RRCCSS//sslliiddeess,,vv $$ ## $$SSttaattee:: EExxpp $$ ## ## TTiittllee:: mmaakkee ## ## DDaattee:: FFeebb 2233,, 11998844 ## ## AAuutthhoorr:: RReeggiinnaalldd EE.. QQuuiinnttoonn ## ## AAbbssttrraacctt:: ## ddeeppeennddeenncciieess ffoorr mmllcciiccoo.. ## ## wwhhaatt iiss tthhee ddaaeemmoonn uusseerr aanndd ggrroouupp?? DDAAEEMMOONN==uuuuccpp GGRROOUUPP==ddaaeemmoonn PPAATTHH==//uussrr//bbssdd4433//bbiinn:://uussrr//uuccbb:://uussrr//bbiinn:://uussrr//llooccaall:://bbiinn:://uussrr//eettcc:://eettcc:: ## wwhheerree aarree eexxeeccuuttaabblleess ppuutt?? BBIINN==//uussrr//ccccss//bbiinn//mmllnneett ## wwhheerree ddoo wwee ssaavvee oolldd jjuunnkk OOLLDD==//uussrr//ccccss//oolldd ## wwhheerree aarree tthhee ssppooooll aanndd lliibb aarreeaass?? SSPPLLIIBB==//uussrr//lliibb//mmllnneett //uussrr//ssppooooll//mmllnneett $$((BBIINN)) 2277 UUWWOO//MMaakkee ## wwhhaatt ddoo II uussee aass lleexx?? LLEEXX==lleexx ## BBSSDD ssttyyllee iinnssttaallll IINNSSTTAALLLL==iinnssttaallll ## ccoommppiillaattiioonn ffllaaggss ## TThhee ffoolllloowwiinngg oonn ssuunn33 ##LLDDFFLLAAGGSS== --llrreessoollvv ##CCFFLLAAGGSS== --cc --OO --DDTTCCPPIIPP --DDPPIIPPEE --DDMMLLCCIICCOO==\\""$$((BBIINN))//mmllcciiccoo\\"" \\ ## --DDTTEERRMMIIOO==\\<> \\ ## --DDLLOOGG__MMLLNNEETT==LLOOGG__LLOOCCAALL11 --DDMMAAXXDDGGLL==220000 --DDMMAAXXPPPPII==44 --II....//mmiisscc ## TThhee ffoolllloowwiinngg,, oonn mmiippss LLDDFFLLAAGGSS== CCFFLLAAGGSS== --cc --OO --DDTTCCPPIIPP --DDPPIIPPEE --DDMMLLCCIICCOO==\\""$$((BBIINN))//mmllcciiccoo\\"" \\ --DDTTEERRMMIIOO==\\<> --ssyyssttyyppee bbssdd4433 \\ --DDLLOOGG__MMLLNNEETT==LLOOGG__LLOOCCAALL11 --DDMMAAXXDDGGLL==220000 --DDMMAAXXPPPPII==44 --II....//mmiisscc ## --DDDDEECCNNEETT --DDTTCCPPIIPP --DDPPIIPPEE wwoouulldd bbee nniiccee ttoooo.. ## tthheerree aarree ssoommee ootthheerr eexxtteerrnnaallss,, wwhheerree aarree tthheeyy?? IINNCC==....//mmiisscc OOTTHHEERRSS==....//mmiisscc//lliibb..aa ## MMaakkee aallll aassssuummeess aa cceerrttaaiinn eennvviirroonnmmeenntt aallll:: lliibb..aa $$((OOTTHHEERRSS)) mmkkhhoosstt mmllcciiccoo mmllccaallll sseennddmmllnneett UUWWOO//MMaakkee 2288 ## TThheessee ffoorrccee aa ppaarrttiiccuullaarr eennvviirroonnmmeenntt mmiippss:: mmaakkee aallll ""LLDDFFLLAAGGSS== ""\\ ""CCFFLLAAGGSS== --cc --OO --DDTTEERRMMIIOO==\\<> --ssyyssttyyppee bbssdd4433 \\ --DDTTCCPPIIPP --DDPPIIPPEE --DDMMLLCCIICCOO==\\\\\\""$$((BBIINN))//mmllcciiccoo\\\\\\"" \\ --DDLLOOGG__MMLLNNEETT==LLOOGG__LLOOCCAALL11 --DDMMAAXXDDGGLL==220000 --DDMMAAXXPPPPII==44 --II....//mmiisscc"" ssuunn33:: mmaakkee aallll ""LLDDFFLLAAGGSS== --llrreessoollvv --BBddyynnaammiicc"" \\ ""CCFFLLAAGGSS== --cc --OO --DDTTEERRMMIIOO==\\<> \\ --DDTTCCPPIIPP --DDPPIIPPEE --DDMMLLCCIICCOO==\\\\\\""$$((BBIINN))//mmllcciiccoo\\\\\\"" \\ --DDLLOOGG__MMLLNNEETT==LLOOGG__LLOOCCAALL11 --DDMMAAXXDDGGLL==220000 --DDMMAAXXPPPPII==44 --II....//mmiisscc"" $$((OOTTHHEERRSS)):: ccdd $$((IINNCC));; mmaakkee lliibb..aa HHFFIILLEESS== gglloobb..hh ttyyppeess..hh SSRRCCSS== aakktthhiiss..cc bbaauudd..cc bblldd__ddccbb..cc ddeeccnneett..cc ddeevviiccee..cc ggeetteennvv..cc iinnmmssgg..cc \\ iinntteerrpprreett..cc kkeerrmmiitt..cc mmaattcchh..cc mmkkhhoosstt..ll mmllccaallll..cc mmllcciiccoo..cc \\ nnaakktthhiiss..cc nnxxmmssgg..cc ppaanniicc..cc ppiippee..cc pprroocceessss..cc rreessppoonnssee..cc rrmmaaiill..cc rrttss..cc \\ sseennddmmllnneett..cc ssttiimmuullaattee..cc ttccppiipp..cc gglloobb..hh ttyyppeess..hh $$((SSRRCCSS)):: ccoo $$@@ ssoouurrcceess:: $$((SSRRCCSS)) OOBBJJ== aakktthhiiss..oo bbaauudd..oo bblldd__ddccbb..oo ddeeccnneett..oo\\ ddeevviiccee..oo ggeetteennvv..oo iinnmmssgg..oo\\ iinntteerrpprreett..oo kkeerrmmiitt..oo mmaattcchh..oo\\ nnaakktthhiiss..oo nnxxmmssgg..oo pprroocceessss..oo\\ rreessppoonnssee..oo rrmmaaiill..oo rrttss..oo\\ ssttiimmuullaattee..oo ttccppiipp..oo ppaanniicc..oo\\ ppiippee..oo $$((CCCC)) $$((CCFFLLAAGGSS)) $$**..cc lliibb..aa:: $$((OOBBJJ)) aarr rrvvuu lliibb..aa $$((OOBBJJ)) rraannlliibb lliibb..aa mmkkhhoosstt:: lliibb..aa $$((OOTTHHEERRSS)) lleexx..yyyy..oo $$((CCCC)) --ss --oo mmkkhhoosstt $$((LLDDFFLLAAGGSS)) lleexx..yyyy..oo lliibb..aa $$((OOTTHHEERRSS)) --nn --llll @@ssiizzee mmkkhhoosstt lleexx..yyyy..oo:: mmkkhhoosstt..ll ttyyppeess..hh $$((LLEEXX)) mmkkhhoosstt..ll $$((CCCC)) $$((CCFFLLAAGGSS)) --DDMMKKHHOOSSTT lleexx..yyyy..cc mmllcciiccoo:: mmllcciiccoo..oo lliibb..aa $$((OOTTHHEERRSS)) 2299 UUWWOO//MMaakkee $$((CCCC)) --ss --oo mmllcciiccoo $$((LLDDFFLLAAGGSS)) mmllcciiccoo..oo lliibb..aa $$((OOTTHHEERRSS)) @@ssiizzee mmllcciiccoo mmllccaallll:: mmllccaallll..oo $$((OOTTHHEERRSS)) $$((CCCC)) --ss --oo mmllccaallll $$((LLDDFFLLAAGGSS)) mmllccaallll..oo $$((OOTTHHEERRSS)) @@ssiizzee mmllccaallll sseennddmmllnneett:: sseennddmmllnneett..oo $$((OOTTHHEERRSS)) $$((CCCC)) --ss --oo sseennddmmllnneett $$((LLDDFFLLAAGGSS)) sseennddmmllnneett..oo $$((OOTTHHEERRSS)) @@ssiizzee sseennddmmllnneett cclleeaann:: --rrmm **..oo **..oolldd lliibb..aa mmllcciiccoo mmkkhhoosstt mmllccaallll sseennddmmllnneett lleexx..yyyy..cc ccoorree ## mmaakkee tthhee lliibb aanndd ssppooooll aarreeaass oowwnneerr DDAAEEMMOONN,, ggrroouupp GGRROOUUPP $$((SSPPLLIIBB)):: mmkkddiirr $$@@ cchhoowwnn $$((DDAAEEMMOONN)) $$@@ cchhggrrpp $$((GGRROOUUPP)) $$@@ cchhmmoodd 777755 $$@@ ## $$((IINNSSTTAALLLL)) mmllcciiccoo,, mmkkhhoosstt,, mmaakkee ssppooooll aanndd lliibb iiff rreeqquuiirreedd iinnssttaallll:: $$((SSPPLLIIBB)) --mmvv $$((BBIINN))//mmkkhhoosstt $$((OOLLDD)) $$((IINNSSTTAALLLL)) --cc --gg $$((GGRROOUUPP)) --oo $$((DDAAEEMMOONN)) --mm 66775500 mmkkhhoosstt $$((BBIINN)) --mmvv $$((BBIINN))//mmllcciiccoo $$((OOLLDD)) $$((IINNSSTTAALLLL)) --cc --gg $$((GGRROOUUPP)) --oo $$((DDAAEEMMOONN)) --mm 66775555 mmllcciiccoo $$((BBIINN)) --mmvv $$((BBIINN))mmllccaallll $$((OOLLDD)) $$((IINNSSTTAALLLL)) --cc --gg $$((GGRROOUUPP)) --oo $$((DDAAEEMMOONN)) --mm 775555 mmllccaallll $$((BBIINN)) --mmvv $$((BBIINN))//sseennddmmllnneett $$((OOLLDD)) $$((IINNSSTTAALLLL)) --cc --gg $$((GGRROOUUPP)) --oo $$((DDAAEEMMOONN)) --mm 775555 sseennddmmllnneett $$((BBIINN)) @@eecchhoo ""yyoouu nneeeedd lliibbss,, ssppoooollss,, aanndd ffiilltteerrss ffoorr eeaacchh hhoosstt"" ## ddeeppeenndd,, tthhee uussuuaall ddeeppeenndd:: cchhmmoodd 664444 MMaakkeeffiillee mmkkddeepp $$((CCFFLLAAGGSS)) $$((SSRRCCSS)) ## iiff yyoouu wwaanntt ttoo uussee //uussrr//llooccaall//lliibb//mmllnneett ((iiee.. sshhaarreedd bbeettwweeeenn mmaacchhiinneess)) llooccaalliibb:: mmkkddiirr --pp //uussrr//llooccaall//lliibb//mmllnneett llnn --ss //uussrr//llooccaall//lliibb//mmllnneett //uussrr//lliibb//mmllnneett ## iiff yyoouu wwaanntt ttoo uussee //vvaarr//llooccaall//lliibb//mmllnneett ((iiee.. pprriivvaattee ttoo eeaacchh mmaacchhiinnee)) vvaarrlliibb:: mmkkddiirr --pp //vvaarr//llooccaall//lliibb//mmllnneett llnn --ss //vvaarr//llooccaall//lliibb//mmllnneett //uussrr//lliibb//mmllnneett UUWWOO//MMaakkee 3300 ## DDOO NNOOTT DDEELLEETTEE TTHHIISS LLIINNEE ---- mmkkddeepp uusseess iitt.. ## DDOO NNOOTT PPUUTT AANNYYTTHHIINNGG AAFFTTEERR TTHHIISS LLIINNEE,, IITT WWIILLLL GGOO AAWWAAYY.. 3311 UUWWOO//MMaakkee 33..22.. MMaakkeeffiillee IImmpplliicciitt RRuulleess Consider the rule we used for printenv pprriinntteennvv:: pprriinntteennvv..cc $$((CCCC)) $$((CCFFLLAAGGSS)) pprriinntteennvv..cc $$((LLDDFFLLAAGGSS)) --oo pprriinntteennvv We generalized a bit to get pprriinntteennvv:: pprriinntteennvv..cc $$((CCCC)) $$((CCFFLLAAGGSS)) $$@@..cc $$((LLDDFFLLAAGGSS)) --oo $$@@ The command is one that ought to work in all cases where we build an executable xx out of the source code xx.c This can be stated as an implicit rule: .c: $$((CCCC)) $$((CCFFLLAAGGSS)) $$@@..cc $$((LLDDFFLLAAGGSS)) --oo $$@@ This _I_m_p_l_i_c_i_t rule says how to make xx out of xx.c -- run cc on xx.c and call the output xx. The rule is implicit because no particular target is mentioned. It can be used in all cases. UUWWOO//MMaakkee 3322 This implicit rule is built into make (type "make -p") and was responsible for building printenv when we had no Make- file. [[1122::0011ppmm jjuulliiaann]] llss pprriinntteennvv..cc [[1122::0011ppmm jjuulliiaann]] mmaakkee --pp _e_t_c_._._. .c: $$((CCCC)) $$((CCFFLLAAGGSS)) $$@@..cc $$((LLDDFFLLAAGGSS)) --oo $$@@ _e_t_c_._._. [[1122::0011ppmm jjuulliiaann]] mmaakkee pprriinntteennvv cccc pprriinntteennvv..cc --oo pprriinntteenn An important observation here is: o If you don't know how to build something (eg. and exe- cutable from source, a library of object, or etc.) then make either already knows how to do it, or can give you good clues on how it ought to be done. o The paper by Feldman lists some of the implicit rules in the appendix -- a good starting point. 3333 UUWWOO//MMaakkee Another common implicit rule is for the construction of .o (object) files out of .c (source files). .o.c: $$((CCCC)) $$((CCFFLLAAGGSS)) --cc $$<< alternatively .o.c: $$((CCCC)) $$((CCFFLLAAGGSS)) --cc $$**..cc You'll see lots of Makefiles that use this rule (it's usu- ally stated but could be assumed). _e_t_c_._._. OOBBJJSS==xx..oo yy..oo zz..oo _e_t_c_._._. .c.o: $$((CCCC)) $$((CCFFLLAAGGSS)) --cc $$**..cc _e_t_c_._._. pprrooggrraamm:: $$((OOBBJJSS)) $$((CCCC)) $$((LLDDFFLLAAGGSS)) --oo $$@@ $$((OOBBJJSS)) _e_t_c_._._. The only problem (a very minor one) is you don't have any- thing listed in the dependencies (other than the defaults -- that xx.o depends on xx.c for all values of xx). UUWWOO//MMaakkee 3344 44.. MMaakkee ddeeppeennddeenncciieess It's pretty common to have source code that uses include files. For example: [[1122::0011ppmm jjuulliiaann]] ppaaggee pprrooggrraamm..cc ##iinncclluuddee <> ##iinncclluuddee ""ddeeffss..hh"" ##iinncclluuddee ""gglloobb..hh"" _e_t_c_._._... mmaaiinn((aarrggcc,,aarrggvv)) _e_t_c_._._. The implicit rule only covers part of the source code depen- dency (it only knows that program.o depends on program.c). The usual method for handling this is to list the dependen- cies separately; _e_t_c_._._. $$((CCCC)) $$((CCFFLLAAGGSS)) --cc $$**..cc _e_t_c_._._. pprrooggrraamm..oo:: pprrooggrraamm..cc ddeeffss..hh gglloobb..hh Usually an implicit rule and a separate list of dependencies is all you need. And it ought to be easy enough to figure out what the dependencies are. 3355 UUWWOO//MMaakkee However, there are a number of nice tools around that will automatically generate dependency lists for you. For example (trivial) DDEEPPEENNDD== mmaakkeeddeeppeenndd $$((CCFFLLAAGGSS)) _e_t_c_._._. ## wwhhaatt aarree tthhee ssoouurrccee ddeeppeennddeenncciieess ddeeppeenndd:: $$((SSRRCCSS)) $$((DDEEPPEENNDD)) $$((SSRRCCSS)) _e_t_c_._._... ## DDOO NNOOTT DDEELLEETTEE TTHHIISS LLIINNEE ---- ........ pprriinntteennvv..oo:: //uussrr//iinncclluuddee//ssttddiioo..hh These tools (mkdepend, mkmkf, etc.) are very common these days and aren't too difficult to use or understand. They're just shell scripts that run cpp (or cc -M, or etc.) to find out what all the include dependencies are. They then just tack the dependency list onto the end of the Makefile. For most projects this isn't required. If you're building something large and interdependent (eg. the kernel, or X11, or etc.) you'll find them essential. These tools are usually public domain, rn comes with one (and acknowledges the BSD source). UUWWOO//MMaakkee 3366 55.. OOtthheerr uusseess ooff MMaakkeeffiilleess People often are of the impression that Makefiles are only useful for managing software projects -- compile, install, etc. This is a sseerriioouuss oovveerrssiigghhtt. Make is a tool for managing file system dependencies (this file has to be rebuilt if one of these files have changed). Software management is only an instance of that. Make can be used creatively to manage much more. [[1122::5599ppmm jjuulliiaann]] ppwwdd //uussrr//ssppooooll//ccrroonn//ccrroonnttaabbss [[1122::5599ppmm jjuulliiaann]] ppaaggee rroooott _e_t_c_._._. 00 00 ** ** ** \\ ccdd //uussrr//llooccaall//lliibb;; mmaakkee aalliiaasseess >>//ddeevv//nnuullll _e_t_c_._._. 00,,1155,,3300,,4455 ** ** ** ** \\ ccdd //uussrr//llooccaall//lliibb//nnaammeedd//ddaattaa;; mmaakkee iinnssttaallll >>//ddeevv//nnuullll We have probably 10 or so different make jobs run on a regu- lar basis out of crontab, or out of jobs run out of cron. 3377 UUWWOO//MMaakkee The Usenet group comp.mail.maps is used to distribute the maps required for the UUCP mailpath data base. We need to capture these maps if any have arrived. This is a pretty classic instance of a file system dependency. ## MMaakkeeffiillee:: hhooww ttoo rreebbuuiilldd tthhee uuuuccpp mmaapp ddaattaa--bbaassee ## ## RReegg QQuuiinnttoonn <>;; AAuugg 33,, 11998888 ## ## ((ccdd //uussrr//ssppooooll//mmaappss;; mmaakkee DDAATTEE)) iinn ccrroonnttaabb oonnccee eeaacchh ddaayy ## ## ddiirreeccttoorryy wwhheerree wwee ssttoorree rraaww mmaappss.. MMAAPPSS==//uussrr//ssppooooll//mmaappss ## mmaappss aass rreecceeiivveedd ffrroomm UUSSEENNEETT.. UUMMAAPPSS==//uussrr//ssppooooll//nneewwss//ccoommpp//mmaaiill//mmaappss//[[00--99]]** ## NNoottiiffyy wwhhoo aabboouutt wwoorrkk II ddoo?? NNOOTTIIFFYY==rreeggggeerrss DDAATTEE:: $${{UUMMAAPPSS}} ffoorr ii iinn $$??;; ddoo \\ sseedd ''11,,//^^$$$$//dd'' $$$$ii || ((ccdd $${{MMAAPPSS}};; //bbiinn//sshh));; \\ ddoonnee || mmaaiill --ss ""UUUUCCPP mmaappss eexxttrraacctteedd"" $${{NNOOTTIIFFYY}} ttoouucchh $${{MMAAPPSS}}//DDAATTEE UUWWOO//MMaakkee 3388 We rebuild our sendmail aliases once a day (if required) using the name server data (ie. whois reggers), /etc/passwd, and other files. ## $$AAuutthhoorr:: rreeggggeerrss $$ ## $$DDaattee:: 11999922//0022//1144 2211::0000::5588 $$ ## $$IIdd:: sslliiddeess,,vv 11..22 11999922//0022//1144 2211::0000::5588 rreeggggeerrss EExxpp $$ ## ## MMaakkeeffiillee:: hhooww ttoo rreebbuuiilldd tthhee aalliiaass ffiillee ## oonn oouurr sseerrvveerr,, aanndd fflloooodd ssoommee cclliieennttss ## ## RReegg QQuuiinnttoonn <>;; JJuullyy 2266,, 11998888 ## ## 1199--OOcctt--9900,, rreeqq:: aauuttoommaattee UUsseenneett mmaaiill iinntteerrffaaccee ## ## ((ccdd //uussrr//ccccss//lliibb;; mmaakkee aalliiaasseess)) iinn ccrroonnttaabb oonnccee eeaacchh ddaayy ## aalliiaasseess:: aalliiaasseess..ppuubblliicc aalliiaasseess..uusseenneett aalliiaasseess..pprriivvaattee aalliiaasseess..uusseerrss ccaatt aalliiaasseess..ppuubblliicc aalliiaasseess..uusseenneett \\ aalliiaasseess..uusseerrss aalliiaasseess..pprriivvaattee >>//ttmmpp//aalliiaasseess ccpp //ddeevv//nnuullll //ttmmpp//aalliiaasseess..ddiirr ccpp //ddeevv//nnuullll //ttmmpp//aalliiaasseess..ppaagg //uussrr//lliibb//sseennddmmaaiill --bbii --ooAA//ttmmpp//aalliiaasseess ccpp //ttmmpp//aalliiaasseess .. ccpp //ttmmpp//aalliiaasseess..ddiirr .. ccpp //ttmmpp//aalliiaasseess..ppaagg .. 3399 UUWWOO//MMaakkee aalliiaasseess..uusseerrss:: //eettcc//ppaasssswwdd aawwkk --FF:: ''{{pprriinnttff ""%%ss:: %%ss\\nn"",, $$$$11,, $$$$11}}'' //eettcc//ppaasssswwdd || \\ ssoorrtt >>aalliiaasseess..uusseerrss aalliiaasseess..uusseenneett:: //uussrr//lliibb//nneewwss//aaccttiivvee..ttiimmeess aawwkk ''{{pprriinnttff ""%%ss:: \\""||//uussrr//lliibb//nneewwss//iinneewwss --hh --nn %%ss;; eexxiitt 00\\""\\nn"",, $$$$11,, $$$$11}}'' \\ //uussrr//lliibb//nneewwss//aaccttiivvee || ssoorrtt >>aalliiaasseess..uusseenneett aalliiaasseess..ppuubblliicc:: //uussrr//ccccss//lliibb//ddiirreeccttoorryy//AALLIIAASSFFIILLEE ccdd //uussrr//ccccss//lliibb//ddiirreeccttoorryy;; mmaakkee sseedd ""ss//\\(([[^^::]]**\\))\\(([[^^<<]]**\\))<<\\(([[^^>>]]**\\))..**//\\11:: \\33//"" \\ //uussrr//ccccss//lliibb//ddiirreeccttoorryy//AALLIIAASSFFIILLEE >>aalliiaasseess..ppuubblliicc //uussrr//ccccss//lliibb//ddiirreeccttoorryy//iibbmmffoolldd //uussrr//ccccss//lliibb//ddiirreeccttoorryy//AALLIIAASSFFIILLEE || \\ mmaaiill --ss uuppddaattee mmddiirr@@uuwwoocccc11..uuwwoo..ccaa mmaaiill --ss ""CCaammppuuss EE--mmaaiill ddiirreeccttoorryy"" ccaammppuuss@@ssttuuddeenntt..bbuussiinneessss..uuwwoo..ccaa \\ << //uussrr//ccccss//lliibb//ddiirreeccttoorryy//AALLIIAASSFFIILLEE UUWWOO//MMaakkee 4400 We automatically update the Domain Name Service every 15 minutes if any of the DNS data files have changed. ## MMaakkeeffiillee ## ## $$AAuutthhoorr:: rreeggggeerrss $$ ## $$DDaattee:: 11999922//0022//1144 2211::0000::5588 $$ ## $$LLoocckkeerr:: $$ ## $$IIdd:: sslliiddeess,,vv 11..22 11999922//0022//1144 2211::0000::5588 rreeggggeerrss EExxpp $$ ## $$SSoouurrccee:: //uussrr//ssrrcc//uussrr..llooccaall//ddoocc//ccoouurrsseess//mmaakkee//RRCCSS//sslliiddeess,,vv $$ ## ## HHmmmmmm...... wwhhaatt aarree wwee uupp ttoo?? WWeellll,, II''dd lliikkee ttoo kkeeeepp tthhee ## nnaammee-->>nnuummbbeerr aanndd nnuummbbeerr-->>nnaammee mmaappppiinnggss iinn tthhee ssaammee ffiillee.. ## II ccoonnssttrruucctt tthhee nnuummbbeerr-->>nnaammee mmaappppiinnggss ((iinn--aaddddrr..aarrppaa..)) oouutt ## ooff tthhee ffiirrsstt aassssuummiinngg aa mmiinniimmaall rreessppoonnssiibbllee mmaannaaggeemmeenntt ooff ## tthhee oonnee ffiillee.. PPAATTHH==:://uussrr//bbssdd4433//bbiinn:://uussrr//uuccbb:://uussrr//bbiinn:://uussrr//llooccaall:://bbiinn:: PPUUBBHHOOSSTTSS==//uussrr//ssrrcc//gguurruu//ffttpp//nniicc//hhoossttss HHOOSSTTSS==//eettcc//hhoossttss SSOOAA==//uussrr//llooccaall//lliibb//lliissttss//ssooaa PPOOSSTTMMAASSTT==//uussrr//llooccaall//lliibb//lliissttss//ppoossttmmaasstteerrss BBOOOOTT==....//nnaammeedd..bboooott RREEVVAADDDDRR==....//iinn--aaddddrr..aarrppaa EETTHHRRAADDDDRR==....//iinn--eetthheerr..aarrppaa NNOOVVLLAADDDDRR==....//iinn--nnoovveellll..aarrppaa 4411 UUWWOO//MMaakkee DDOOMMAAIINNSS== aappmmaatthhss..ddoommaaiinn aarrttss..ddoommaaiinn aassttrroo..ddoommaaiinn bbiioossttaattss..ddoommaaiinn bbllwwttll..ddoommaaiinn \\ bbuussiinneessss..ddoommaaiinn ccccss..ddoommaaiinn ccooggssccii..ddoommaaiinn eedduu..ddoommaaiinn \\ eennggggaa..ddoommaaiinn eennggrrgg..ddoommaaiinn eexxpprreessss..ddoommaaiinn ggffxx..ddoommaaiinn ggpp..ddoommaaiinn\\ ggssoojj..ddoommaaiinn hhhhccrruu..ddoommaaiinn hhss..ccccss..ddoommaaiinn lliibbrraarryy..ddoommaaiinn nneett..ddoommaaiinn \\ pphhyyssiiccss..ddoommaaiinn pphhyyssiioollooggyy..ddoommaaiinn ppssyycchh..ddoommaaiinn ssttaattss..ddoommaaiinn \\ sslliiss..ddoommaaiinn ssssccll..ddoommaaiinn ggffxx..eennggggaa..ddoommaaiinn ddaasstt..ddoommaaiinn ccllss..ddoommaaiinn \\ sscciillaabb..ccccss..ddoommaaiinn hhoouussiinngg..ddoommaaiinn rreeggiissttrraarr..ddoommaaiinn pptt..ddoommaaiinn \\ ffiirreepprreevv..ddoommaaiinn oohhss..ddoommaaiinn ssttaaffffhhlltthh..ddoommaaiinn uuwwoo..ddoommaaiinn aallll:: iinnssttaallll $$((DDOOMMAAIINNSS)):: ccoo $$@@ ## ## TThhiiss oonnee iiss ooffffiicciiaall,, tthhee iinn--aaddddrr..aarrppaa ttaabbllee ttoo mmaapp nnuummbbeerrss bbaacckk ttoo nnaammeess.. ## $$((RREEVVAADDDDRR)):: $$((DDOOMMAAIINNSS)) iinn--aaddddrr..aarrppaa bboottttoomm..iinn--aaddddrr..aarrppaa @@iiff [[ !! --ww $$((RREEVVAADDDDRR)) ]];; tthheenn \\ eecchhoo ""YYoouu nneeeedd mmoorree pprriivviilleeddggeess\\nn"";; eexxiitt 11;; \\ ffii ffoorr ii iinn $$((DDOOMMAAIINNSS));; ddoo\\ ggrreepp 110000..112299..iinn--aaddddrr..aarrppaa $$$$ii;;\\ ddoonnee || sseedd ''ss//^^;;////'' || ssoorrtt >>..ttmmpp--rreevv ((ccaatt iinn--aaddddrr..aarrppaa || sseedd ss//VVEERRSSIIOONN//``ccaatt iinnssttaallll``//;;\\ eecchhoo '';; ######## CCUUTT HHEERREE ########'' ``ddaattee`` ''######## CCUUTT HHEERREE ########'';; \\ ccaatt ..ttmmpp--rreevv bboottttoomm..iinn--aaddddrr..aarrppaa)) >> $$((RREEVVAADDDDRR)) rrmm ..ttmmpp--rreevv UUWWOO//MMaakkee 4422 ## ## TThhiiss oonnee iiss llooccaall,, mmaapp eetthheerr nnuummbbeerrss bbaacckk ttoo nnaammeess aass aabboovvee ## $$((EETTHHRRAADDDDRR)):: $$((DDOOMMAAIINNSS)) iinn--eetthheerr..aarrppaa @@iiff [[ !! --ww $$((EETTHHRRAADDDDRR)) ]];; tthheenn \\ eecchhoo ""YYoouu nneeeedd mmoorree pprriivviilleeggeess\\nn"";; eexxiitt 11;; \\ ffii --ffoorr ii iinn $$((DDOOMMAAIINNSS));; ddoo\\ ggrreepp iinn--eetthheerr..aarrppaa $$$$ii;;\\ ddoonnee || sseedd ''ss//^^;;////'' || ssoorrtt >>..ttmmpp--eetthheerr ((ccaatt iinn--eetthheerr..aarrppaa || sseedd ss//VVEERRSSIIOONN//``ccaatt iinnssttaallll``//;;\\ eecchhoo '';; ######## CCUUTT HHEERREE ########'' ``ddaattee`` ''######## CCUUTT HHEERREE ########'';; \\ ccaatt ..ttmmpp--eetthheerr)) >> $$((EETTHHRRAADDDDRR)) rrmm ..ttmmpp--eetthheerr $$((NNOOVVLLAADDDDRR)):: $$((DDOOMMAAIINNSS)) iinn--nnoovveellll..aarrppaa @@iiff [[ !! --ww $$((NNOOVVLLAADDDDRR)) ]];; tthheenn \\ eecchhoo ""YYoouu nneeeedd mmoorree pprriivviilleeggeess\\nn"";; eexxiitt 11;; \\ ffii --ffoorr ii iinn $$((DDOOMMAAIINNSS));; ddoo\\ ggrreepp iinn--nnoovveellll..aarrppaa $$$$ii;;\\ ddoonnee || sseedd ''ss//^^;;////'' || ssoorrtt >>..ttmmpp--nnoovveellll ((ccaatt iinn--nnoovveellll..aarrppaa || sseedd ss//VVEERRSSIIOONN//``ccaatt iinnssttaallll``//;;\\ eecchhoo '';; ######## CCUUTT HHEERREE ########'' ``ddaattee`` ''######## CCUUTT HHEERREE ########'';; \\ ccaatt ..ttmmpp--nnoovveellll)) >> $$((NNOOVVLLAADDDDRR)) rrmm ..ttmmpp--nnoovveellll 4433 UUWWOO//MMaakkee ## ## //eettcc//hhoossttss iissnn''tt rreeaallllyy uusseedd aatt aallll,, bbuutt nniiccee ttoo hhaavvee ## $$((HHOOSSTTSS)):: $$((DDOOMMAAIINNSS)) hhoossttss..pprriivvaattee @@iiff [[ !! --ww $$((HHOOSSTTSS)) ]];; tthheenn \\ eecchhoo ""YYoouu nneeeedd mmoorree pprriivviilleeddggeess\\nn"";; eexxiitt 11;; \\ ffii ccpp hhoossttss..pprriivvaattee ..ttmmpp--hhoossttss eecchhoo ''######## OOFFFFIICCAALL DDAATTAA SSTTAARRTTSS HHEERREE ########'' >>>>..ttmmpp--hhoossttss eecchhoo ''## //eettcc//hhoossttss ffoorr uuwwoo..ccaa ssiitteess'' >>>>..ttmmpp--hhoossttss eecchhoo ''##'' ``ddaattee`` >>>>..ttmmpp--hhoossttss eecchhoo ''## DDaattaa ddeerriivveedd ffrroomm ooffffiicciiaall DDNNSS ddaattaa'' >>>>..ttmmpp--hhoossttss eecchhoo ''##'' >>>>..ttmmpp--hhoossttss --ffoorr ii iinn $$((DDOOMMAAIINNSS));; ddoo\\ ggrreepp 110000..112299..iinn--aaddddrr..aarrppaa $$$$ii;;\\ ddoonnee || sseedd ''ss//^^;;////'' ||\\ aawwkk --FF.. ''{{pprriinnttff((""%%ss..%%ss..%%ss..%%ss\\tt%%ss\\nn"",,$$$$44,,$$$$33,,$$$$22,,$$$$11,,$$$$00))}}'' ||\\ aawwkk ''{{pprriinnttff((""%%ss\\tt%%ss\\nn"",,$$$$11,,$$$$55))}}'' ||\\ sseedd --ee ''ss//..uuwwoo..ccaa..$$$$//..uuwwoo..ccaa//'' || \\ ssoorrtt >>>>..ttmmpp--hhoossttss iinnssttaallll --cc --mm 664444 ..ttmmpp--hhoossttss $$((HHOOSSTTSS)) rrmm ..ttmmpp--hhoossttss --iiff [[ --rr //eettcc//mmkkhhoossttss ]];; tthheenn\\ //eettcc//mmkkhhoossttss $$((HHOOSSTTSS));; ffii --iiff [[ --ww $$((PPUUBBHHOOSSTTSS)) ]];; tthheenn\\ sseedd ''11,,//######## OOFFFFIICCAALL DDAATTAA SSTTAARRTTSS HHEERREE ########//dd'' \\ $$((HHOOSSTTSS)) >>$$((PPUUBBHHOOSSTTSS));; ffii UUWWOO//MMaakkee 4444 ## ## TThhee SSOOAA mmaaiilliinngg lliisstt ccoovveerrss aallll ppeeooppllee wwhhoo mmaannaaggee ddoommaaiinnss aatt WWeesstteerrnn,, ## tthhoossee wwhhoo rruunn tthheeiirr oowwnn pprriimmaarryy aarree lliisstteedd iinn tthhee ffiillee ssooaa.. ## $$((SSOOAA)):: $$((DDOOMMAAIINNSS)) MMaakkeeffiillee ssooaa @@iiff [[ !! --ww $$((SSOOAA)) ]];; tthheenn \\ eecchhoo ""YYoouu nneeeedd mmoorree pprriivviilleeddggeess\\nn"";; eexxiitt 11;; \\ ffii ggrreepp ""@@..**SSOOAA"" $$((DDOOMMAAIINNSS)) ||\\ sseedd --ee ''ss//..**[[ ]]\\(([[__aa--zz00--99]]**\\))..\\(([[..__aa--zz00--99]]**\\))..[[ ]]((..**//\\11@@\\22//'' ||\\ ssoorrtt --uu >> $$((SSOOAA)) ccaatt ssooaa >>>> $$((SSOOAA)) ## ## TThhee PPOOSSTTMMAASSTT mmaaiilliinngg lliisstt ccoovveerrss aallll ppeeooppllee wwhhoo aarree ppoossttmmaasstteerrss aatt WWeesstteerrnn ## $$((PPOOSSTTMMAASSTT)):: $$((DDOOMMAAIINNSS)) MMaakkeeffiillee ppoossttmmaasstteerrss @@iiff [[ !! --ww $$((PPOOSSTTMMAASSTT)) ]];; tthheenn \\ eecchhoo ""YYoouu nneeeedd mmoorree pprriivviilleeddggeess\\nn"";; eexxiitt 11;; \\ ffii ccpp ppoossttmmaasstteerrss $$((PPOOSSTTMMAASSTT)) ggrreepp --vv ''^^;;'' **..ddoommaaiinn || ggrreepp ''MMXX'' ||\\ sseedd ''ss//..**MMXX..**[[ ]]\\(([[..__aa--zz00--99]]**\\))..uuwwoo..ccaa..**//ppoossttmmaasstteerr@@\\11..uuwwoo..ccaa//'' ||\\ ssoorrtt --uu || ggrreepp --vv vvooiidd..uuwwoo..ccaa >>>> $$((PPOOSSTTMMAASSTT)) 4455 UUWWOO//MMaakkee ## ## AAfftteerr mmuucckkiinngg aabboouutt yyoouu nneeeedd ttoo rreessttaarrtt tthhee nnaammee ddaaeemmoonn aanndd ## uuppddaattee tthhee ootthheerr nnaammee ddaaeemmoonnss ...... ## iinnssttaallll:: $$((BBOOOOTT)) $$((RREEVVAADDDDRR)) $$((EETTHHRRAADDDDRR)) $$((NNOOVVLLAADDDDRR)) $$((HHOOSSTTSS)) $$((SSOOAA)) $$((PPOOSSTTMMAASSTT)) @@iiff [[ ``wwhhooaammii`` !!== ""rroooott"" ]];; tthheenn \\ eecchhoo ""YYoouu nneeeedd ttoo bbee rroooott\\nn"";; eexxiitt 11;; \\ ffii kkiillll --HHUUPP ``ccaatt //eettcc//nnaammeedd..ppiidd`` xx==``ccaatt iinnssttaallll``;; xx==``eexxpprr $$$$xx ++ 11``;; eecchhoo $$$$xx >>iinnssttaallll --rrmm ccoorree **~~ UUWWOO//MMaakkee 4466