[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: VPATH/vpath and Pattern Rules
From: |
Michael Ludwig |
Subject: |
Re: VPATH/vpath and Pattern Rules |
Date: |
Sat, 14 Jan 2012 16:20:29 +0100 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
Paul Smith schrieb am 14.01.2012 um 09:09 (-0500):
> On Sat, 2012-01-14 at 13:46 +0100, Michael Ludwig wrote:
> > # Pattern Rule
> > %.o: %.cpp
> > $(COMPILE.cc) $*.cpp -o $*.o
>
> This is not right. The $* variable matches the stem of the pattern.
Ah ... silly me. Relevant manual page:
http://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
> The stem of the pattern here is something like "Employee", the stem is
> NOT "emp/Employee". You can see this easily be changing your rule to
> print out the values of the various automatic variables.
Now that's useful! Will keep this snippet handy from now on:
@echo == $$@ $@
@echo == $$%% $%
@echo == $$^< $<
@echo == $$? $?
@echo == $$^^ $^
@echo == $$+ $+
@echo == $$^| $|
@echo == $$* $*
Can I define it as a function? To invoke it like: $(echoautovars)
> If you want this to work you need to use the $@ and $< variables, like
> so:
>
> %.o: %.cpp
> $(COMPILE.cc) $< -o $@
That works perfectly.
> Hope this helps...
It definitely does! Thanks a bunch.
--
Michael Ludwig