Reputation: 87
What is the difference between the implicit variables $<
and $^
in a makefile?
For example:
$(LIBS): $(LIB_OBJS)
$(CC) $(CFLAG) -shared $< -o $@
and
$(LIBS): $(LIB_OBJS)
$(CC) $(CFLAG) -shared $^ -o $@
It seems that the result is the same. In my case, I let $(LIBS) and $(LIB_OBJS) only have one file each.
Upvotes: 3
Views: 160
Reputation: 4314
To quote from the GNU Make "Automatic Variables" page:
$<
The name of the first prerequisite. [...]
$^
The names of all the prerequisites, with spaces between them. [...]
So in your case when there is only one prerequisite there is no difference.
Upvotes: 5