change variable for a target in a Makefile
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
加载中,请稍侯......
精彩评论