help-make
[Top][All Lists]
Advanced

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

Re: New syntax of for loop


From: Paul D. Smith
Subject: Re: New syntax of for loop
Date: Fri, 7 Jan 2005 17:40:36 -0500

%% "Mariusz Janczak" <address@hidden> writes:

  mj> I have a problem with using for loop within makefile :( I am
  mj> triying to generate a variable size file filled up with dummy
  mj> data:

  mj> forloop = $(shell for (( id=$(1) ; id>$(2) ; id-- )); do printf '\xff' >>
  mj> reserved.bin; done)

  mj> reserved.bin:
  mj>     @echo .. Creating $@ file ...
  mj>     $(shell echo -n > reserved.bin)
  mj>     $(call forloop, 10, 0)

I don't understand why you're using $(shell ...) in a command script
like this.  A command script is PASSED to the shell; that's what those
lines do.  Why not just write them directly?  You don't need $(shell
...) here.


Anyway, your problem is that make does not invoke your shell, whatever
that might be, when it runs commands: that would be a disaster.

Make always invokes /bin/sh, unless you override it by setting the SHELL
make environment variable.  /bin/sh is typically a POSIX shell, and it
doesn't support the enhancements that bash implements beyond POSIX.

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