Text File

Aucbvax.3068 fa.unix-wizards utzoo!decvax!ucbvax!unix-wizards Thu Sep 10 19:36:41 1981 make(1), multiple directories and other enhancements >From walton@LL-XN Thu Sep 10 19:27:17 1981 Andrew Knutsen at SRI-UNIX raised the question of make(1) and multiple directories. I do not know whether the following enhancements to V7 make would help him, but they might, and might be of interest to others. What follows is a several page memo. The .FILES feature allows prerequisites to be in any directory; rather the inverse of what Mr. Knutsen may have wanted, maybe. ---

LL-XN has a version of V7 make that has been reworked to allow more complex systems to be easily handled. The major goal was to allow one piece of C code to be compiled on one computer for several target operating systems and target computers.

The following are extra sections added to the manual to explain the extra features and provide some necessary knowledge about the standard features. Also, effort was put into making the program diagnose memory overflows better, and make more efficient use of data memory.

.SH ADDITIONS The following are additions to the BELL V7 make. .PP Macro names are expanded like other text, and so themselves may contain macro names. E.g. $(LIBES) is allowed. This provides a kind of case statement for macro definitions which is sometimes useful. Macro names are also expanded when they appear on the left side of a macro definition; but the expansion of the right side is delayed until the macro is used. .PP An entry with a name of the form .FILES.y for suffix .y may be used to list all the allowable implicit prerequisite files with suffix .y. The dependants of .FILES.y are the allowed prerequisites. If a file name f.x ends in a suffix .x, and if an implicit rule .y.x exists for suffix .y, and if the entry .FILES.y exists, then .FILES.y is made, and its dependency list is searched for an implicit prerequisite name of the form f.y or <SOME_DIRECTORY>/f.y. If such a name is found, it is used as a prerequisite with the shell commands of the .y.x rule. In any case if .FILES.y exists the search of the current directory for the prerequisite f.y is surpressed. .PP Sometimes searches for implicit prerequisites fill up memory with useless possible prerequisite names. These can be eliminated only by providing a .FILES.y entry for every possible prerequisite suffix. .PP The .INCLUDE statement may be use like the #include statement of the C macro processor. The syntax is .sp .INCLUDE "file"

.INCLUDE <FILE> .sp with the meaning that the file is inserted at the point the statement appears. If "" surrounds the file name, the file is first searched for in the directory that contains the file which contains the .INCLUDE statement. If not found, the file is searched for in the directory /usr/include. If surrounds the file name, only /usr/include is searched. If the file name begins with a /, no directories are searched and it is assumed that the full pathname has been given. \&.INCLUDE statements may be nested. The .INCLUDE must be at the very beginning of the line, and any comments must follow the file name. .PP Macros defined before a file is included may not be redefined during the inclusion: the included definitions are overridden and ignored just as such definitions are overridden and ignored by definitions appearing as arguments. Otherwise macro redefinitions are allowed provided the macro has not yet been used. An explicit exception to this rule is that builtin macros may always be redefined anytime before they are used. .PP The entry which is made by default if no argument lists an entry to be made is the first file name encounterred which does not begin with "." or which contains a "/": this is not an addition; it is true of standard V7 make. This means that the default entry may come from a .INCLUDE file. .PP The special suffix .NONE is known to make and should not appear in the suffix list. If a target file has no suffix from the .SUFFIX list, it is considered to have the suffix .NONE for the purposes of implicit prerequisite file searching. Rules with names of the form <SUFFIX>.NONE use this feature. .PP If a rule exists with a name of the form .NONE<SUFFIX> then implied prerequisite files whose names should be of the form <PREFIX>.NONE will in fact be taken to have names of the form <PREFIX> with no extension. .PP If a file name containing the meta-characters [, *, or ? does not match any existing file, then the name is deleted as if it did not exist, instead of being left unexpanded as in the shell or standard V7 make. This makes it easier for included makefiles to serve many different systems, some of which may not have some kinds of files. .SH REMARKS The following are remarks on the detailed behavior of the standard V7 make. .PP For every target a search is made for an implied prerequisite file, even if explicit rules for the target exist. Any shell commands provided by explicit rules override those provided by the implicit rules, but the target still depends upon the implicit prerequisite file. If the target name is t.s1 and a rule named .s2.s1 exists and the file t.s2 exists then t.s2 is necessarily a prerequisite for t.s1. However, if there are several such prerequisite files, the search stops after finding the first one. The search checks the target name for suffixes s1 first, and for each s1 that is a target suffix, searches for possible s2 suffixes. The order of the suffix searches is that of the .SUFFIX list with .NONE added to the end. .PP Normally shell commands are executed by calling the shell with the -e option, which terminates the shell program whenever an error is encountered, and in particular makes it impossible to put if, while, and similar commands in the shell command line. Putting a - at the begining of the shell command line surpresses the -e option. The -e option does not affect shell programs invoked indirectly by command names in the shell command; it only effects the shell commands directly contained in the makefile. .PP Whenever a ".SUFFIXES:" line with no dependents is read, all the previous dependents of .SUFFIXES are discarded. This provides a mechanism for clearing the suffix list prior to rebuilding it with more .SUFFIXES lines. .PP Whenever a line ".<SOMETHING>:" is read, all previous shell command lines for ".<SOMETHING>" are discarded. This is the mechanism that allows redefinition of ".suffix1.suffix2". .PP Macro calls are expanded immediately when encounterred in prerequisite or dependant file names, on the leftside of an equals sign in a macro definition, or in .INCLUDE statements. All other macro calls have their expansion delayed. Macro definitions are expanded when used, and may expand differently than they would have expanded when the macro was defined. Similarly shell command lines are expanded when used. A macro may not be redefined after it is used.

----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen <jgoerzen@complete.org> of http://communication.ucsd.edu/A-News/

This Usenet Oldnews Archive article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.