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: Paul D. Smith
Subject: Re: Executing a shell script in a Makefile
Date: Wed, 29 Sep 2004 12:58:17 -0400

%% 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




reply via email to

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