开发者

How to affect order of targets, add additional steps etc. for Makefile.am?

Can I manage Makefile.am as I got used to manage Makefile?

Usually I create targets which calls each other in order to make t开发者_如何学JAVAhe project built.

But in Makefile.am I have some mysterious libqqq_la_SOURCES = ... which I don't know what is it doing exactly.

Where to write what compiler should it use for the given source? Where to add a step that "qqq.c is generated from qqq.vala"?

How to write Makefile.am as just Makefile?


Automake in 1.11 does have Vala support.

configure.ac:

AM_PROG_VALAC

Makefile.am:

AM_VALAFLAGS = whateverelse
whatever_SOURCES = xxx.vala


Automake will automatically copy over any Make targets you specify in Makefile.am into the generated Makefile. So you can generate any custom, complicated things just by including it in the .am file.

However, you shouldn't do this for everything -- that defeats the benefit that Automake is trying to provide you. Specifying

bin_PROGRAMS=foo
AM_CFLAGS=$(DEPS_CFLAGS)
foo_SOURCES=file1.cpp file2.cpp
foo_LDADD=$(DEPS_LIBS)

will generate a standard Make target anyway. I recommend you learn to use Automake macros for most standard things -- it will be more portable that way.

The best way to learn the rich variety of Autotools features is not to read the manual -- it's way too complicated and unorganizable. My suggestion is simply to take an existing open-source GNU project that is similar in build style (dependencies, platforms, etc) to yours, and examine its Autoconf and Automake files. The established projects have learned quite a few tricks that you can learn from.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜