On Thu, 2008-10-16 at 11:49 +0800, Pan ruochen wrote: > subdir = $(subdir_z) > TARGET = /home/reach/proj/$(subdir) > $(TARGET): > @echo $(TARGET) $@ > define get_dir > $1 = release > endef > $(eval $(call get_dir,subdir_z))
> $make > /home/reach/proj/release /home/reach/proj > The variable $@ and TARGET are not expanded to the same string. How > does this happen? Look up the section "How make reads a makefile" in the GNU make manual. The $(TARGET) in the target list is expanded immediately as the makefile is read in, and in that situation "subdir_z" has not been set yet, so $(TARGET) expands to /home/reach/proj and so the value of $@ will be /home/reach/proj. The $(TARGET) in the recipe is not expanded until after the entire makefile is read in, and make starts to run rules--by that time subdir_z has been set to the value "release" so $(TARGET) here is /home/reach/proj/release. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> 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 [email protected] http://lists.gnu.org/mailman/listinfo/help-make
