unix commands in makefiles

Sun Visualization Products matthew at sunpix.East.Sun.COM
Mon Feb 19 09:19:37 AEST 1990


In article <6141 at umd5.umd.edu> jjk at astro.UMD.EDU writes:
}
}Running under sunos 4.0.3, I have the following in my makefile:
}
}__________________________________________________________________
}DEST          = $(HOME)/astrobin/`arch`
}__________________________________________________________________
}
}__________________________________________________________________
}LIBS          = $(HOME)/astro/astro.a \
}                $(HOME)/iraf/lib/`arch`/iraf.a \
}__________________________________________________________________
}
}I get the following error message when I try to make my program:
}
}make: Fatal error: Don't know how to make target `/a/jjk/iraf/lib/`arch`/iraf.a'
}
}Obviously, the `arch` works as expected in the DEST definition, but is
}not getting read properly in the LIBS definition.  Can someone please
}help me with this?
}
}Thanks
}
}Jim Klavetter

      Judging by the error message, I assume you were using `$(LIBS)' in a 
dependency list.  Thats were your problem is.  When you were using back-quotes
in the `DEST' macro, the text of that macro got passed to a shell and the 
shell did the command substitution.  Dependency lists are handled by make(1)
itself, and make does not know about command substitutions.

      To get around this problem, try making a new macro called ARCH. ARCH
can be set one of two ways.  

1) If you set an enviromental variable ARCH to the value of `arch` in your 
current working shell, it will propagate to a pre-defined macro in the makefile. 

2) Add the following macro definition to your makefile.  It uses a pre-defined
macro "$(TARGET_ARCH)" and strips off the preceding dash.

	ARCH = $(TARGET_ARCH:-%=%)


-- 
Matthew Lee Stier                            |
Sun Microsystems ---  RTP, NC  27709-3447    |     "Wisconsin   Escapee"
uucp:  sun!mstier or mcnc!rti!sunpix!matthew |
phone: (919) 469-8300 fax: (919) 460-8355    |



More information about the Comp.unix.questions mailing list