开发者

Using conditionals in automake

开发者 https://www.devze.com 2023-01-06 07:58 出处:网络
I recently switched from using Makefiles to using Automake, and I can\'t figure out how to write the following simple if statement using automake:

I recently switched from using Makefiles to using Automake, and I can't figure out how to write the following simple if statement using automake:

DEBUG ?= 1
ifeq (${DEBUG},1)
CXXFLAGS:=$(CXXFLAGS) -g
else
CXXFLAGS:=$(CXXFLAGS) -O3 -DNDEBUG
endif

Is this even possible to do if I'm using automake? Since it generates the makefile from automatically, does it make sense writing it in the Ma开发者_如何学Gokefile template? Or should I try to find some way of adding it the automatically generated Makefile?


No, you cannot use such a syntax with Automake. There is no exact equivalent for the first two lines.

You could do something close using an Automake conditional (see Usage of Conditionals in the Automake manual for examples), and set DEBUG from ./configure. However I see little point in doing that: if you want to change CXXFLAGS globally, simply alter this variable in configure, not in the Makefile.am.

0

精彩评论

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

关注公众号