Errata

Managing Projects with GNU Make

Errata for Managing Projects with GNU Make

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Other Digital Version 2.1.2
9th paragraph

Because the printf is in a phony target, the message is printed immediately before any prerequisites are updated

Should read...

Because build_msg is in a phony target, the message is printed immediately before any prerequisites are updated

David Weintraub  May 18, 2012 
Printed Page 4
4th paragraph

The sentence starting:
"So the principle"
should be
"So the principal"

(Mixing up principal and principle.)

Adrian Hill  Jan 21, 2010 
PDF Page 5
the sample code session after the second paragraph

If we directly compile the sample codes, we might get a warning message under some Linux environments:
warning: incompatible implicit declaration of built-in function ?exit?

In order to avoid this warning prompt, we need to add one line to beginning of the source file "count_words.c" before "#include <stdio.h> as following:
#include <stdlib.h>
#include <stdio.h>



Charles Chen  Nov 18, 2010 
Printed Page 6
last paragraph

There is a hyphen being interpreted like an in-word break. Text ([c] ... [/c] denotes fixed-width code snippet):

When a prerequisite of the form [c]-l<NAME>[/c] is seen, ...

It has been typeset thus:

When a prerequisite of the form-

Anonymous   
Printed Page 7
The 3rd line from the bottom of the page.

"GNUMakefile" should read "GNUmakefile".

Anonymous  Oct 18, 2008 
Printed Page 11
last paragraph

In the sentence "The command for this rule uses three make variables.", "three make variables" should be "four make variable" because the above codes show four variables: $(COMPILE.c) $(RULE_FLAGS) $(OUTPUT_OPTION) $<
all the four variables with "$" ahead.

Charles Chen  Nov 03, 2010 
Printed Page 12
1st paragraph of the section "Wildcards"

"Wildcards are automatically expanded by make whenever a wildcard appears in a
target, prerequisite or command script context."

Because neither "target", "prerequisite" nor "command script" is an adjective, none
of them should be used to modify "context". In fact, it is not clear that "target"
and "prerequisite" are intended to modify "context". There is a disconcerting change
in number of the subject of the sentence following "whenever".

In the last paragraph of the section on "Wildcards", the author makes the distinction
between the expansion done by make and the expansion done by the command shell. It
seems to be an oversimplification to write, "Wildcards are automatically expanded by
make ... in a ... command script context." I would be better to leave out "by make"
here, since "by what" is explained later.

The sentence should be written, "A wildcard is automatically expanded whenever it
appears in the context of a target, prerequisite or command script."

Anonymous   
12
Last paragraph

When fixing a previous error submitted on Jun 01, 2009, the following paragraph was added:

When mp_make expands a wildcard (or indeed when mp_make
looks for any file), it reads and caches the directory contents.
This caching improves mp_make's performance considerably.
However, once mp_make has read and cached the directory contents,
mp_make will not "see" any changes made to the directory. This
can be a mysterious source of errors in a mp_makefile. The issue
can sometimes be resolved by using a sub-shell and globbing
(e.g., shell wildcards) rather than mp_make's own wildcards, but
occasionally, this is not possible and we must resort to bizarre
hacks.

I believe that the `mp_` were meant to imply that the text should be emphasized, but instead are included in the text. This is quite confusing, as reading it it seems like `mp_make` is a different program from `make`

Ryan Brideau  Dec 20, 2018 
ePub Page 25
When discussing the comment character for make.



Instead of rendering the # character, there are simply spaces in the ebook. Examining the HTML files in the .epub indicates that the character is entirely missing from the HTML of the book, rather than simply being rendered incorrectly.

Examples:

The comment character for make is the hash or pound sign, .
(This line should read: The comment character for make is the hash or pound sign, #.

The entire line, including the and subsequent characters, is passed to the shell for execution.
(This line should read: The entire line, including the # and subsequent characters, is passed to the shell for execution.

Anonymous  Jan 09, 2015 
Printed Page 29
code on the bottom of the page

$(AWK), $(SORT) and $(PR) variables are not defined on my system. Even when I run make -p, I still don't get the names of these variables in the data base. What should the be defined to?

Thank you

Anonymous  Nov 21, 2008 
Printed Page 38
Entire section, "Using Libraries as Prerequisites"

That section doesn't appear to explain how to *customize* the library search path
if you use the "-l" form of prerequisite. According to the online make manual:

"When a prerequisite's name has the form `-lname', make handles it specially by
searching for the file `libname.so' in the current directory, in directories
specified by matching vpath search paths and the VPATH search path, and then in the
directories `/lib', `/usr/lib', and `prefix/lib' (normally `/usr/local/lib', but MS-
DOS/MS-Windows versions of make behave as if prefix is defined to be the root of the
DJGPP installation tree).

If that file is not found, then the file `libname.a' is searched for, in the same
directories as above."

There is no mention of vpath or VPATH in that section, and that seems to be a
pretty major omission.

Anonymous   
Other Digital Version 38
4th paragraph

Paragrapn keeps referring to "mp_make" and "mp_makefiles". Shouldn't it be just "make" and "makefiles"?

David Weintraub  May 18, 2012 
Printed Page 55
In the example to use "strip" function.

The double quotations don't match: it should read
ifeq "$(strip $(OPTIONS))" "-d"
instead of
ifeq "$(strip $(OPTIONS)) "-d"

Anonymous  Oct 18, 2008 
Printed, ePub Page 55
third text paragraph

The book states "The difference is ... while the ifdef and ifndef operators test for a nonempty value". But the GNU Make manual <http://www.gnu.org/software/make/manual/make.html#Conditional-Syntax> states "Note that ifdef only tests whether a variable has a value. It does not expand the variable to see if that value is nonempty."

Actually testing it shows that the GNU Make manual is right and the book is wrong.

I'm calling it a serious mistake because some makefile code that I wrote relying on the book caused one of my colleagues considerable perplexity and wasted debugging time.

Neil Faiman  Aug 08, 2013 
Printed Page 58
second line

"CURDIR will contain the directory argument to --include-dir."

should be:

"CURDIR will contain the directory argument to --direcotory."

Louis.Wen  Nov 17, 2010 
Printed Page 70
In the example at the bottom

First, the comma seems to be missing between the first and the second arguments.

Second, the return value.
The first number which is returned by $(words $1) should be larger than or equal to the second, because the second one is $(sort)ed. Therefore, the first number matches to the second only if there's NO duplicate, and in that case the function is non-null...

Anonymous  Oct 21, 2008 
Printed Page 71
4th, 5th, and 7th code samples

The file-to-class-name function examples are assigned as simple variables (:=), but function calls must be recursive variables (in order to expand the parameter variables within the function).

Matthew Schnaider  Nov 14, 2011 
Printed Page 73
last code sample

The "file-to-class-name" function example is assigned as a simple variable (:=), but function calls must be recursive variables (in order to expand parameter variables at the time of the function call).

Matthew Schnaider  Nov 14, 2011 
Printed Page 83
The last shell command line of the page

The typo: the command line option should read "--print-data-base" instead of "--print-database".


Also, it's not clear why "ls.o" depends on "ls.c" as the command output printed on the book. The output of this command is different from what I tried:

[bruin@f12 tmp]$ gmake -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-redhat-linux-gnu
[bruin@f12 tmp]$ cat Makefile
define mac
$1_src = $(filter %.c,$2)
$1_hdr = $(filter %.h,$2)
$1_obj = $(subst .c,.o,$(filter %.c,$2))

$($1_obj): $($1_hdr)
endef

ls: $(ls_obj)

$(eval $(call mac,ls,ls.c ls.h glob.c glob.h))



[bruin@f12 tmp]$ gmake -p|grep ^ls
ls_src = ls.c glob.c
ls_obj = ls.o glob.o
ls_hdr = ls.h glob.h
ls:
[bruin@f12 tmp]$


Yuwu Xiong  May 02, 2012 
Printed Page 127
3rd paragraph

The sentence:
"Of course, the order of these filename components is up your site."
has a missing "to". It should be:
"Of course, the order of these filename components is up to your site."

Adrian Hill  Jan 21, 2010 
Printed Page 151-152
Last code example on page 151

change:

-e 's/ *\$$$$//'
-e 's/^$$$$/ d'
-e 's/$$$$/ :/' $3.tmp >> $3.tmp

to:

-e 's/ *\$$//'
-e '/^$$/ d'
-e 's/$$/ :/' $3.tmp >> $3.tmp

Anonymous   
Printed Page 151
2nd line of make-depend definition

change

's,\($$(notdir $2)\) *:,$$(dir $2) $3: ,' > $3.tmp

to

's,\($(notdir $2)\) *:,$(dir $2)\1 $3: ,' > $3.tmp

  May 25, 2009 
Printed Page 151
Last code example on page

change:

-e 's/ *\$$$$//'

to

-e 's/ *\\$$//'

Other errata in this make-depend macro are already listed

Fausto Marzoli  Sep 18, 2009 
Printed Page 152
itemized list at top of page

change:

3. Deletes trailing spaces

to:

3. Deletes trailing backslashes

Anonymous   
PDF Page 240
2nd to 4rth paragraph

`for` keyword should be `foreach`, which is a valid GNU Make function.

Konrad Talik  May 30, 2015