Is there any way to insert 'newline' at foreach's expansion.
e.g. i want to run COMMAND on each of the value.
Can i write:
$(foreach v,$(VAR) COMMAND $a \n)
i can use ';' on unix, and '&' on command, but that
doesn't look clean. on win-nt, i want to run make in 'shell-less' mode,
i.e. without invoking sh or cmd.exe.
Also, can i define targets and depenency using foreach construct ?
Better than that, can make have a option, to always invoke
a preproceser ( m4 , cpp) over the makefile it reads. it's really
simple implementation wise ( fopen(file) ==> popen( "cmd file" ))
--Vardhan
At 03:20 AM 01-08-01, Paul D. Smith wrote:
>%% Anton Deguet <[EMAIL PROTECTED]> writes:
>
> ad> I want to build multiple lists of files based on the same string
> ad> substitution using some kind of loop. I tried something with foreach,
> ad> that is:
>
> ad> libs = lib1 lib2
>
> ad> lib1_cfiles_prefix = file1 file2 file3
> ad> lib2_cfiles_prefix = fichier1 fichier2 fichier3
>
> ad> now I want to build some object lists called lib1_obj, lib2_obj,
> etc...
> ad> which would contain:
>
> ad> lib1_obj = my_bin_dir/file1.o my_bin_dir/file2.o my_bin_dir/file3.o
> ad> lib2_obj = my_bin_dir/fichier1.o my_bin_dir/fichier2.o ...
>
>The expansion of functions in general cannot themselves be complete make
>command line such as variable settings. And although this kind of works
>in some limited conditions, they absolutely cannot expand to multiple
>lines and have that work in any way.
>
>This is the major new feature to be added in GNU make 3.80.
>
> ad> Can I force some kind of evaluation to set the variable during the
> ad> iteration of the foreach?
>
>No.
>
> ad> Any other solution/suggestion is welcome.
>
>You can create a rule which writes the results of the expansion out to a
>file, then include that file in your makefile:
>
> include variable.mk
>
> variable.mk: Makefile
> @rm -f $@
> @for l in $(libs); do \
> echo "$$l"'_obj = $$('"$$l"'_cfiles_prefix:%=my_bin_dir/%.o))' >>
> $@; \
> done
>
>or something like that. For the example you give here it's not really
>clear to me that it's worth all this trouble, but maybe your actual code
>is more complicated.
>
>--
>-------------------------------------------------------------------------------
> Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at:
> http://www.gnu.org http://www.paulandlesley.org/gmake/
> "Please remain calm...I may be mad, but I am a professional." --Mad
> Scientist
>
>_______________________________________________
>Help-make mailing list
>[EMAIL PROTECTED]
>http://mail.gnu.org/mailman/listinfo/help-make
--
Vardhan Varma <[EMAIL PROTECTED]> ... till Yahoo is free
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make