List Info

Thread: makefile - define targets, dependencies in a variable




makefile - define targets, dependencies in a variable
user name
2006-11-03 23:21:40
Steve Calfee <stevecalfeehotmail.com> writes:

> So the question is can I define rules in a variable,
and maybe give an
> example?

If you're using a sufficiently new make you can, with $(eval
...).


define myrule
$($1_LIB) : $($($1_LIB)_OBJS)
        echo $$($1_LIB)_OBJS
        $(value $(AR) $(ARFLAGS) $ $(addprefix
$(OBJ_DIR)/,$(notdir $?)))
enddef

        ...

$(eval $(call myrule,$(PACKAGE_NAME)))


Or, anyway, something like that.  I just jotted this down
off the top of my
head.  See the GNU make docs for more info.

Cheers!

-- 
------------------------------------------------------------
-------------------
 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-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils
[1]

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