List Info

Thread: make




make
user name
2006-05-05 06:34:03
Joost,
	Thanks for the link. I will check it out. Right now, I have
an
issue when performing a "CD" command in a for
loop. When there is no
directory ( say qatest ), the loops goes back to the very
top of the
parent directory and keeps building (looping endlessly)
until the
machine runs out of memory! I want to perform a check if the
CD failed,
then ignore it and go onto the next one or failed the whole
build and
exit. I was hoping there is something like the if test
statement below I
used to check if the file built or not.

build:
	$(QUIET) for sd in $(SUBDIRS); do ( $(CD)
"$$sd";	\
	\
	$(ECHO) "***** Building DEBUG version of $$sd lib
*****";
$(MAKE) clean; \
	$(MAKE) PTV_BUILD=$(DBG_BUILD) $(DBG_TARGET); \
	if test -f "$$sd".ptv; then $(CP)
"$$sd".ptv $(DBG_TARGET)dir;
fi; \
	\
	$(MAKE) clean; $(ECHO) "***** Building PRODUCTION
version of
$$sd lib *****"; \
	$(MAKE) PTV_BUILD=$(PRD_BUILD) $(PRD_TARGET); \
	if test -f "$$sd".ptv; then $(CP)
"$$sd".ptv $(PRD_TARGET)dir;
fi;); done 


Thanks 
Danny Wong 
SCM Engineer 


-----Original Message-----
From: Leeuwesteijn,Joost [mailto:joost.leeuwesteijndraeger.com] 
Sent: Thursday, May 04, 2006 11:19 PM
To: Wong, Danny H.
Cc: help-makegnu.org
Subject: RE: make

>   dw> I was wondering if there when using Cygnus
"make". Is there a
>   dw> MAKESTATUS Marco to check the previous command
exit status?
> No, there is not.
>
> I'm not at all sure how you intend to use such a
thing... I don't see 
> very many, if any, ways to use it.

Perhaps the same reason I posted a question on how to handle
non-zero
exit codes without using '-' (IGNORE_ERROR) in front of a
command. My
compiler also returns a non-zero exit code in case of (just)
warnings.
Danny, you might want want to check that post. Subject =
"Ignore error",
posted by me.
Hang on, this one:
http://lists.gnu.org/archive/html/help-make/200
6-05/msg00007.html

--
Joost Leeuwesteijn


- - - - - - - Appended by PowerTV, A division of Scientific
Atlanta. - - - - - - - 
This e-mail and any attachments may contain information that
is confidential, proprietary, privileged or otherwise
protected by law. The information is solely intended for the
named addressee (or a person responsible for delivering it
to the addressee). If you are not the intended recipient of
this message, you are not authorized to read, print, retain,
copy or disseminate this message or any part of it. If you
have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your
computer.


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
make
user name
2006-05-05 12:12:40
%% "Wong, Danny H." <dwongpowertv.com> writes:

  wdh> Right now, I have an issue when performing a
"CD" command in a
  wdh> for loop. When there is no directory ( say qatest
), the loops
  wdh> goes back to the very top of the parent directory
and keeps
  wdh> building (looping endlessly) until the machine
runs out of
  wdh> memory! I want to perform a check if the CD
failed, then ignore
  wdh> it and go onto the next one or failed the whole
build and exit. I
  wdh> was hoping there is something like the if test
statement below I
  wdh> used to check if the file built or not.

Just as I suspected: you are not thinking clearly about the
very bright
line between the shell and make.  That line is a process
boundary, and
cannot be crossed:

Make takes each entire line of the script and invokes a
shell, passing
it the line to be run.  Make then waits for the script to
finish and at
the end of it, retrieves the final exit status.


In NO WAY can make interfere with, influence, or obtain
information
about the script WHILE IT IS RUNNING!  The script is run in
a completely
separate process, the shell, and make is sitting doing
nothing while the
shell runs it.

So, even if such a variable WERE to exist it wouldn't help
you in any
way!  Make could only set it after the entire script
finishes, and
there's no way the shell could query it, since the shell is
already
finished by the time make would set it.

  wdh> build:
  wdh> 	$(QUIET) for sd in $(SUBDIRS); do ( $(CD)
"$$sd";	\
  wdh> 	\

You have to use SHELL constructs to manage your shell
script, not MAKE
constructs (like make variables).  The shell keeps the exit
code of the
last command invoked in the "$?" variable.

Or you can use logic operators like && and ||.

You should change this to exit, like this:

    $(CD) "$$sd" || exit 1; \


You should read up on the shell: any good make user must
also be a good
shell programmer.

HTH!

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


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )