Makefile别名 [英] makefile aliases

查看:99
本文介绍了Makefile别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在下面的生成文件中解释$ @ $ ^ $

Please explain $@ $^ $ in the makefile below

LIBS  = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall

# (This should be the actual list of C files)
SRC=$(wildcard '*.c')

test: $(SRC)
    gcc -o $@ $^ $(CFLAGS) $(LIBS)

推荐答案

这是这两个符号的含义:

This is what these two symbols mean:

  • $ @是目标,即test
  • $ ^是规则的先决条件列表(在本例中为SRC=$(wildcard '*.c')中指定的扩展通配符列表)
  • $@ is the target i.e. test
  • $^ is the list of pre-requisites for the rule (which in this case is the expanded wild card list as specified in SRC=$(wildcard '*.c'))

自动GNU制作手册的变量页面.

这篇关于Makefile别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆