[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
disparity in Paul’s Rules
From: |
David Boyce |
Subject: |
disparity in Paul’s Rules |
Date: |
Wed, 18 Feb 2015 17:01:02 -0800 |
Am I missing something or is one of the iconic “Paul’s Rules of
Makefiles” a little wrong (or outdated)? Rule 5 at
http://make.mad-scientist.net/papers/rules-of-makefiles/ says:
"Every non-continued line that starts with a TAB is part of a command
script–and vice versa.”
But it’s not really as simple as that. Consider this test makefile:
% cat makefile
AA = 12
BB #= 42
.PHONY: all
all:
@echo "AA=$(AA) BB=$(BB)”
The BB line is prefixed with a tab and is not continued. With the
comment character in place it provides a ‘recipe commences before
first target. Stop.’ error but with the # removed it’s treated as a
valid variable assignment despite the leading tab:
% make
AA=12 BB=42
Clearly make “forgives” assignments which use a leading tab. I can’t
find anything explicit about this in the manual but the description of
the above error implies the same:
‘recipe commences before first target. Stop.'
"This means the first thing in the makefile seems to be part of a
recipe: it begins with a recipe prefix character and doesn’t appear to
be a legal make directive (such as a variable assignment)."
So maybe Rule 5 needs a wording update?
Also, the assignment of BB is clearly not "the first thing in the makefile”.
David
- disparity in Paul’s Rules,
David Boyce <=