On 10/20/07, Billy Patton <address@hidden> wrote:
Philip Guenther wrote:
...
Having done that, you also need to update the dependency lists of any
other rules that claimed to require files in ${BIN_DIR} with the
suffix .pl. Your sample makefile doesn't include any of those, so I
can't show how you need to change them.
...
Thanks for your response, I made the changes you had but that
resulted in an error :
make: *** No rule to make target
`/home/bpatton/tool_box/bin/diffFiles.pl', needed by `x'. Stop.
Yes, that's what I was referring to in the paragraph of mine that I quote above.
Here is the makefile (shortened)
SCRIPTS := diffFiles.pl
x : $(addprefix ${BIN_DIR}/,$(SCRIPTS))
This says "in order to build 'x', first build
${BIN_DIR}/diffFiles.pl", which is obviously wrong: you don't want
${BIN_DIR}/diffFiles.pl. So, stop lying to make. There are two
obvious ways to do that:
1) drop the suffix when expanding the dependency list:
x : $(addprefix ${BIN_DIR}/,$(basename $(SCRIPTS)))
2) drop the suffix from the SCRIPTS assignment:
SCRIPTS := diffFiles
Which of this is the Right Choice depends on how you're using
$(SCRIPTS) elsewhere in the makefile. Is it the names of the *source*
files, of the names of the *destination* files? If the former, use
option (1). If the latter, use option (2). Either way, you need to
use it consistently.
I have these rules for .csh, .tcsh,.sh,.bash, and .pm
.pm differs slightly but the concept is the same.
Either of the above options can work with multiple possible suffixes.
Do you want to specify for yourself what the proper source suffix is
for each script, or do you want make to figure that out for you by
checking which one is present?
Philip Guenther