make.doc (34746B)
1 2 3 4 5 6 7 8 NDMAKE version 3.8 9 ------------------ 10 Copyright (C) 1985, 1986 D. G. Kneller 11 All rights reserved. 12 13 14 Program Description 15 ------------------- 16 17 NDMAKE is an implementation of the UNIX(tm) program maintenance 18 utility called `make'. It has the same syntax and most of the 19 capability. If you are familiar with UNIX `make' you should have no 20 difficulties with NDMAKE. In the rest of this documentation, NDMAKE 21 will be referred to simply as MAKE. 22 23 MAKE is a utility that helps you maintain programs, particularly 24 programs that are composed of several modules (files). Once you 25 describe the relationships between these modules, MAKE will keep track 26 of the modules and only `make' those that are out of date with respect 27 to their sources. MAKE can also be used as a general compile and link 28 tool for handling single files, much like a batch file. 29 30 One feature of MAKE that makes it very useful for software development 31 is its special handling of LINK. Under MSDOS(tm), commands must be 32 shorter than the command line limit of 128 characters. Since LINK is 33 used so often when doing modular programming, MAKE knows about it 34 specially and will automatically generate a response file if the LINK 35 command is longer than the limit. 36 37 MAKE requires at least DOS 2.0 and uses a minimum of about 40000 bytes 38 of memory. Since MAKE executes other programs from within itself, 39 this memory will be unavailable to them while MAKE is running. Also, 40 since MAKE uses the file time to determine which files are out of 41 date, it is imperative that you either have a real-time clock or are 42 diligent about setting the time and date when you boot up. 43 44 45 Synopsis 46 -------- 47 48 make [ -f makefile ] [ options ] [ macros ] [ targets ] 49 50 The [ ] delimit optional parameters. [ options ] and [ macros ] will 51 be discussed later. 52 53 54 Description 55 ----------- 56 57 MAKE executes commands in a MAKE description file to update one or 58 more targets. The targets are typically the names of programs. If no 59 -f option is present, the MAKE description file called MAKEFILE is 60 61 62 63 64 65 66 67 NDMAKE v3.8 page 2 68 69 70 71 72 73 tried. If makefile is `-', the keyboard (standard input) is used as 74 the makefile. More than one -f option may appear. 75 76 Make updates a target if it is older than the files it depends on, or 77 if the target does not exist. If no targets are given on the command 78 line, the first target in the makefile is `made'. 79 80 81 The MAKE description files 82 -------------------------- 83 84 MAKE uses 2 description files: MAKEFILE and MAKE.INI. The description 85 files consists of several kinds of entries: 86 87 1) dependency and command lines 88 2) macro definitions 89 3) default rules 90 4) "dot commands" 91 92 When MAKE starts up, it looks for an initialization file called 93 MAKE.INI. This file usually contains only default rules and macro 94 definitions that you don't want to put in every makefile. The current 95 directory is searched first, followed by directories along the PATH. 96 You customize your copy of MAKE by changing MAKE.INI. 97 98 99 1) Dependency and command lines 100 ------------------------------- 101 102 These are lines that specify the relationship between targets and 103 prerequisites, and how to update the targets. The general form is: 104 105 targets : [prerequisites] 106 [<tab>command] 107 .... 108 109 where <tab> is the tab character. 110 111 The first line of an entry is a blank-separated list of targets, then 112 a colon, then a list of prerequisite files. All following lines that 113 begin with a tab are commands to be executed to update the target. 114 For example, assume you have a program TEST.EXE that is composed of 115 modules MAIN.OBJ and SUB.OBJ. Each of these depend on a common 116 include file, INCL.H, and on their respective `.c' files. The 117 makefile might look like: 118 119 test.exe : main.obj sub.obj 120 link main.obj sub.obj, test; 121 122 main.obj : main.c incl.h 123 msc -AL main.c; 124 125 sub.obj : sub.c incl.h 126 msc -AL sub.c; 127 128 129 130 131 132 133 NDMAKE v3.8 page 3 134 135 136 137 138 139 If a target appears on the left of more than one `colon' line, then it 140 depends on all of the names on the right of the colon on those lines, 141 but only one command sequence may be specified for it. The previous 142 example could have been written as: 143 144 test.exe : main.obj sub.obj 145 link main.obj sub.obj, test; 146 147 main.obj sub.obj : incl.h 148 149 main.obj : main.c 150 msc -AL main.c; 151 152 sub.obj : sub.c 153 msc -AL sub.c; 154 155 When you do the command `make' without any arguments, the first target 156 in MAKEFILE gets made. A dummy target is often used as the first 157 target when you wish to make several targets. For example: 158 159 all : target1.exe target2.exe 160 161 target1.exe : .... 162 163 target2.exe : .... 164 165 Executing `make' with no arguments results in both target1.exe and 166 target2.exe being made. This happens because MAKE always ensures all 167 prerequisites are up to date before it makes a target. Here, the 168 target ALL has two prerequisite files - TARGET1.EXE and TARGET2.EXE. 169 First TARGET1.EXE then TARGET2.EXE get made, then MAKE checks if 170 either of these files are more current than ALL. Since ALL doesn't 171 exist MAKE assumes its very old. Both TARGET1.EXE and TARGET2.EXE are 172 newer than ALL, so the commands to update ALL will be executed. MAKE 173 sees there are no commands and stops. 174 175 176 2) Macro definitions 177 -------------------- 178 179 Makefile entries of the form: 180 181 name = [value] 182 183 are macro definitions. Macros allow the association of a name and a 184 value. Subsequent appearances of $(name) or ${name} are replaced by 185 value. If name is a single character, the parentheses or braces are 186 optional. Spaces between name and =, and between = and value are 187 ignored. If value is not given, the macro value is a null string. 188 189 The previous example could have had: 190 191 OBJS = main.obj sub.obj 192 193 194 195 196 197 198 199 NDMAKE v3.8 page 4 200 201 202 203 204 205 test.exe : $(OBJS) 206 link $(OBJS), test; 207 208 main.obj : main.c 209 msc -AL main.c; 210 211 sub.obj : sub.c 212 msc -AL sub.c; 213 214 $(OBJS) : incl.h 215 216 Macros can be entered as command line parameters. For example: 217 218 A> make CFLAGS=-AL LIBS= test.exe 219 220 MAKE evaluates macros only when needed, and the order in which macros 221 appear in a description file is insignificant. Conventionally, all 222 definitions appear at the top of the description file. If the same 223 name is defined more than once, the most recent definition is used. 224 The precedence of definitions is: 225 226 1. command line definition (highest) 227 2. MAKEFILE definition 228 3. MAKE.INI definition 229 4. environment definition (lowest) 230 - this refers to the environment variables put into the DOS 231 environment with the `SET variable = value' DOS command. 232 233 234 Predefined macros: 235 236 There are 4 "run-time" macros. These are: 237 238 $* - stands for the target name with suffix deleted 239 $@ - stands for the full target name 240 $< - stands for the complete list of prerequisites 241 $? - stands for the list of prerequisites that are out of date 242 with respect to the target. 243 244 These are usually used when defining default rules (to be discussed 245 next). Unlike UNIX `make', you can use these run-time macros anywhere 246 they make sense. Thus, a dependency line for OBJS could be: 247 248 $(OBJS) : $*.c 249 250 The macro `MFLAGS' gets filled in with the initial command line 251 options supplied to MAKE. This can be used to invoke MAKE on 252 makefiles in subdirectories and pass along the options. 253 254 The macro `CWD' gets filled in with the current directory. If you 255 `cd' to another directory, you can `cd $(CWD)' to get back. 256 257 The macro `$$' evaluates to the dollar sign `$'. 258 259 260 261 262 263 264 265 NDMAKE v3.8 page 5 266 267 268 269 270 271 3) Default rules 272 ---------------- 273 274 MAKE can use default rules to specify commands for files for which the 275 makefile gives no explicit commands. A default rule tells MAKE how to 276 create a file with a particular extension from a file with the same 277 base name but another extension. Default rules take the following 278 form: 279 280 .from_extension.to_extension : 281 command 282 [command] 283 ... 284 285 For example, to produce a `.obj' file from a `.c' file, the default 286 rule could be: 287 288 .c.obj : 289 msc -AL $*.c; 290 291 When MAKE finds a target with no commands, it looks for the first 292 possible name for which both a rule and a file exist. There may be 293 several ways to produce a `.obj' file (eg from a C, FORTRAN, or PASCAL 294 compiler, or from MASM), and the order in which rules are attempted is 295 specified by the `.SUFFIXES' list. This is a special target with a 296 list of extensions. For example: 297 298 .SUFFIXES: .exe .obj .c .asm .for 299 300 If MAKE was trying to make a TEST.OBJ file using a default rule, it 301 would first look for a `.c.obj' rule (since `.c' follows `.obj' in the 302 .SUFFIXES list). If it found a `.c.obj' rule, it would check for the 303 file TEST.C. If the file didn't exist, MAKE would look for a 304 `.asm.obj' rule (and TEST.ASM file), and finally a `.for.obj' rule 305 (and TEST.FOR file). 306 307 Assuming MAKE.INI contained the .c.obj rule and .SUFFIXES as defined 308 above, our previous example could be written more succinctly as: 309 310 OBJS = main.obj sub.obj 311 312 test.exe : $(OBJS) 313 link $(OBJS), test; 314 315 $(OBJS) : incl.h 316 317 Because of the default rules, MAIN.OBJ and SUB.OBJ implicitly depend 318 on files MAIN.C and SUB.C, respectively, as well as explicitly 319 depending on INCL.H. 320 321 Suffixes accumulate, so if the makefile had the line: 322 323 .SUFFIXES : .obj .pas 324 325 326 327 328 329 330 331 NDMAKE v3.8 page 6 332 333 334 335 336 337 the suffix list would look like: .obj .pas .exe .obj .c .asm .for 338 (the ".obj .pas" from .SUFFIXES of the makefile and the ".exe .obj .c 339 .asm .for" of make.ini). 340 341 A .SUFFIXES line with no suffixes clears the list of suffixes. 342 343 344 4) "dot commands" 345 ----------------- 346 347 Besides the special target `.SUFFIXES' mentioned above, there are a 348 few other special targets that can be put in MAKE description files. 349 350 .IGNORE - Commands returning nonzero status (ie. the exit code or 351 errorlevel) cause MAKE to terminate unless the special 352 target `.IGNORE' is in makefile or the command begins with 353 `-' (hyphen). Equivalent to the `-i' option. 354 355 .SILENT - Commands to be executed are printed when executed unless the 356 special entry `.SILENT' is in makefile, or the first 357 character of the command is `@'. Equivalent to the `-s' 358 option. For example: 359 360 all.exe : 1.obj 2.obj 3.obj 361 link 1 2 3, tmp.exe; # this line will be echoed 362 - exepack tmp.exe all.exe # ignore any errors 363 @erase tmp.exe # don't echo this line 364 365 .PRECIOUS - Break (control-C) and command errors cause the target 366 being worked on to be deleted unless the target has no 367 prerequisites (explicit or implicit), or depends on the 368 special name `.PRECIOUS'. For example: 369 370 nerase.exe : nerase.obj .PRECIOUS 371 link nerase; 372 373 .BEFORE - Before MAKE starts determining which files need to be made, 374 it executes all commands associated with this target. Use 375 this to turn off resident programs which affect the workings 376 of MAKE (notably, the program DPATH). MAKE uses DOS 377 interrupt 3Dh to open files, then interrupt 57h to get the 378 file time. 379 380 .AFTER - After MAKE has finished running, all commands associated 381 with this target are executed. .BEFORE could turn off 382 DPATH, .AFTER could turn it back on. For example: 383 384 .BEFORE: 385 @ echo Hello world! 386 .AFTER: 387 @ echo Goodbye cruel world ... 388 389 None of these special targets can be default targets. 390 391 392 393 394 395 396 397 NDMAKE v3.8 page 7 398 399 400 401 402 403 OPTIONS 404 ------- 405 406 Options are entered on the command line with a `-' preceding them. 407 You cannot use `/' instead of `-'. Options can be grouped together 408 after a single `-', so -nd is equivalent to -n -d. 409 410 -d Debug mode. Prints information on macros, dependencies, 411 SUFFIXES, default rules. Also traces MAKE as it executes. 412 413 -h Print a help screen. 414 415 -i Equivalent to the special entry .IGNORE. Causes commands 416 that return errors to be ignored. Doing `make -i > errs' 417 collects all error messages into 1 `errs' file. To stop 418 running `make -i' you may have to push ^C several times. 419 420 -k Keep going. When a command returns nonzero status, abandon 421 work on the current target, but continue on branches that do 422 not depend on the current target. 423 424 -n Display but do not execute the commands needed to update the 425 targets. Doing `make -n > todo.bat' produces the batch file 426 TODO.BAT containing the commands to be done. Executing the 427 batch file will update the targets. This technique can be 428 used if you don't have enough memory for MAKE to execute the 429 commands. 430 431 -r Clears .SUFFIXES after MAKE.INI is read. The effect of this 432 is to prevent MAKE from looking for default rules. 433 434 -s Equivalent to the special entry .SILENT. Commands are not 435 echoed to the screen before they are executed. 436 437 -t Touch, i.e. set the file time of the out of date targets to 438 the current time without executing any commands. This will 439 create target files of length zero if they do not exist. 440 MAKE `touches' files just like the included TOUCH.EXE 441 program. The small tutorial included later in this 442 documentation shows how to use this flag. 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 NDMAKE v3.8 page 8 464 465 466 467 468 469 UNIX features 470 ------------- 471 472 As with UNIX `make', dependency lines and default rules can have a 473 command on the same line as the `colon' line, provided the command 474 follows a semicolon: 475 476 .c.obj:; msc $*.c; 477 test.exe: $(OBJS); link $(OBJS), test; 478 @echo done 479 480 # are equivalent to 481 482 .c.obj: 483 msc $*.c; 484 test.exe: $(OBJS) 485 link $(OBJS), test; 486 @echo done 487 488 If a name appears on a line with a double colon, `::', then the 489 command sequence following that line is performed only if the name is 490 out of date with respect to the names to the right of the double 491 colon, and is not affected by other double colon lines on which that 492 name may appear. Consider the following makefile: 493 494 1:: 2 495 @echo 2 496 1:: 3 497 @echo 3 498 499 If 2 and 3 are more recent than 1 and you type: 500 501 A> make 1 502 503 The response will be: 504 2 505 3 506 507 If 1 is more recent than 3, but 2 is newer than 1 the response is: 508 2 509 510 If 1 is more recent than both 2 and 3, the response will be: 511 Make: `1' is up to date. 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 NDMAKE v3.8 page 9 530 531 532 533 534 535 Additional notes and technical information 536 ------------------------------------------ 537 538 Lines in a MAKE description file that are too long to fit on one line 539 can be extended to the next line by putting backslash, `\', followed 540 be <RETURN> as the last two characters of the line. If you need a `\' 541 as the last character, put a space or comment character somewhere 542 after it on that line. The longest single line MAKE can handle is 512 543 bytes, but by using `\' to break up the line into shorter pieces, 544 there is no limit to line length (except available memory). 545 546 Case is unimportant, so `test.obj' and `TEST.OBJ' are the same. 547 548 Everything on a line after the comment character, `#', is ignored. 549 550 The character separating targets and dependents, `:', is also the 551 character used for the drive separator in MSDOS. To distinguish this 552 colon from the drive separator, it must be followed by space or tab 553 (eg: ), semicolon (eg:;), colon (eg::), or nothing (eg:<return>). If 554 you consistently use a space you will have no problems. 555 556 If you type in a `makefile' from the keyboard (by using the command 557 `make -f -'), put a ^Z (control-Z) followed by a <RETURN> as the last 558 two characters. This tells MAKE to stop reading from the keyboard. 559 560 Targets defined in MAKEFILE take precedence over targets of the same 561 name defined in MAKE.INI. Targets defined in MAKE.INI can never be 562 default targets. 563 564 MAKE is stupid in that after the commands to update a target have been 565 executed without error, MAKE assumes the target is up to date. If you 566 give commands that don't really update a target, MAKE doesn't know. 567 568 When MAKE executes commands, such as `link', it first tries to find a 569 file called `link.exe' (or `link.com'). If the file is not found, 570 MAKE loads a second copy of COMMAND.COM and passes it the command 571 line, in the hope that the command is an internal DOS command. This 572 is backwards to how COMMAND.COM normally works (first checking 573 internally, then checking externally). It is done this way for two 574 reasons: 1) for speed and lower memory requirements, and 2) because 575 the second copy of COMMAND.COM *does not* return the exit code of the 576 passed command. I'm using Microsoft C v3.0 and PCDOS 2.0, so if 577 anyone knows how to get the exit code back, please let me know. 578 579 You can force MAKE to load a second copy of COMMAND.COM by putting a 580 `+' as the first letter in the command. This will be faster for 581 executing internal DOS commands. You can put more than one of `-', 582 `@', and `+' for each command. Ex: 583 584 @+ echo Using + is faster for internal DOS commands 585 586 MAKE always uses a second copy of COMMAND.COM if the command involves 587 redirection of IO (with `>', `>>', `<', or `|'). If you're using IO 588 589 590 591 592 593 594 595 NDMAKE v3.8 page 10 596 597 598 599 600 601 redirection just to capture MAKE output, use redirection at the level 602 you invoke MAKE (ie. from DOS, something like `make > make.out'). 603 604 Macros can refer to environment variables. For example, $(PATH) will 605 be filled in with the DOS environment variable PATH if there is no 606 PATH=... macro definition in MAKEFILE or MAKE.INI. This is handy for 607 environment variables like LIB (where your libraries are) and TMP (a 608 temporary area, usually a RAMdisk). 609 610 Macro definitions can refer to other macros. You could have: 611 612 CFLAGS = -A$(MODEL) -Od # remember, order is not important 613 MODEL = L 614 615 When it comes time to use CFLAGS, MAKE will expand CFLAGS as 616 `-AL -Od'. Command line macros have the highest precedence, so: 617 618 A> make MODEL=S test.exe 619 620 results in CFLAGS having the value `-AS -Od'. For command line macros 621 that contain spaces, enclose entirely the macro in double quotes, " ": 622 623 A> make "CFLAGS=-A$(MODEL) -Zd" MODEL=M test.exe 624 625 MAKE will let you define a recursive macro: 626 627 macro1 = $(macro2) # macro1 = the value of macro2 628 macro2 = $(macro1) # macro2 = the value of macro1 629 630 but signals a `recursive macro' error if it tries to use it. 631 632 633 Changes since version 3.0 634 ------------------------- 635 636 - The -k flag did not work due to a coding mistake. 637 638 - MAKE did not use the switchar when executing COMMAND.COM, thus not 639 working properly for people who had switchar = `-'. 640 641 - MAKE did not find MAKE.INI in directories ending with `\'. 642 643 - Targets in MAKE.INI no longer take precedence over targets in 644 MAKEFILE. Also, only the first target in MAKEFILE is used if MAKE is 645 invoked with no targets. Previously, if there was no MAKEFILE, the 646 first target in MAKE.INI got made. 647 648 - Too much memory was being used. MAKE used about 94000 bytes 649 regardless of the size of the makefile! Now MAKE uses a minimum of 650 about 40000 bytes. Larger makefiles require more memory. 651 652 - Touch (the -t flag) was made to act exactly like the UNIX version. 653 Previously it did not create a file if it did not exist. 654 655 656 657 658 659 660 661 NDMAKE v3.8 page 11 662 663 664 665 666 667 - .BEFORE and .AFTER were added to compensate for DPATH. 668 669 - Commas in the LINK command had to be separated by spaces if a 670 response file was being used. This was a bug. 671 672 - Space can be used instead of tab before command lines. This is 673 compensation for some editors which do not really do tabs. 674 675 - Fixed an uninitialized pointer problem that manifest itself with 676 large makefiles. 677 678 - Now "dot commands" and targets defined in MAKE.INI can no longer be 679 a default targets. 680 681 - .BEFORE and .AFTER have to been done even with `make -n'. 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 NDMAKE v3.8 page 12 728 729 730 731 732 733 Sample session - what MAKE does when it's running 734 ------------------------------------------------- 735 736 Assume you have the following MAKE.INI file and MAKEFILE. 737 738 739 make.ini 740 -------- 741 742 .SUFFIXES : .exe .obj .c .for .asm 743 M = S 744 CFLAGS = -A$M 745 746 .c.obj:; cl $(CFLAGS) -c $*.c 747 748 .obj.exe:; link $<, $@; 749 750 .c.exe: 751 cl $(CFLAGS) -c $*.c 752 link $*.obj, $@; 753 erase $*.obj 754 755 756 makefile 757 -------- 758 759 OBJS = main.obj sub.obj 760 761 test.exe: $(OBJS) 762 link $<, $@,,\lib\local; 763 764 $(OBJS): incl.h 765 766 sub.obj: sub.c 767 cl $(CFLAGS) -Od -c sub.c 768 769 install: test.exe 770 copy test.exe $(BIN) # BIN comes from the environment 771 772 ---------- 773 774 Assume the following files are in your directory: MAIN.C, SUB.C, 775 INCL.H. When you type: 776 777 A> make 778 779 MAKE first reads MAKE.INI then MAKEFILE. It sees the first target 780 TEST.EXE and tries to make it. But first, MAKE must know if the files 781 that TEST.EXE depends on are up to date. As TEST.EXE depends on 782 several `.obj' files, and these `.obj' files also have dependents, the 783 detailed procedure MAKE undergoes looks like this: 784 785 786 787 788 789 790 791 792 793 NDMAKE v3.8 page 13 794 795 796 797 798 799 -Make TEST.EXE 800 - there are explicit commands for making TEST.EXE so don't 801 bother looking for implicit prerequisites. 802 - TEST.EXE depends on MAIN.OBJ and SUB.OBJ. Make these. 803 - Make MAIN.OBJ 804 - Since there are no explicit commands for MAIN.OBJ, check 805 for implicit prerequisites based on default rules. 806 - Find rule `.c.obj' and file `main.c'. 807 - Add MAIN.C to the prerequisites of MAIN.OBJ. 808 - MAIN.OBJ depends on INCL.H and MAIN.C. Make these. 809 - Make INCL.H 810 - Since there are no explicit commands for making 811 INCL.H, check for implicit prerequisites. 812 - Since there is no `.h' suffix in .SUFFIXES, there are 813 no implicit prerequisites. 814 - There are no explicit prerequisites. 815 - There are no prerequisites, so assume INCL.H is up to 816 date. 817 - Make MAIN.C 818 - Since there are no explicit commands for making 819 MAIN.C, check for implicit prerequisites. 820 - Since there are no `.from_extension.c' rules, there 821 are no implicit prerequisites. 822 - There are no explicit prerequisites. 823 - There are no prerequisites, so assume MAIN.C is up to 824 date. 825 - Compare MAIN.OBJ with INCL.H and MAIN.C. Since MAIN.OBJ 826 doesn't exist, it is out of date with respect to its 827 prerequisites, so execute the (implicit) command: 828 829 cl -AS -c main.c 830 831 - Assume MAIN.OBJ is up to date. 832 - Make SUB.OBJ 833 - There are explicit commands for making SUB.OBJ so don't 834 bother looking for implicit prerequisites. 835 - SUB.OBJ depends on INCL.H and SUB.C. Make these. 836 - Make INCL.H 837 - MAKE already knows that INCL.H is up to date. 838 - Make SUB.C 839 - Since there are no explicit commands to make SUB.C, 840 check for implicit prerequisites. 841 - Since there are no `.from_extension.c' rules, there 842 are no implicit prerequisites. 843 - There are no explicit prerequisites. 844 - There are no prerequisites, so assume SUB.C is up to 845 date. 846 - Compare SUB.OBJ with INCL.H and SUB.C. Since SUB.OBJ 847 doesn't exist, it is out of date with respect to its 848 prerequisites, so execute the (explicit) command: 849 850 cl -AS -Od -c sub.c 851 852 - Assume SUB.OBJ is up to date. 853 - Compare TEST.EXE with MAIN.OBJ and SUB.OBJ. Since TEST.EXE 854 855 856 857 858 859 NDMAKE v3.8 page 14 860 861 862 863 864 865 doesn't exist, execute the command: 866 867 link main.obj sub.obj, test.exe,,\lib\local; 868 869 - Assume TEST.EXE is up to date. 870 871 Note the way $< gets replaced with the files TEST.EXE depends on, and 872 $@ gets replaced with TEST.EXE. Although in this case we could have 873 used $(OBJS) for $< and TEST.EXE for $@, when writing default rules we 874 don't know in advance that we want to link $(OBJS) to make TEST.EXE. 875 876 Assuming no errors occurred, when you now type `make' you will get the 877 message that TEST.EXE is up to date. If you edit SUB.C and change it, 878 when you next type `make', MAKE will see that SUB.C is more recent 879 than SUB.OBJ and recompile SUB.C. MAKE will then see that SUB.OBJ is 880 more recent than TEST.EXE and relink the files. 881 882 If you type `make install', MAKE will ensure TEST.EXE is up to date, 883 then copy it to your BIN directory. BIN was assumed to be defined in 884 your environment. 885 886 887 Use of flags -n, -t and -i 888 -------------------------- 889 890 Now assume you edit INCL.H and make changes that only affect SUB.C 891 (for example, you change the value of a #define but you don't have to 892 edit SUB.C). If you were now to type `make', MAKE would compile both 893 SUB.C and MAIN.C. To have MAKE only recompile SUB.C you do three 894 things. First, `make -t' to touch (update) all files. You will see 895 that MAKE touches MAIN.OBJ and SUB.OBJ, then TEST.EXE. Now, `touch 896 sub.c'. This results in SUB.C being newer than SUB.OBJ. Finally, 897 `make' again. Now MAKE will compile only SUB.OBJ, then link the 898 files. 899 900 The process of editing a common include file to change something that 901 only affects one file occurs often enough that the `make -t' + `touch' 902 + `make' procedure can save a lot of time. 903 904 If you are changing an include file and also changing some of the `.c' 905 files, then usually you edit the include file, do `make -t', edit the 906 `.c' files, then do `make'. 907 908 The `-i' flag is useful for collecting all errors into a single file 909 without stopping MAKE. This is helpful when you're porting software 910 and expect a lot of errors or when you make global changes that may 911 produce a lot of errors (for example, changing a structure definition 912 in an include file or changing from small to large code models). 913 914 The `-n' flag is used when you just want to see what MAKE will be 915 doing. This is useful if you've changed several modules, but forget 916 which ones. `make -n' shows which ones will be compiled. 917 918 919 920 921 922 923 924 925 NDMAKE v3.8 page 15 926 927 928 929 930 931 Using MAKE without a makefile 932 ----------------------------- 933 934 MAKE can be used in a limited fashion without having a makefile. 935 Assume you have a file called XYZZY.C and using the same MAKE.INI file 936 described above, you type: 937 938 A> make xyzzy.exe 939 940 MAKE uses its default rules to compile XYZZY.C, link XYZZY.OBJ to form 941 XYZZY.EXE, then erases XYZZY.OBJ. If several `.exe' files exist in a 942 directory and you have just finished editing some of their `.c' files, 943 you could type: 944 945 A> make *.exe 946 947 and update only the `.exe' files that are out of date. By adding more 948 default rules to MAKE.INI, MAKE could invoke the FORTRAN compiler for 949 `.for' files or MASM for `.asm' files. In this way, MAKE can do the 950 right thing for each type of file. You can do `make *.exe' and have 951 MAKE figure out what to do. 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 NDMAKE v3.8 page 16 992 993 994 995 996 997 USER-SUPPORTED SOFTWARE NOTIFICATION 998 ------------------------------------ 999 1000 If you like and use this program, I ask you to consider 1001 registering it. The benefits of registration include the first 1002 bugfix/enhanced version free. Registered owners will get a response 1003 to any questions they may have. The lastest version includes VPATH 1004 (a way to look for dependent files in other than the current directory), 1005 LIB support (like the current LINK support) and return codes from 1006 commands executed through COMMAND.COM. Also, there is support for 1007 writing to files so you build your own custom response files, a loop 1008 construct for looping over commands, and enhanced macros. 1009 1010 The suggested registration fee is $35. Regardless of whether you 1011 register or not, you may freely copy and distribute this program for 1012 noncommercial purposes. The programs, MAKE.EXE and TOUCH.EXE, the 1013 documentation, MAKE.DOC and TOUCH.DOC, and the initialization file, 1014 MAKE.INI, must all be distributed together. If you post this program 1015 to a public bulletin board, please put all the files in an ARChive 1016 called NDMAKE38.ARC 1017 1018 Commercial use of this program requires you to be registered. 1019 1020 I hope you enjoy NDMAKE and find it to be a useful addition to 1021 your programming tools. If you have any questions I can be reached by 1022 mail at: 1023 1024 UUCP: ...ucbvax!ucsfcgl!kneller 1025 ARPANET: kneller@ucsf-cgl.ARPA 1026 BITNET: kneller@ucsfcgl.BITNET 1027 FIDONET: node 125/84 (SCI-Fido 415-655-0667) 1028 1029 US MAIL: D. G. Kneller 1030 2 Panoramic Way #204 1031 Berkeley, CA 94704 1032 1033 1034 ---------- 1035 1036 UNIX is a registered trademark of Bell Laboratories. 1037 MSDOS is a registered trademark of Microsoft Corp. 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 NDMAKE v3.8 page 17 1058 1059 1060 1061 1062 1063 --------------------------------------------------------------------- 1064 1065 Registration form for NDMAKE v3.8 1066 1067 1068 1069 Name: _________________________________________________ 1070 1071 Address: _________________________________________________ 1072 1073 City, State, Zip: _________________________________________________ 1074 1075 Country: _________________________________________________ 1076 1077 1078 1079 OPTIONAL: System description (computer, memory, DOS version) 1080 1081 _____________________________________________________________________ 1082 1083 _____________________________________________________________________ 1084 1085 1086 1087 COMMENTS: Please feel free to add your thoughts or suggestions! 1088 1089 _____________________________________________________________________ 1090 1091 _____________________________________________________________________ 1092 1093 _____________________________________________________________________ 1094 1095 _____________________________________________________________________ 1096 1097 1098 1099 Mail to: 1100 1101 D. G. Kneller 1102 2 Panoramic Way #204 1103 Berkeley CA, 94704 1104 U.S.A 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122