开发者

change variable for a target in a Makefile

开发者 https://www.devze.com 2023-02-06 17:16 出处:网络
In a Makefile I\'ve a target called objects and if I run make objects it produces .o from every .cpp. Now I want to introduce a target check-syntax that call the target object but before change the va

In a Makefile I've a target called objects and if I run make objects it produces .o from every .cpp. Now I want to introduce a target check-syntax that call the target object but before change the variable CFLAGS from -Wall -O2 to -Wall -O0 -fsyntax-only.

How to do it?开发者_如何学运维


(IN GNUMake, anyway, and I'll assume you meant CFLAGS)

CFLAGS = -Wall -O2

objects: ...
    whatever

check-syntax: CFLAGS = -Wall -O0 -fsyntax-only

check-syntax: objects
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号