help-make
[Top][All Lists]
Advanced

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

Re: Executing a shell script in a Makefile


From: Noel Yap
Subject: Re: Executing a shell script in a Makefile
Date: Wed, 29 Sep 2004 14:14:34 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

Are you sure copyfile.sh doesn't exit until it's done?  How do you know?

G2345C wrote:

Sorry for the confusion. My typo problem

the makefile is like this:
all :
      $(SHELL) ./copyfile.sh
      cd $(OBJ_DIR) && mv foo.o newfoo.o

foo.o is a very large file that copy to $(OBJ_DIR) by
the 'copyfile.sh' script.
While the copy is in progress the 'mv' is executing
cause it to fail becase foo.c is not yet copy to the
$(OBJ_DIR)

Thanks




--- "Paul D. Smith" <address@hidden> wrote:


%% G2345C <address@hidden> writes:

 g> How do I ask the make file to wait for the
script
 g> finished its execution then move on to the next
step.

It always does.

 g> Look at the 'all' target below, I want to wait
for the
 g> 'copyfile.sh' script finish before 'cd to
OBJ_DIR' but
 g> it always 'cd to OBJ_DIR' before the script
finish
 g> copy file

No it doesn't.

 g> all :
 g>      $(SHELL) ./copyfile.sh
 g>      cd $(OBJ_DIR)

 g> (the script copy several large file, that is
how I know it cd to
 g> the OBJ_DIR before the copy finish)

I don't see how the fact that the script copies
several large files
tells you anything about when the cd runs.


Remember that the working directory is a function of
your current shell,
AND that every command make invokes is run in its
own shell.  So a
command like:

       cd $(OBJ_DIR)

is a complete no-op, since as soon as this command
is done the shell
will exit and there goes your working directory
context.

--


-------------------------------------------------------------------------------

Paul D. Smith <address@hidden>          Find some
GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a
professional." --Mad Scientist




=====
-------------------------
http://www.nguyen.bz/dvd
-------------------------

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make




reply via email to

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