help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple help for makefile copy foo.pl to bin/foo only after foo.pl ha


From: Billy Patton
Subject: Re: simple help for makefile copy foo.pl to bin/foo only after foo.pl has been touched
Date: Sat, 20 Oct 2007 08:07:18 -0500
User-agent: Thunderbird 1.5.0.8 (Windows/20061025)

Philip,
Thanks again for you help. Make is something that I must stay in to keep my brain straight on how to use. I make additions to my lists often, but changing the function is not something I do very often. I'm about to add SKIIL code to it is what started my to making correction to my other scripts.

Here's what I have changed to, I believe as to your suggestion:
SCRIPTS := diffFiles.pl
xxxx : ${SCRIPTS}
% : %.pl
 @$(PRINTF) "Copying %s to ${BIN_DIR}/%s\n" "$<" "$@"
 @$(COPY) $< ${BIN_DIR}/$@
 @$(CHMOD) +x ${BIN_DIR}/$@

This does the copy every time I co->touch->ci
What I experimented with was to delete bin/diffFiles.
This did nothing to make it get created again. I know there is no dependency for ${BIN_DIR}/diffFiles

So I tried this :
% : %.pl ${BIN_DIR}/% $(LIB)
 @$(PRINTF) "Copying %s to ${BIN_DIR}/%s\n" "$<" "$@"
 @$(COPY) $< ${BIN_DIR}/$@
 @$(CHMOD) +x ${BIN_DIR}/$@

and get :
make: Nothing to be done for `xxxx'.



Philip Guenther wrote:
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


--
   ___  _ ____       ___       __  __
  / _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___
 / _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
           /___/
Dallas, Texas, 214-480-1965,  address@hidden






reply via email to

[Prev in Thread] Current Thread [Next in Thread]