* Hyrum Wright [Thu, 28 Oct 2004 at 16:10 -0600]
<quote>
> Hello all,
> I'm trying to build a generic makefile rule, so that every time I get 
> some more app code for one of my classes, I don't have to add a bunch of 
> rules to the makefile, I just have to add the output binary to one 
> place, and make magically finds it.
> 
> I'm not having very much success, though.  Here are the relevant 
> portions of the makefile.
> 
> 
> BIN_FILES=\
>         lab5.bin \
>         lab4d.bin \
>         lab4c.bin \
>         lab4b.bin
> 
> $(BIN_FILES): %.bin: %.s
>        nasm $@ -o $< -l %.lst
> 
> 
> By my understanding, assuming the makefile knows how to build the 
> corresponding .s file, this should do that, and then build the .bin 
> file.  This rule should be applicable for each of the files specified in 
> the BIN_FILES variable.  Except, it doesn't work.  I simply the 
> following back from make:
> 
> mustard ee425lab $ make
> Make: Don't know how to make %.bin:.  Stop.
You've almost got it. When you type 'make' it trys to make the first
rule it finds, which is '%.bin' except that's not the rule you want to
make. You want to specify a rule that will match the generic rule and be
substituted in. Try 'make lab6.bin' or add a default rule as the first
one, e.g.
all: $(BIN_FILES)

Hope that helps, and keep up the good work with make files, it sure
helps to simplify life.

Von Fugal

Attachment: signature.asc
Description: Digital signature

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to