|
From: | Boris Godin |
Subject: | Re: Execute command for each file in list? |
Date: | Wed, 25 Jun 2008 09:31:14 -0300 |
User-agent: | Thunderbird 2.0.0.14 (Windows/20080421) |
If you are using some program that takes a file or path as an
arguments, you will need to change file path, replacing / by \ and
/cygwin/diskdrive by /diskdrive: For example: define FILE_Template (tab here)$(COMPILER) $(FLAGS) '$(subst /,\,$(subst /cygdrive/c,c:,$(1)))' endefAnother thing is that make takes \ as an escape character, that's why I put ' character there. Also you might check that all the tabs are placed (many editors change tab by spaces) or if not, you are using .ASSUMETAB directive all: (tab here)$(foreach file, $(FILES), $(eval $call( FILE_Template,$(file))))Cheers. PlebianX wrote: I've changed the file to using this method now (%.r34:%.c in my case) I've got to apolagize also, the code in my previous post was typed off the top of my head and things like parenthesis bugs were mostly because of that, rather than the cause of my real problems. Now make at least tries to run my commands, but for some reason they are failing. I'm wondering if this is because I'm on windows? The command is formatted exactly as it is with my current build process (hand-made batch file :P) but for whatever reason the command misinterprets the options, as if there were some strange symbol where space should be. I guess that's as crazy as it sounds, leaving me stuck with .bat files. :( Paul Smith-20 wrote:On Wed, 2008-06-18 at 15:36 +0200, Sam Ravnborg wrote:define FILE_Template $(COMPILER) $(FLAGS) $(1) endef all: $(foreach file, $(FILES), $(eval $call( FILE_Template,$(file)))) What's happening here that I'm missing? Thanks in advance!You have some obvious paranthesis bugs. But I think the need for double escaping fouls you. Please read the chapter on "eval" in info make. And consider if you really need to use eval here.Sam is right; this is one of those cases where, given a hammer (and eval is a hammer with a particularly slippery grip), everything looks like a nail. What's wrong with the tradition, portable, been-in-use-since-the-1970's method of doing this: all: for file in $(FILES); do $(COMPILER) $(FLAGS) $$file || exit 1; done I mean, besides the fact that is totally wrong given -k and also given parallelism (-j)? For that matter, what's wrong with the usual method which works properly in all situations: all: $(FILES:.asm=.o) %.o : %.asm $(COMPILER) $(FLAGS) $< -- ------------------------------------------------------------------------------- Paul D. Smith <address@hidden> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.us "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list address@hidden http://lists.gnu.org/mailman/listinfo/help-make --
Boris Godin Java Developer - Gameloft COR Paraná 560, Nueva Córdoba (CP 5000) Tel.: (+54 0351) 460 26 26 int. 111 MSN: address@hidden -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. |
[Prev in Thread] | Current Thread | [Next in Thread] |