Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by silasdavis

7 months ago

Someone remind me, is it $@ or $< ?

2 comments

silasdavis

Reply

spc476  7 months ago

In a given rule:

    foo.o : foo.c
            $(CC) $(CFLAGS) -o $@ $<

The "$@" is the output (or target, think of @ as a bullseye on a target), and the "$<" is the input (think redirection). The only other commonly used variable is "$^":

    foo : foo.o util.o other.o
            $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

In this case, "$^" means "all inputs".

pwdisswordfishz  7 months ago

For what?

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities