| Date: Thu, 8 May 2008 14:11:26 +0100
| From: "Braun Brelin" <bbrelin at gmail.com>
| Someone sent me the following lines in a Makefile:
| XML_RULE = @echo " xml-rule $< xml2hpp.xsl $@" && \
| $(JAVA_BIN) -cp $(XT_DIR)/xp.jar:$(XT_DIR)/xt.jar \
| com.jclark.xsl.sax.Driver \
| $< $(CMKCMK)/xml2hpp.xsl $@
| They wanted to know what the "$<" and "$@" symbols mean.
the above is defining a make(1) macro called XML_RULE.
the ‘$@’ and ‘$<’ and all the ‘$(NAME)’s are expanded
by ‘make’ when that macro is invoked (NOT when it is
defined). the result of that expansion is clearly
intended to then run by a shell.
| The make program is running under ksh.
so what? I don't see anything specific to the Korn
shell above; it looks like it'd work with most any
| The $@ is almost certainly the builtin array $@ for command line arguments,
NO. not here. it is ‘make’s $@. the shell (Korn
or otherwise) never sees it. if the shell's $@ was
meant, then in a Makefile you'd what to write it $$@
(note the doubled $). and similarly for $<.
|[ ... ]
| Anyone else know what $< is in KSH?
AFAICR, there is $< in ksh(1).
‘make’ has truely awful syntax, and the semantics
can be rather daunting at times as well.
“How many surrealists does it take to | Brian Foster
change a lightbulb? Three. One calms | somewhere in south of France
the warthog, and two fill the bathtub | Stop E$$o (ExxonMobil)!
with brightly-coloured machine tools.” | http://www.stopesso.com
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!